@agenzo/merchant-cli 0.8.16 → 0.8.17

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/dist/index.js CHANGED
@@ -2162,63 +2162,72 @@ var unifiedOrdersListSchema = {
2162
2162
  cli: CLI_NAME,
2163
2163
  noun: ORDERS_NOUN,
2164
2164
  verb: "list",
2165
- description: 'List orders across ALL providers (ride + hotel) in one call. Use this for generic "my orders" / "order history" requests. Prefer ride-elife/hotel-redaug list-orders when the user names a specific business.',
2165
+ description: "List orders across ALL providers (ride + hotel + flight) with common filters and offset/cursor pagination. Use domain-specific list-orders only for provider-specific fields.",
2166
2166
  flags: {
2167
- "order-type": { type: "string", required: false, description: "Filter by provider: ride | hotel" },
2167
+ "order-type": { type: "string", required: false, description: "Legacy single order type: ride | hotel | flight" },
2168
+ "order-types": { type: "string", required: false, description: "Comma-separated order types: ride,hotel,flight" },
2168
2169
  member: MEMBER_FLAG_SCHEMA,
2169
- status: { type: "string", required: false, description: "Filter by NORMALIZED status (NOT the domain-specific status): PENDING | CONFIRMED | COMPLETED | CANCELLED | FAILED" },
2170
- page: { type: "int", required: false, default: 1, description: "Page number", constraints: ">= 1" },
2171
- "page-size": { type: "int", required: false, default: 20, description: "Items per page", constraints: ">= 1" }
2170
+ status: { type: "string", required: false, description: "Legacy single normalized status: PENDING | CONFIRMED | COMPLETED | CANCELLED | FAILED" },
2171
+ statuses: { type: "string", required: false, description: "Comma-separated normalized statuses" },
2172
+ "created-from": { type: "string", required: false, description: "ISO 8601 created-at lower bound (inclusive)" },
2173
+ "created-to": { type: "string", required: false, description: "ISO 8601 created-at upper bound (exclusive)" },
2174
+ cursor: { type: "string", required: false, description: "Opaque cursor returned by the previous page" },
2175
+ page: { type: "int", required: false, default: 1, description: "Legacy 1-based page number", constraints: ">= 1" },
2176
+ "page-size": { type: "int", required: false, default: 20, description: "Items per page", constraints: "1-100" }
2172
2177
  },
2173
2178
  response: {
2174
2179
  orders: {
2175
2180
  type: "array",
2176
- description: "Slim cross-provider order-index items. For business-specific fields (vehicle_class, hotel_name, etc.), call `orders get --order-id <id>` or the domain-specific `get`.",
2181
+ description: "Slim cross-provider index items. Call `orders get` for business-specific detail.",
2177
2182
  items: {
2178
- order_id: { type: "string", description: "Order id (rio_... for ride, hho_... for hotel). Pass to `orders get`." },
2179
- member_id: { type: "string|null", description: "End-user this order is attributed to; null when unattributed" },
2180
- order_type: { type: "string", description: "'ride' or 'hotel'" },
2181
- status: { type: "string", description: "Normalized status: PENDING | CONFIRMED | COMPLETED | CANCELLED | FAILED" },
2182
- amount: { type: "float|null", description: "Order amount in DECIMAL currency units (NOT cents)" },
2183
+ order_id: { type: "string", description: "Order id (rio_..., hho_..., or ffo_...). Pass to `orders get`." },
2184
+ member_id: { type: "string|null", description: "Attributed end-user id; null when unattributed" },
2185
+ order_type: { type: "string", description: "ride | hotel | flight" },
2186
+ status: { type: "string", description: "Original provider-domain status for display" },
2187
+ unified_status: { type: "string", description: "PENDING | CONFIRMED | COMPLETED | CANCELLED | FAILED" },
2188
+ amount: { type: "float|null", description: "Order amount in decimal currency units" },
2183
2189
  currency: { type: "string|null", description: "ISO 4217 currency code" },
2184
2190
  created_at: { type: "string|null", description: "ISO 8601 datetime" },
2185
2191
  updated_at: { type: "string|null", description: "ISO 8601 datetime" }
2186
2192
  }
2187
2193
  },
2188
2194
  total: { type: "int", description: "Total matching orders across all providers" },
2189
- page: { type: "int", description: "Current page" },
2190
- page_size: { type: "int", description: "Items per page" }
2195
+ page: { type: "int", description: "Legacy current page" },
2196
+ page_size: { type: "int", description: "Items per page" },
2197
+ next_cursor: { type: "string|null", description: "Opaque cursor for the next page; null at the end" },
2198
+ has_more: { type: "bool", description: "Whether another page is available" },
2199
+ applied_filters: { type: "object", description: "Normalized filters applied by the platform" }
2191
2200
  },
2192
2201
  example: {
2193
- command: "agenzo-merchant-cli orders list --page 1 --page-size 10",
2194
- output_summary: "Returns a paginated, cross-provider list of orders (both ride and hotel). If the user then asks about one order, use its order_id with `orders get`."
2202
+ command: "agenzo-merchant-cli orders list --order-types flight,hotel --created-from 2026-07-01T00:00:00Z --page-size 20",
2203
+ output_summary: "Returns ride, hotel, and flight orders with stable pagination metadata."
2195
2204
  },
2196
2205
  error_recovery: {
2197
- INVALID_REQUEST: "The --status value is not one of PENDING/CONFIRMED/COMPLETED/CANCELLED/FAILED. Fix and retry.",
2206
+ INVALID_REQUEST: "Fix invalid type/status/date/cursor filters and retry.",
2198
2207
  INTERNAL_ERROR: "Transient backend error. Retry once after a short delay.",
2199
- PARAM_INVALID: "Ensure --page / --page-size are positive integers, then retry."
2208
+ PARAM_INVALID: "Fix conflicting or invalid CLI options, then retry."
2200
2209
  }
2201
2210
  };
