@carrierllc/sdk 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,4 +35,4 @@ const agentTools = restTools(carrier)
35
35
 
36
36
  `new Mcp(token, { auth: "bearer" })` sends an OAuth access token or a Clerk organization API key. The default sends `?TOKEN=` to `https://mcp.carrier.llc/mcp`. `Cli` never invokes a shell. Catalog entries marked `internal` do not accept a customer API key.
37
37
 
38
- `npm install @carrierllc/sdk@0.2.2` installs this surface. `0.1.0` only creates connectivity intents and products. The published tarball is the compiled `dist` output, including the generated operation catalog.
38
+ `npm install @carrierllc/sdk@0.2.4` installs this surface. `0.1.0` only creates connectivity intents and products. The published tarball is the compiled `dist` output, including the generated operation catalog.
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "invocation": "carrier subscribers list",
4
4
  "domain": "subscribers",
5
- "summary": "List subscribers. OCS needs at least one of account/iccid/msisdn/imsi.",
5
+ "summary": "List subscribers. With no filter, uses your default account (lowest-id account under your reseller).",
6
6
  "write": false,
7
7
  "transport": "mcp",
8
8
  "tool": "list_subscribers",
@@ -1056,6 +1056,81 @@
1056
1056
  }
1057
1057
  ]
1058
1058
  },
1059
+ {
1060
+ "invocation": "carrier network-default show",
1061
+ "domain": "network-default",
1062
+ "summary": "Show the org network default (cheapest_available, all or custom) and what applies today. New assignments only.",
1063
+ "write": false,
1064
+ "transport": "mcp",
1065
+ "tool": "get_network_default",
1066
+ "restMethod": null,
1067
+ "restPath": null,
1068
+ "options": []
1069
+ },
1070
+ {
1071
+ "invocation": "carrier network-default set",
1072
+ "domain": "network-default",
1073
+ "summary": "Store the org network default. Changes no SIM and writes nothing to OCS; applies to new assignments.",
1074
+ "write": true,
1075
+ "transport": "mcp",
1076
+ "tool": "set_network_default",
1077
+ "restMethod": null,
1078
+ "restPath": null,
1079
+ "options": [
1080
+ {
1081
+ "flags": "--mode <mode>",
1082
+ "description": "cheapest_available | all | custom",
1083
+ "required": true
1084
+ },
1085
+ {
1086
+ "flags": "--list-id <id>",
1087
+ "description": "Steering list ID from `carrier steering list`. Required when --mode is custom.",
1088
+ "required": false
1089
+ }
1090
+ ]
1091
+ },
1092
+ {
1093
+ "invocation": "carrier network-default plan",
1094
+ "domain": "network-default",
1095
+ "summary": "Show which networks a SIM would get in the given countries. Read only. Falls back to all networks with a loud warning when the tariff is missing.",
1096
+ "write": false,
1097
+ "transport": "mcp",
1098
+ "tool": "plan_network_default",
1099
+ "restMethod": null,
1100
+ "restPath": null,
1101
+ "options": [
1102
+ {
1103
+ "flags": "--countries <codes>",
1104
+ "description": "Comma-separated ISO-3166 alpha-2 codes, e.g. CA,US",
1105
+ "required": true
1106
+ },
1107
+ {
1108
+ "flags": "--sim-mode <mode>",
1109
+ "description": "Override for this SIM: cheapest_available | all | custom",
1110
+ "required": false
1111
+ },
1112
+ {
1113
+ "flags": "--sim-list-id <id>",
1114
+ "description": "Steering list ID when --sim-mode is custom",
1115
+ "required": false
1116
+ },
1117
+ {
1118
+ "flags": "--package-mode <mode>",
1119
+ "description": "Override for this package: cheapest_available | all | custom",
1120
+ "required": false
1121
+ },
1122
+ {
1123
+ "flags": "--package-list-id <id>",
1124
+ "description": "Steering list ID when --package-mode is custom",
1125
+ "required": false
1126
+ },
1127
+ {
1128
+ "flags": "--reseller-id <id>",
1129
+ "description": "Reseller ID (omit for the token owner's reseller)",
1130
+ "required": false
1131
+ }
1132
+ ]
1133
+ },
1059
1134
  {
1060
1135
  "invocation": "carrier accounts list",
1061
1136
  "domain": "accounts",
@@ -1795,6 +1795,45 @@
1795
1795
  }
