@omni-commerce/sdk 0.28.0 → 0.29.1

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.d.cts CHANGED
@@ -2350,7 +2350,7 @@ interface paths {
2350
2350
  };
2351
2351
  /**
2352
2352
  * List Products
2353
- * @description List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
2353
+ * @description List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.
2354
2354
  *
2355
2355
  * ### Stock and variants
2356
2356
  *
@@ -20180,7 +20180,7 @@ interface operations {
20180
20180
  limit?: number;
20181
20181
  /** @description Zero-based pagination offset. Use `pagination.nextOffset` from the previous response to page forward. */
20182
20182
  offset?: number;
20183
- /** @description Set false for scans to skip status counts on every page. summary is omitted and pagination.total is null. */
20183
+ /** @description Set true to include status counts. By default summary is omitted and pagination.total is null. */
20184
20184
  includeSummary?: boolean;
20185
20185
  };
20186
20186
  header?: never;
@@ -20189,7 +20189,7 @@ interface operations {
20189
20189
  };
20190
20190
  requestBody?: never;
20191
20191
  responses: {
20192
- /** @description Orders page returned. summary is omitted and pagination.total is null when includeSummary=false. */
20192
+ /** @description Orders page returned. summary is omitted and pagination.total is null unless includeSummary=true. */
20193
20193
  200: {
20194
20194
  headers: {
20195
20195
  [name: string]: unknown;
@@ -20248,7 +20248,7 @@ interface operations {
20248
20248
  pagination?: {
20249
20249
  offset?: number;
20250
20250
  limit?: number;
20251
- /** @description Orders matching the filters, ignoring offset/limit. Null when includeSummary=false. */
20251
+ /** @description Orders matching the filters, ignoring offset/limit. Null unless includeSummary=true. */
20252
20252
  total?: number | null;
20253
20253
  hasMore?: boolean;
20254
20254
  nextOffset?: number | null;
@@ -22194,9 +22194,7 @@ interface operations {
22194
22194
  | "country_desc"
22195
22195
  | "published_desc"
22196
22196
  | "published_asc";
22197
- /** @description Result limit per page. Values above the cap are clamped silently; the applied value is returned in `pagination.limit`. Defaults to 20. */
22198
- limit?: number;
22199
- /** @description Zero-based pagination offset. Use `pagination.nextOffset` from the previous response to page forward. Defaults to 0. */
22197
+ /** @description Zero-based offset for the first 1000 rows. Pages always contain 20 rows; `limit` is rejected. Follow `pagination.nextCursor` beyond the cap (created_desc or updated_desc without q). Other sorts and searches stop at the cap; narrow the filters instead. Do not send with cursor. */
22200
22198
  offset?: number;
22201
22199
  /** @description Exact marketplace account/store IDs, comma-separated. Combine with marketplace, or use storeKeys for exact platform/country/store identity. */
22202
22200
  store?: string;
@@ -22218,9 +22216,9 @@ interface operations {
22218
22216
  publishedTo?: string;
22219
22217
  /** @description IANA time zone for date-only publication bounds. */
22220
22218
  publishedTimeZone?: string;
22221
- /** @description Opaque nextCursor from the previous page with identical organization and filters. Supported for created_desc and updated_desc without search; other sorts use nextOffset. */
22219
+ /** @description Opaque nextCursor from the previous page with identical organization and filters. Supported by created_desc and updated_desc without q. Cursor paging avoids scanning prior pages. Do not send with offset. */
22222
22220
  cursor?: string;
22223
- /** @description Set false for scans to skip catalog summary classification on every page. summary is omitted and pagination.total is null; use products.count for a count-only request. */
22221
+ /** @description Set true to include catalog counts (summary and pagination.total). Omitted by default so pages never wait on counts; products.count returns a count alone. */
22224
22222
  includeSummary?: boolean;
22225
22223
  /** @description Product row detail: summary keeps id, parentId, isVariant, name, sku, status, statusFacets, variantCount, price, priceMax, salePrice, currency, stockQuantity, marketplacePricing, marketplaces, createdAt, updatedAt, publishedAt; full preserves all listing fields. Summary omits images, locations, bundle components and duplicate evidence. Pagination and filters are identical. This is separate from includeSummary, which controls catalog counts. Use products.get for product content and variants. */
22226
22224
  detail?: "summary" | "full";
@@ -22231,7 +22229,7 @@ interface operations {
22231
22229
  };
22232
22230
  requestBody?: never;
22233
22231
  responses: {
22234
- /** @description Success. summary is omitted and pagination.total is null when includeSummary=false. */
22232
+ /** @description Success. summary and pagination.total are present only with includeSummary=true. */
22235
22233
  200: {
22236
22234
  headers: {
22237
22235
  [name: string]: unknown;
@@ -22391,22 +22389,21 @@ interface operations {
22391
22389
  /** @description True when statusCounts includes the computed views. */
22392
22390
  includesComputedCounts?: boolean;
22393
22391
  };
22394
- /** @description Echoes the offset/limit actually applied to the query (after clamping) plus discovery metadata for paging. */
22392
+ /** @description Page position and how to continue. Prefer nextCursor when present. */
22395
22393
  pagination?: {
22396
22394
  /** @description Offset that was applied to this page. */
22397
22395
  offset: number;
22398
- /** @description Limit that was applied to this page (after clamping to `maxLimit`). */
22399
- limit: number;
22400
- /** @description Total number of records matching the filters, ignoring offset/limit. Null when includeSummary=false. */
22396
+ /** @description Fixed number of rows per page. */
22397
+ pageSize: number;
22398
+ /** @description Largest accepted offset. */
22399
+ maxOffset: number;
22400
+ /** @description Records matching the filters, ignoring paging. Null unless includeSummary=true. */
22401
22401
  total: number | null;
22402
22402
  hasMore: boolean;
22403
- nextCursor?: string | null;
22404
- /** @description Null when `hasMore` is false. */
22403
+ /** @description Continue with cursor=nextCursor. Present for created_desc and updated_desc without q. */
22404
+ nextCursor: string | null;
22405
+ /** @description Null when hasMore is false, when the request used a cursor, or past maxOffset. */
22405
22406
  nextOffset: number | null;
22406
- /** @description Server-side maximum for the `limit` query parameter. */
22407
- maxLimit: number;
22408
- /** @description Default `limit` applied when none is provided. */
22409
- defaultLimit: number;
22410
22407
  };
22411
22408
  };
22412
22409
  };
@@ -36249,7 +36246,7 @@ declare class ProductsClient {
36249
36246
  /**
36250
36247
  * List Products
36251
36248
  *
36252
- * List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
36249
+ * List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.
36253
36250
 
36254
36251
  ### Stock and variants
36255
36252
 
@@ -36257,7 +36254,7 @@ declare class ProductsClient {
36257
36254
 
36258
36255
  ### Duplicate discovery and merge
36259
36256
 
36260
- Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root ro
36257
+ Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer prod
36261
36258
  *
36262
36259
  * `GET /api/v1/products`
36263
36260
  */
@@ -37510,7 +37507,7 @@ declare function constructEvent(payload: string | Uint8Array, headers: WebhookHe
37510
37507
  toleranceInSeconds?: number;
37511
37508
  }): Promise<ConstructedWebhookEvent>;
37512
37509
 
37513
- declare const SDK_VERSION = "0.28.0";
37510
+ declare const SDK_VERSION = "0.29.1";
37514
37511
 
37515
37512
  type ProductCreatedWebhookEvent = components["schemas"]["ProductCreatedWebhookEvent"];
37516
37513
  type ProductUpdatedWebhookEvent = components["schemas"]["ProductUpdatedWebhookEvent"];
package/dist/index.d.ts CHANGED
@@ -2350,7 +2350,7 @@ interface paths {
2350
2350
  };
2351
2351
  /**
2352
2352
  * List Products
2353
- * @description List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
2353
+ * @description List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.
2354
2354
  *
2355
2355
  * ### Stock and variants
2356
2356
  *
@@ -20180,7 +20180,7 @@ interface operations {
20180
20180
  limit?: number;
20181
20181
  /** @description Zero-based pagination offset. Use `pagination.nextOffset` from the previous response to page forward. */
20182
20182
  offset?: number;
20183
- /** @description Set false for scans to skip status counts on every page. summary is omitted and pagination.total is null. */
20183
+ /** @description Set true to include status counts. By default summary is omitted and pagination.total is null. */
20184
20184
  includeSummary?: boolean;
20185
20185
  };
20186
20186
  header?: never;
@@ -20189,7 +20189,7 @@ interface operations {
20189
20189
  };
20190
20190
  requestBody?: never;
20191
20191
  responses: {
20192
- /** @description Orders page returned. summary is omitted and pagination.total is null when includeSummary=false. */
20192
+ /** @description Orders page returned. summary is omitted and pagination.total is null unless includeSummary=true. */
20193
20193
  200: {
20194
20194
  headers: {
20195
20195
  [name: string]: unknown;
@@ -20248,7 +20248,7 @@ interface operations {
20248
20248
  pagination?: {
20249
20249
  offset?: number;
20250
20250
  limit?: number;
20251
- /** @description Orders matching the filters, ignoring offset/limit. Null when includeSummary=false. */
20251
+ /** @description Orders matching the filters, ignoring offset/limit. Null unless includeSummary=true. */
20252
20252
  total?: number | null;
20253
20253
  hasMore?: boolean;
20254
20254
  nextOffset?: number | null;
@@ -22194,9 +22194,7 @@ interface operations {
22194
22194
  | "country_desc"
22195
22195
  | "published_desc"
22196
22196
  | "published_asc";
22197
- /** @description Result limit per page. Values above the cap are clamped silently; the applied value is returned in `pagination.limit`. Defaults to 20. */
22198
- limit?: number;
22199
- /** @description Zero-based pagination offset. Use `pagination.nextOffset` from the previous response to page forward. Defaults to 0. */
22197
+ /** @description Zero-based offset for the first 1000 rows. Pages always contain 20 rows; `limit` is rejected. Follow `pagination.nextCursor` beyond the cap (created_desc or updated_desc without q). Other sorts and searches stop at the cap; narrow the filters instead. Do not send with cursor. */
22200
22198
  offset?: number;
22201
22199
  /** @description Exact marketplace account/store IDs, comma-separated. Combine with marketplace, or use storeKeys for exact platform/country/store identity. */
22202
22200
  store?: string;
@@ -22218,9 +22216,9 @@ interface operations {
22218
22216
  publishedTo?: string;
22219
22217
  /** @description IANA time zone for date-only publication bounds. */
22220
22218
  publishedTimeZone?: string;
22221
- /** @description Opaque nextCursor from the previous page with identical organization and filters. Supported for created_desc and updated_desc without search; other sorts use nextOffset. */
22219
+ /** @description Opaque nextCursor from the previous page with identical organization and filters. Supported by created_desc and updated_desc without q. Cursor paging avoids scanning prior pages. Do not send with offset. */
22222
22220
  cursor?: string;
22223
- /** @description Set false for scans to skip catalog summary classification on every page. summary is omitted and pagination.total is null; use products.count for a count-only request. */
22221
+ /** @description Set true to include catalog counts (summary and pagination.total). Omitted by default so pages never wait on counts; products.count returns a count alone. */
22224
22222
  includeSummary?: boolean;
22225
22223
  /** @description Product row detail: summary keeps id, parentId, isVariant, name, sku, status, statusFacets, variantCount, price, priceMax, salePrice, currency, stockQuantity, marketplacePricing, marketplaces, createdAt, updatedAt, publishedAt; full preserves all listing fields. Summary omits images, locations, bundle components and duplicate evidence. Pagination and filters are identical. This is separate from includeSummary, which controls catalog counts. Use products.get for product content and variants. */
22226
22224
  detail?: "summary" | "full";
@@ -22231,7 +22229,7 @@ interface operations {
22231
22229
  };
22232
22230
  requestBody?: never;
22233
22231
  responses: {
22234
- /** @description Success. summary is omitted and pagination.total is null when includeSummary=false. */
22232
+ /** @description Success. summary and pagination.total are present only with includeSummary=true. */
22235
22233
  200: {
22236
22234
  headers: {
22237
22235
  [name: string]: unknown;
@@ -22391,22 +22389,21 @@ interface operations {
22391
22389
  /** @description True when statusCounts includes the computed views. */
22392
22390
  includesComputedCounts?: boolean;
22393
22391
  };
22394
- /** @description Echoes the offset/limit actually applied to the query (after clamping) plus discovery metadata for paging. */
22392
+ /** @description Page position and how to continue. Prefer nextCursor when present. */
22395
22393
  pagination?: {
22396
22394
  /** @description Offset that was applied to this page. */
22397
22395
  offset: number;
22398
- /** @description Limit that was applied to this page (after clamping to `maxLimit`). */
22399
- limit: number;
22400
- /** @description Total number of records matching the filters, ignoring offset/limit. Null when includeSummary=false. */
22396
+ /** @description Fixed number of rows per page. */
22397
+ pageSize: number;
22398
+ /** @description Largest accepted offset. */
22399
+ maxOffset: number;
22400
+ /** @description Records matching the filters, ignoring paging. Null unless includeSummary=true. */
22401
22401
  total: number | null;
22402
22402
  hasMore: boolean;
22403
- nextCursor?: string | null;
22404
- /** @description Null when `hasMore` is false. */
22403
+ /** @description Continue with cursor=nextCursor. Present for created_desc and updated_desc without q. */
22404
+ nextCursor: string | null;
22405
+ /** @description Null when hasMore is false, when the request used a cursor, or past maxOffset. */
22405
22406
  nextOffset: number | null;
22406
- /** @description Server-side maximum for the `limit` query parameter. */
22407
- maxLimit: number;
22408
- /** @description Default `limit` applied when none is provided. */
22409
- defaultLimit: number;
22410
22407
  };
22411
22408
  };
22412
22409
  };
@@ -36249,7 +36246,7 @@ declare class ProductsClient {
36249
36246
  /**
36250
36247
  * List Products
36251
36248
  *
36252
- * List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
36249
+ * List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.
36253
36250
 
36254
36251
  ### Stock and variants
36255
36252
 
@@ -36257,7 +36254,7 @@ declare class ProductsClient {
36257
36254
 
36258
36255
  ### Duplicate discovery and merge
36259
36256
 
36260
- Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root ro
36257
+ Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer prod
36261
36258
  *
36262
36259
  * `GET /api/v1/products`
36263
36260
  */
@@ -37510,7 +37507,7 @@ declare function constructEvent(payload: string | Uint8Array, headers: WebhookHe
37510
37507
  toleranceInSeconds?: number;
37511
37508
  }): Promise<ConstructedWebhookEvent>;
37512
37509
 
37513
- declare const SDK_VERSION = "0.28.0";
37510
+ declare const SDK_VERSION = "0.29.1";
37514
37511
 
37515
37512
  type ProductCreatedWebhookEvent = components["schemas"]["ProductCreatedWebhookEvent"];
37516
37513
  type ProductUpdatedWebhookEvent = components["schemas"]["ProductUpdatedWebhookEvent"];
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ function normalizeClientOptions(options = {}) {
33
33
  }
34
34
 
35
35
  // src/version.ts
36
- var SDK_VERSION = "0.28.0";
36
+ var SDK_VERSION = "0.29.1";
37
37
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
38
38
 
39
39
  // src/environments.ts
@@ -463,7 +463,7 @@ function encodePathParam(name, value) {
463
463
  var ProductScanError = class extends Error {
464
464
  constructor(partial, cause) {
465
465
  super(
466
- "Product scan failed. Resume from partial.next after saving partial.items."
466
+ partial.next ? "Product scan failed. Resume from partial.next after saving partial.items." : "Product scan failed. See the cause and the pages saved in partial.items."
467
467
  );
468
468
  __publicField(this, "partial", partial);
469
469
  __publicField(this, "cause", cause);
@@ -476,13 +476,14 @@ async function scanProducts(list, request, options = {}) {
476
476
  throw new RangeError("maxPages must be an integer between 1 and 100.");
477
477
  if ("queryParams" in requestOptions)
478
478
  throw new TypeError("Pass scan filters in the request, not queryParams.");
479
- let next = { limit: 50, offset: 0, ...request };
479
+ let next = { ...request };
480
480
  const items = [];
481
481
  let pagesRead = 0;
482
+ let complete = false;
482
483
  const progress = () => ({
483
484
  pagesRead,
484
485
  itemsRead: items.length,
485
- complete: next === null,
486
+ complete,
486
487
  next: next ? { ...next } : null
487
488
  });
488
489
  try {
@@ -497,19 +498,29 @@ async function scanProducts(list, request, options = {}) {
497
498
  if (!Array.isArray(page.items) || typeof pagination?.hasMore !== "boolean")
498
499
  throw new Error("Invalid product page response.");
499
500
  if (pagination.hasMore) {
500
- if (!page.items.length || !Number.isInteger(pagination.nextOffset) || pagination.nextOffset <= (current.offset ?? 0) || pagination.nextCursor != null && (typeof pagination.nextCursor !== "string" || !pagination.nextCursor || pagination.nextCursor === current.cursor))
501
+ if (!page.items.length)
501
502
  throw new Error("Product pagination did not advance.");
502
- const continuation = {
503
- ...current,
504
- offset: pagination.nextOffset
505
- };
506
- if (pagination.nextCursor) continuation.cursor = pagination.nextCursor;
507
- else delete continuation.cursor;
508
- next = continuation;
503
+ const scope = { ...current };
504
+ delete scope.cursor;
505
+ delete scope.offset;
506
+ if (typeof pagination.nextCursor === "string" && pagination.nextCursor) {
507
+ if (pagination.nextCursor === current.cursor)
508
+ throw new Error("Product pagination did not advance.");
509
+ next = { ...scope, cursor: pagination.nextCursor };
510
+ } else if (Number.isInteger(pagination.nextOffset)) {
511
+ if (pagination.nextOffset <= (current.offset ?? 0))
512
+ throw new Error("Product pagination did not advance.");
513
+ next = { ...scope, offset: pagination.nextOffset };
514
+ } else next = null;
509
515
  } else next = null;
516
+ complete = !pagination.hasMore;
510
517
  items.push(...page.items);
511
518
  pagesRead++;
512
519
  await onProgress?.(progress(), [...page.items]);
520
+ if (!next && !complete)
521
+ throw new Error(
522
+ "Product pagination reached maxOffset. Scan with sortBy created_desc or updated_desc and no q to use a cursor, or narrow the filters."
523
+ );
513
524
  }
514
525
  return { ...progress(), items };
515
526
  } catch (cause) {
@@ -3402,7 +3413,7 @@ var ProductsClient = class {
3402
3413
  /**
3403
3414
  * List Products
3404
3415
  *
3405
- * List products for the authenticated organization with optional filters and pagination. Authenticate with an API key or OAuth bearer token. The organization is taken from that credential; do not send `organizationId`.
3416
+ * List products for the authenticated organization with optional filters and pagination. Requires `catalog:read`. The organization comes from the API key or OAuth bearer token.
3406
3417
 
3407
3418
  ### Stock and variants
3408
3419
 
@@ -3410,7 +3421,7 @@ var ProductsClient = class {
3410
3421
 
3411
3422
  ### Duplicate discovery and merge
3412
3423
 
3413
- Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root ro
3424
+ Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer prod
3414
3425
  *
3415
3426
  * `GET /api/v1/products`
3416
3427
  */
@@ -3424,7 +3435,6 @@ var ProductsClient = class {
3424
3435
  minPrice,
3425
3436
  maxPrice,
3426
3437
  sortBy,
3427
- limit,
3428
3438
  offset,
3429
3439
  store,
3430
3440
  storeKeys,
@@ -3454,7 +3464,6 @@ var ProductsClient = class {
3454
3464
  minPrice,
3455
3465
  maxPrice,
3456
3466
  sortBy,
3457
- limit,
3458
3467
  offset,
3459
3468
  store,
3460
3469
  storeKeys,