2202
2211
  var unifiedOrdersGetSchema = {
2203
2212
  cli: CLI_NAME,
2204
2213
  noun: ORDERS_NOUN,
2205
2214
  verb: "get",
2206
- description: "Get a single order detail by id, regardless of which provider (ride/hotel) it belongs to. The platform resolves order_id -> provider internally and returns that provider's own detail shape.",
2215
+ description: "Get a ride, hotel, or flight order detail by id. The platform resolves order_id to the owning domain and returns that domain detail shape.",
2207
2216
  flags: {
2208
- "order-id": { type: "string", required: true, description: "Order id from `orders list` (rio_... for ride, hho_... for hotel)" }
2217
+ "order-id": { type: "string", required: true, description: "Order id from `orders list` (rio_..., hho_..., or ffo_...)" }
2209
2218
  },
2210
2219
  response: {
2211
2220
  "(varies by order_type)": {
2212
2221
  type: "object",
2213
- description: "The response shape is delegated to the owning provider and therefore varies: a ride order returns the same shape as `ride-elife get`; a hotel order returns the same shape as `hotel-redaug get`. Treat the result as an opaque object and surface whatever fields it contains \u2014 do NOT assume a fixed schema."
2222
+ description: "Delegated ride, hotel, or flight detail. Treat the result as an opaque domain object and surface the returned fields."
2214
2223
  }
2215
2224
  },
2216
2225
  example: {
2217
- command: "agenzo-merchant-cli orders get --order-id hho_01K...",
2218
- output_summary: "Returns the order's detail, delegated to its owning provider (ride or hotel)."
2226
+ command: "agenzo-merchant-cli orders get --order-id ffo_01K...",
2227
+ output_summary: "Returns the order's provider-domain detail."
2219
2228
  },
2220
2229
  error_recovery: {
2221
- ORDER_NOT_FOUND: "The order_id does not exist or does not belong to this developer/org. Verify the id from `orders list`. Do NOT retry blindly.",
2230
+ ORDER_NOT_FOUND: "The order_id does not exist or does not belong to this developer/org. Verify the id from `orders list`.",
2222
2231
  INTERNAL_ERROR: "The order's provider detail lookup is temporarily unavailable. Retry once after a short delay."
2223
2232
  }
2224
2233
  };
@@ -3883,6 +3892,17 @@ function positiveInt2(value, flag) {
3883
3892
  }
3884
3893
  return String(n);
3885
3894
  }