1796
1796
  ]
1797
1797
  },
1798
+ {
1799
+ "id": "get_network_default",
1800
+ "method": "GET",
1801
+ "path": "/v1/network-default",
1802
+ "tag": "Network",
1803
+ "summary": "Read the org network default (cheapest_available, all or custom) and what applies today. New assignments only.",
1804
+ "security": "bearer",
1805
+ "body": false,
1806
+ "bodyRequired": false,
1807
+ "pathParams": [],
1808
+ "queryParams": [],
1809
+ "headerParams": []
1810
+ },
1811
+ {
1812
+ "id": "set_network_default",
1813
+ "method": "PUT",
1814
+ "path": "/v1/network-default",
1815
+ "tag": "Network",
1816
+ "summary": "Set the org network default. Stored only; touches no SIM and writes nothing to OCS. Applies to new assignments.",
1817
+ "security": "bearer",
1818
+ "body": true,
1819
+ "bodyRequired": true,
1820
+ "pathParams": [],
1821
+ "queryParams": [],
1822
+ "headerParams": []
1823
+ },
1824
+ {
1825
+ "id": "plan_network_default",
1826
+ "method": "POST",
1827
+ "path": "/v1/network-default/plan",
1828
+ "tag": "Network",
1829
+ "summary": "Plan which networks a SIM gets in given countries: the cheapest available by default, unless the org or this call overrides it. Read only; falls back to all networks with an explicit warning when the tariff is missing.",
1830
+ "security": "bearer",
1831
+ "body": true,
1832
+ "bodyRequired": true,
1833
+ "pathParams": [],
1834
+ "queryParams": [],
1835
+ "headerParams": []
1836
+ },
1798
1837
  {
1799
1838
  "id": "carrier_webhook_config",
1800
1839
  "method": "GET",
@@ -2545,6 +2584,24 @@
2545
2584
  ],
2546
2585
  "headerParams": []
2547
2586
  },