3895
+ function assertCompatibleOptions(opts) {
3896
+ if (opts.orderType !== void 0 && opts.orderTypes !== void 0) {
3897
+ throw new CliError("PARAM_INVALID", "--order-type and --order-types cannot be used together.");
3898
+ }
3899
+ if (opts.status !== void 0 && opts.statuses !== void 0) {
3900
+ throw new CliError("PARAM_INVALID", "--status and --statuses cannot be used together.");
3901
+ }
3902
+ if (opts.cursor !== void 0 && Number(opts.page ?? DEFAULT_PAGE2) !== 1) {
3903
+ throw new CliError("PARAM_INVALID", "--cursor cannot be combined with --page greater than 1.");
3904
+ }
3905
+ }
3886
3906
  function formatOrders2(data) {
3887
3907
  const orders = data.orders ?? [];
3888
3908
  if (orders.length === 0) {
@@ -3901,14 +3921,17 @@ function formatOrders2(data) {
3901
3921
  ["Page", String(data.page ?? "-")],
3902
3922
  ["Page size", String(data.page_size ?? "-")]
3903
3923
  ];
3924
+ if (data.has_more !== void 0) summary.push(["Has more", String(data.has_more)]);
3925
+ if (data.next_cursor) summary.push(["Next cursor", data.next_cursor]);
3904
3926
  return `${Formatter.table(headers, rows)}
3905
3927
  ${Formatter.keyValue(summary)}`;
3906
3928
  }
3907
3929
  function registerOrdersListCommand(parent, deps) {
3908
- const cmd = parent.command("list").description("List orders across ALL providers (ride + hotel), with optional type/status filters").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-type <type>", "Filter by order type: ride | hotel").option("--status <status>", "Filter by normalized status: PENDING | CONFIRMED | COMPLETED | CANCELLED | FAILED").option("--page <page>", "Page number", DEFAULT_PAGE2).option("--page-size <size>", "Page size", DEFAULT_PAGE_SIZE2).option("--member <id>", MEMBER_OPTION_DESCRIPTION);
3930
+ const cmd = parent.command("list").description("List orders across ALL providers (ride + hotel + flight), with filters and pagination").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-type <type>", "Legacy single order type filter: ride | hotel | flight").option("--order-types <types>", "Comma-separated order types: ride,hotel,flight").option("--status <status>", "Legacy single normalized status filter").option("--statuses <statuses>", "Comma-separated statuses: PENDING,CONFIRMED,COMPLETED,CANCELLED,FAILED").option("--created-from <datetime>", "Created at or after this ISO 8601 datetime (inclusive)").option("--created-to <datetime>", "Created before this ISO 8601 datetime (exclusive)").option("--cursor <cursor>", "Opaque cursor returned by the previous page").option("--page <page>", "Legacy 1-based page number", DEFAULT_PAGE2).option("--page-size <size>", "Page size", DEFAULT_PAGE_SIZE2).option("--member <id>", MEMBER_OPTION_DESCRIPTION);
3909
3931
  attachSchemaHelp(cmd, unifiedOrdersListSchema);
3910
3932
  cmd.action(async () => {
3911
3933
  const opts = cmd.optsWithGlobals();
3934
+ assertCompatibleOptions(opts);
3912
3935
  const format = resolveFormat(opts.format);
3913
3936
  const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
3914
3937
  message: "API Key:",
@@ -3919,7 +3942,12 @@ function registerOrdersListCommand(parent, deps) {
3919
3942
  page_size: positiveInt2(opts.pageSize ?? DEFAULT_PAGE_SIZE2, "page-size")
3920
3943
  };
3921
3944
  if (opts.orderType !== void 0) params.order_type = opts.orderType;
3945
+ if (opts.orderTypes !== void 0) params.order_types = opts.orderTypes;
3922
3946
  if (opts.status !== void 0) params.status = opts.status;
3947
+ if (opts.statuses !== void 0) params.statuses = opts.statuses;
3948
+ if (opts.createdFrom !== void 0) params.created_from = opts.createdFrom;
3949
+ if (opts.createdTo !== void 0) params.created_to = opts.createdTo;
3950
+ if (opts.cursor !== void 0) params.cursor = opts.cursor;
3923
3951
  const member = memberIdOf(opts);
3924
3952
  if (member !== void 0) params.member_id = member;
3925
3953
  const spinner = format === "json" ? null : createSpinner("Fetching orders...");
@@ -3944,7 +3972,7 @@ function registerOrdersListCommand(parent, deps) {
3944
3972
 
3945
3973
  // src/orders/get.ts
3946
3974
  function registerOrdersGetCommand(parent, deps) {
3947
- const cmd = parent.command("get").description("Get a single order detail by id, regardless of provider (ride/hotel)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").requiredOption("--order-id <id>", "Order id (e.g. rio_... or hho_...)");
3975
+ const cmd = parent.command("get").description("Get a single order detail by id, regardless of provider (ride/hotel/flight)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").requiredOption("--order-id <id>", "Order id (e.g. rio_..., hho_..., or ffo_...)");
3948
3976
  attachSchemaHelp(cmd, unifiedOrdersGetSchema);
3949
3977
  cmd.action(async () => {
3950
3978
  const opts = cmd.optsWithGlobals();
@@ -6639,7 +6667,7 @@ Key notes:
6639
6667
  registerServicesListCommand(servicesCmd, { discoveryClient, program });
6640
6668
  registerServiceGetCommand(servicesCmd, { discoveryClient, program });
6641
6669
  const ordersCmd = program.command("orders").description(
6642
- 'Unified cross-provider order index (spans ride + hotel). Use for generic "my orders" requests; use ride-elife/hotel-redaug commands once the business is known.'
6670
+ "Unified cross-provider order index (ride + hotel + flight). Use for order history, common filters, and stable pagination."
6643
6671
  );
6644
6672
  registerOrdersListCommand(ordersCmd, deps);
6645
6673
  registerOrdersGetCommand(ordersCmd, deps);