2587
+ {
2588
+ "id": "rollback_storefront_order",
2589
+ "method": "DELETE",
2590
+ "path": "/api/orders/{orderId}",
2591
+ "tag": "Storefront",
2592
+ "summary": "Cancel one storefront order and release its eSIM (CAR-264 rollback)",
2593
+ "security": "storefront",
2594
+ "body": false,
2595
+ "bodyRequired": false,
2596
+ "pathParams": [
2597
+ {
2598
+ "name": "orderId",
2599
+ "required": true
2600
+ }
2601
+ ],
2602
+ "queryParams": [],
2603
+ "headerParams": []
2604
+ },
2548
2605
  {
2549
2606
  "id": "get_hosted_storefront",
2550
2607
  "method": "GET",
@@ -2,4 +2,4 @@
2
2
  *
3
3
  * Generated by sdks/generate.py. Do not edit by hand.
4
4
  */
5
- export type OperationId = "list_reseller_accounts" | "get_reseller_info" | "esim_status_per_account" | "list_sponsors" | "list_steering_lists" | "get_subscriber" | "list_subscribers" | "create_subscriber" | "get_sim_provider_status" | "change_sim_status" | "get_subscriber_location" | "hlr_get_bitrate" | "hlr_set_bitrate" | "list_subscriber_packages" | "assign_package" | "clean_all_packages" | "list_package_templates" | "create_package_template" | "list_location_zones" | "create_location_zone" | "list_detailed_location_zones" | "list_destination_prefixes" | "subscriber_usage" | "subscriber_network_events" | "subscriber_active_period" | "get_tariff" | "list_network_profiles" | "modify_subscriber_balance" | "modify_subscriber_status" | "modify_subscriber_contact_info" | "set_subscriber_traffic_restrictions" | "modify_subscriber_steering_list" | "move_subscriber_range_to_account" | "assign_recurring_package" | "modify_package_limits" | "modify_package_expiry" | "modify_package_status" | "stop_resume_recurring_package" | "modify_account_balance" | "delete_subscriber_package" | "modify_template_core" | "modify_template_recurring" | "modify_template_throttling" | "send_sms" | "fleet_health" | "churn_risk" | "audit_network_coverage" | "diagnose_subscriber" | "detect_usage_anomalies" | "optimize_package" | "marketing_intelligence" | "high_cost_subscribers" | "high_cost_subscribers_method_guard" | "detect_country_entry" | "list_intelligence_schedules" | "create_intelligence_schedule" | "delete_intelligence_schedule" | "run_intelligence_schedule" | "get_intelligence_schedule_report" | "get_intelligence_share" | "operator_billing_connect_begin" | "operator_billing_connect_oauth_begin" | "operator_billing_connect_oauth_complete" | "operator_billing_connect_status" | "operator_billing_connect_dashboard_link" | "operator_billing_list_payouts" | "operator_billing_create_manual_payout" | "operator_billing_get_payout_schedule" | "operator_billing_update_payout_schedule" | "operator_billing_list_fees" | "operator_billing_list_refunds" | "operator_billing_create_refund" | "operator_billing_list_disputes" | "operator_billing_submit_dispute_evidence" | "operator_billing_list_fraud_reviews" | "operator_billing_approve_fraud_review" | "operator_billing_decline_fraud_review" | "operator_billing_list_value_lists" | "operator_billing_add_value_list_item" | "operator_identity_status" | "operator_identity_create_session" | "operator_identity_update_session" | "operator_list_promotions" | "operator_create_promotion" | "signup_start" | "signup_verify" | "create_api_key" | "get_onboarding_state" | "onboarding_save_org" | "onboarding_connect_ocs_token" | "onboarding_start_managed_account" | "onboarding_save_plan" | "onboarding_skip_plan" | "onboarding_test_esim" | "onboarding_complete" | "operator_billing_stripe_webhook" | "receive_bridge4ip_webhook" | "affect_subscriber_phone_number" | "modify_subscriber_mobile_plan" | "modify_subscriber_voip_plan" | "push_steering_to_subscriber" | "modify_subscriber_package_active_period" | "get_subscriber_location_by_cell_id" | "reset_subscriber_gz_counter" | "list_destination_lists" | "list_subscriber_voip_tariff" | "list_voip_tariff_rule" | "change_network_profile_of_location_zone" | "carrier_webhook_config" | "ai_chat" | "ai_insights" | "ai_quota" | "list_invoice_periods" | "get_billing_config" | "update_billing_config" | "stripe_connect_begin" | "stripe_connect_status" | "list_invoices" | "create_invoice" | "get_invoice" | "update_invoice" | "void_invoice" | "get_invoice_document" | "list_connectivity_plans" | "list_connectivity_products" | "create_connectivity_product" | "get_connectivity_product" | "list_connectivity_intents" | "create_connectivity_intent" | "get_connectivity_intent" | "confirm_connectivity_intent" | "create_connectivity_webhook_endpoint" | "list_connectivity_webhook_endpoints" | "delete_connectivity_webhook_endpoint" | "list_connectivity_events" | "get_connectivity_event" | "create_connectivity_usage_record" | "list_connectivity_usage_records" | "retry_connectivity_event" | "issue_esim_from_inventory" | "rollback_esim_issuance" | "subscriber_country_history" | "get_subscriber_notes" | "add_subscriber_note" | "put_subscriber_notes" | "observe_connectivity_event" | "ingest_connectivity_usage" | "ingest_cdr_events" | "aggregate_cdr" | "list_storefront_templates" | "list_storefront_buyer_orders" | "get_storefront_order" | "get_hosted_storefront" | "list_storefronts" | "create_storefront" | "get_storefront" | "update_storefront" | "upsert_storefront_plan" | "health_check";
5
+ export type OperationId = "list_reseller_accounts" | "get_reseller_info" | "esim_status_per_account" | "list_sponsors" | "list_steering_lists" | "get_subscriber" | "list_subscribers" | "create_subscriber" | "get_sim_provider_status" | "change_sim_status" | "get_subscriber_location" | "hlr_get_bitrate" | "hlr_set_bitrate" | "list_subscriber_packages" | "assign_package" | "clean_all_packages" | "list_package_templates" | "create_package_template" | "list_location_zones" | "create_location_zone" | "list_detailed_location_zones" | "list_destination_prefixes" | "subscriber_usage" | "subscriber_network_events" | "subscriber_active_period" | "get_tariff" | "list_network_profiles" | "modify_subscriber_balance" | "modify_subscriber_status" | "modify_subscriber_contact_info" | "set_subscriber_traffic_restrictions" | "modify_subscriber_steering_list" | "move_subscriber_range_to_account" | "assign_recurring_package" | "modify_package_limits" | "modify_package_expiry" | "modify_package_status" | "stop_resume_recurring_package" | "modify_account_balance" | "delete_subscriber_package" | "modify_template_core" | "modify_template_recurring" | "modify_template_throttling" | "send_sms" | "fleet_health" | "churn_risk" | "audit_network_coverage" | "diagnose_subscriber" | "detect_usage_anomalies" | "optimize_package" | "marketing_intelligence" | "high_cost_subscribers" | "high_cost_subscribers_method_guard" | "detect_country_entry" | "list_intelligence_schedules" | "create_intelligence_schedule" | "delete_intelligence_schedule" | "run_intelligence_schedule" | "get_intelligence_schedule_report" | "get_intelligence_share" | "operator_billing_connect_begin" | "operator_billing_connect_oauth_begin" | "operator_billing_connect_oauth_complete" | "operator_billing_connect_status" | "operator_billing_connect_dashboard_link" | "operator_billing_list_payouts" | "operator_billing_create_manual_payout" | "operator_billing_get_payout_schedule" | "operator_billing_update_payout_schedule" | "operator_billing_list_fees" | "operator_billing_list_refunds" | "operator_billing_create_refund" | "operator_billing_list_disputes" | "operator_billing_submit_dispute_evidence" | "operator_billing_list_fraud_reviews" | "operator_billing_approve_fraud_review" | "operator_billing_decline_fraud_review" | "operator_billing_list_value_lists" | "operator_billing_add_value_list_item" | "operator_identity_status" | "operator_identity_create_session" | "operator_identity_update_session" | "operator_list_promotions" | "operator_create_promotion" | "signup_start" | "signup_verify" | "create_api_key" | "get_onboarding_state" | "onboarding_save_org" | "onboarding_connect_ocs_token" | "onboarding_start_managed_account" | "onboarding_save_plan" | "onboarding_skip_plan" | "onboarding_test_esim" | "onboarding_complete" | "operator_billing_stripe_webhook" | "receive_bridge4ip_webhook" | "affect_subscriber_phone_number" | "modify_subscriber_mobile_plan" | "modify_subscriber_voip_plan" | "push_steering_to_subscriber" | "modify_subscriber_package_active_period" | "get_subscriber_location_by_cell_id" | "reset_subscriber_gz_counter" | "list_destination_lists" | "list_subscriber_voip_tariff" | "list_voip_tariff_rule" | "change_network_profile_of_location_zone" | "get_network_default" | "set_network_default" | "plan_network_default" | "carrier_webhook_config" | "ai_chat" | "ai_insights" | "ai_quota" | "list_invoice_periods" | "get_billing_config" | "update_billing_config" | "stripe_connect_begin" | "stripe_connect_status" | "list_invoices" | "create_invoice" | "get_invoice" | "update_invoice" | "void_invoice" | "get_invoice_document" | "list_connectivity_plans" | "list_connectivity_products" | "create_connectivity_product" | "get_connectivity_product" | "list_connectivity_intents" | "create_connectivity_intent" | "get_connectivity_intent" | "confirm_connectivity_intent" | "create_connectivity_webhook_endpoint" | "list_connectivity_webhook_endpoints" | "delete_connectivity_webhook_endpoint" | "list_connectivity_events" | "get_connectivity_event" | "create_connectivity_usage_record" | "list_connectivity_usage_records" | "retry_connectivity_event" | "issue_esim_from_inventory" | "rollback_esim_issuance" | "subscriber_country_history" | "get_subscriber_notes" | "add_subscriber_note" | "put_subscriber_notes" | "observe_connectivity_event" | "ingest_connectivity_usage" | "ingest_cdr_events" | "aggregate_cdr" | "list_storefront_templates" | "list_storefront_buyer_orders" | "get_storefront_order" | "rollback_storefront_order" | "get_hosted_storefront" | "list_storefronts" | "create_storefront" | "get_storefront" | "update_storefront" | "upsert_storefront_plan" | "health_check";
@@ -9,7 +9,21 @@ export type LabelResult = {
9
9
  ok: false;
10
10
  message: string;
11
11
  };
12
- export declare function parseDataGb(raw: string): LabelResult;
12
+ /**
13
+ * `unlimited` is always explicit, never inferred later from a bare 0.
14
+ * A caller reading only `value` and forgetting to check `unlimited` gets a
15
+ * finite 0, which every downstream consumer treats as "no data" and rejects
16
+ * or hides, not as "unlimited" — the failure mode is loud, not silent.
17
+ */
18
+ export type DataGbResult = {
19
+ ok: true;
20
+ value: number;
21
+ unlimited: boolean;
22
+ } | {
23
+ ok: false;
24
+ message: string;
25
+ };
26
+ export declare function parseDataGb(raw: string): DataGbResult;
13
27
  export declare function parseValidityDays(raw: string): LabelResult;
14
28
  /** Stripe minor units. Yen is already the minor unit, so 1000 JPY stays 1000. */
15
29
  export declare function majorToCents(input: string, currency?: string): {
@@ -21,8 +21,11 @@ NAME_TO_CODE.set("uk", "GB");
21
21
  const CODE_ALIASES = { UK: "GB" };
22
22
  export function parseDataGb(raw) {
23
23
  if (raw.trim().toLowerCase() === "unlimited")
24
- return { ok: true, value: 0 };
25
- return parseAmount(raw, /gigabytes?|gbs?|gb/gi, "Enter data like 1, 1 GB, or Unlimited.", 10_000, false);
24
+ return { ok: true, value: 0, unlimited: true };
25
+ const parsed = parseAmount(raw, /gigabytes?|gbs?|gb/gi, "Enter data like 1, 1 GB, or Unlimited.", 10_000, false);
26
+ if (!parsed.ok)
27
+ return parsed;
28
+ return { ok: true, value: parsed.value, unlimited: false };
26
29
  }
27
30
  export function parseValidityDays(raw) {
28
31
  return parseAmount(raw, /days?/gi, "Enter validity like 7 or 7 days.", 3650, true);
@@ -23,6 +23,8 @@ export interface StorefrontPlanInput {
23
23
  currency?: string;
24
24
  templateId?: number;
25
25
  dataGb?: number;
26
+ /** The only way a plan becomes unlimited. A 0 or missing dataGb without this stays finite. */
27
+ unlimited?: boolean;
26
28
  validityDays?: number;
27
29
  regions?: string[];
28
30
  description?: string;
@@ -40,6 +42,7 @@ export interface StorefrontPlanBody {
40
42
  currency?: string;
41
43
  ocs_package_template_id?: number;
42
44
  data_gb?: number;
45
+ unlimited?: boolean;
43
46
  validity_days?: number;
44
47
  regions?: string[];
45
48
  description?: string;
@@ -36,6 +36,7 @@ export function completePlanInput(input, plans) {
36
36
  input.currency,
37
37
  input.templateId,
38
38
  input.dataGb,
39
+ input.unlimited,
39
40
  input.validityDays,
40
41
  input.regions,
41
42
  input.description,
@@ -82,6 +83,7 @@ export function storefrontPlanBody(input) {
82
83
  input.currency,
83
84
  input.templateId,
84
85
  input.dataGb,
86
+ input.unlimited,
85
87
  input.validityDays,
86
88
  input.regions,
87
89
  input.description,
@@ -92,6 +94,13 @@ export function storefrontPlanBody(input) {
92
94
  if (!input.slug || !input.name || input.priceCents === undefined || !input.currency || input.templateId === undefined) {
93
95
  return { error: "A plan needs a slug, name, price in minor units, currency, and OCS template id." };
94
96
  }
97
+ // A missing or zero dataGb never means unlimited on its own: that reading is
98
+ // exactly the bug a forgotten field falls into. `unlimited: true` is the
99
+ // only way in. A caller that means "unlimited" and sends 0 without the flag
100
+ // gets a loud rejection, not a silently unlimited plan.
101
+ if (input.dataGb !== undefined && input.dataGb <= 0 && input.unlimited !== true) {
102
+ return { error: "data_gb of 0 is refused. Send unlimited: true to sell an unlimited plan." };
103
+ }
95
104
  const body = {
96
105
  slug: input.slug,
97
106
  name: input.name,
@@ -101,6 +110,8 @@ export function storefrontPlanBody(input) {
101
110
  };
102
111
  if (input.dataGb !== undefined)
103
112
  body.data_gb = input.dataGb;
113
+ if (input.unlimited !== undefined)
114
+ body.unlimited = input.unlimited;
104
115
  if (input.validityDays !== undefined)
105
116
  body.validity_days = input.validityDays;
106
117
  if (input.regions !== undefined)
package/dist/types.d.ts CHANGED
@@ -9,6 +9,8 @@ export interface ConnectivityPlan {
9
9
  object: "connectivity.plan";
10
10
  name: string;
11
11
  data_mb: number;
12
+ /** True only when the plan is explicitly unlimited. A 0 or missing data_mb never implies this. */
13
+ unlimited: boolean;
12
14
  validity_days: number;
13
15
  countries: string[];
14
16
  livemode: boolean;
@@ -78,6 +80,8 @@ export interface StorefrontPlanParams {
78
80
  product_id?: string;
79
81
  description?: string;
80
82
  data_gb?: number;
83
+ /** The only way to sell an unlimited plan. A 0 or missing data_gb without this is refused. */
84
+ unlimited?: boolean;
81
85
  validity_days?: number;
82
86
  regions?: string[];
83
87
  active?: boolean;
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Published version. Keep this equal to package.json. */
2
- export declare const SDK_VERSION = "0.2.2";
3
- export declare const USER_AGENT = "@carrierllc/sdk/0.2.2";
2
+ export declare const SDK_VERSION = "0.2.4";
3
+ export declare const USER_AGENT = "@carrierllc/sdk/0.2.4";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Published version. Keep this equal to package.json. */
2
- export const SDK_VERSION = "0.2.2";
2
+ export const SDK_VERSION = "0.2.4";
3
3
  export const USER_AGENT = `@carrierllc/sdk/${SDK_VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrierllc/sdk",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "TypeScript client for the Carrier API, MCP server, and CLI.",
5
5
  "license": "MIT",
6
6
  "type": "module",