@omni-commerce/sdk 0.27.0 → 0.29.0
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 +2 -2
- package/dist/index.cjs +49 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -272
- package/dist/index.d.ts +73 -272
- package/dist/index.js +49 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
36
|
+
var SDK_VERSION = "0.29.0";
|
|
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 = {
|
|
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
|
|
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
|
|
501
|
+
if (!page.items.length)
|
|
501
502
|
throw new Error("Product pagination did not advance.");
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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) {
|
|
@@ -710,7 +721,13 @@ var AgentsGeneralClient = class {
|
|
|
710
721
|
*
|
|
711
722
|
* Run the general Omni agent and wait until it completes, pauses for approval, or fails. Requires `agents:invoke`.
|
|
712
723
|
|
|
713
|
-
|
|
724
|
+
### Waiting and approvals
|
|
725
|
+
|
|
726
|
+
A waiting call can take several minutes; raise the client timeout. Send `decisions` with the same `thread_id` to approve or reject a paused run.
|
|
727
|
+
|
|
728
|
+
### Messages and tools
|
|
729
|
+
|
|
730
|
+
Omit `config.enabled_tools` to use the organization's agent tools. Send only new messages on each turn; thread_id continues the conversation stored in Omni sessions and checkpoints. Omit thread_id for a new conversation. Optional message IDs use native LangGraph replacement semantics, not run idempotency. audience=customer restricts tools to public storefront access without establishing a verified customer identity. Attach images on the latest user message as `{ type: "image", url }`
|
|
714
731
|
*
|
|
715
732
|
* `POST /api/v1/agents/general/invoke`
|
|
716
733
|
*/
|
|
@@ -770,9 +787,13 @@ var AgentsClient = class {
|
|
|
770
787
|
*
|
|
771
788
|
* Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.
|
|
772
789
|
|
|
790
|
+
### Authorization
|
|
791
|
+
|
|
773
792
|
Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.
|
|
774
793
|
|
|
775
|
-
|
|
794
|
+
### Messages and conversation history
|
|
795
|
+
|
|
796
|
+
Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend history on subsequent turns. Optional
|
|
776
797
|
*
|
|
777
798
|
* `POST /api/v1/agents/{agentId}/invoke`
|
|
778
799
|
*/
|
|
@@ -786,29 +807,6 @@ var AgentsClient = class {
|
|
|
786
807
|
...mergeRequestOptions(requestOptions)
|
|
787
808
|
});
|
|
788
809
|
}
|
|
789
|
-
/**
|
|
790
|
-
* Invoke a saved agent (alias)
|
|
791
|
-
*
|
|
792
|
-
* Alias of /agents/{agentId}/invoke with the identical request and response. Prefer /invoke.
|
|
793
|
-
|
|
794
|
-
Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.
|
|
795
|
-
|
|
796
|
-
Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.
|
|
797
|
-
|
|
798
|
-
Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can import external history, including human replies. Do not resend hist
|
|
799
|
-
*
|
|
800
|
-
* `POST /api/v1/agents/{agentId}/messages`
|
|
801
|
-
*/
|
|
802
|
-
messages(request, requestOptions) {
|
|
803
|
-
const { agentId, ...body } = request ?? {};
|
|
804
|
-
return this._http.request({
|
|
805
|
-
method: "POST",
|
|
806
|
-
path: `/api/v1/agents/${encodePathParam("agentId", agentId)}/messages`,
|
|
807
|
-
query: void 0,
|
|
808
|
-
body,
|
|
809
|
-
...mergeRequestOptions(requestOptions)
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
810
|
/**
|
|
813
811
|
* Start a saved agent run
|
|
814
812
|
*
|
|
@@ -816,9 +814,13 @@ var AgentsClient = class {
|
|
|
816
814
|
|
|
817
815
|
Invoke the exact built-in or custom agent in the URL using its saved configuration and Programmatic starting mode. Uses the same invocation request and run response as the general agent and MCP.
|
|
818
816
|
|
|
817
|
+
### Authorization
|
|
818
|
+
|
|
819
819
|
Requires agents:invoke and current organization membership and agent access. Organization-owned keys use their recorded creator; no alternate organization member is substituted. Session requests include organizationId.
|
|
820
820
|
|
|
821
|
-
|
|
821
|
+
### Messages and conversation history
|
|
822
|
+
|
|
823
|
+
Send one or more new messages (at most 50 and 100000 text characters) ending with a user message. Omit thread_id to create a conversation, or reuse the returned thread_id to continue its stored history. An initial batch can
|
|
822
824
|
*
|
|
823
825
|
* `POST /api/v1/agents/{agentId}/runs`
|
|
824
826
|
*/
|
|
@@ -2957,7 +2959,8 @@ var OrdersClient = class {
|
|
|
2957
2959
|
dateFrom,
|
|
2958
2960
|
dateTo,
|
|
2959
2961
|
limit,
|
|
2960
|
-
offset
|
|
2962
|
+
offset,
|
|
2963
|
+
includeSummary
|
|
2961
2964
|
} = request ?? {};
|
|
2962
2965
|
return this._http.request({
|
|
2963
2966
|
method: "GET",
|
|
@@ -2974,7 +2977,8 @@ var OrdersClient = class {
|
|
|
2974
2977
|
dateFrom,
|
|
2975
2978
|
dateTo,
|
|
2976
2979
|
limit,
|
|
2977
|
-
offset
|
|
2980
|
+
offset,
|
|
2981
|
+
includeSummary
|
|
2978
2982
|
},
|
|
2979
2983
|
body: void 0,
|
|
2980
2984
|
...mergeRequestOptions(requestOptions)
|
|
@@ -2997,9 +3001,9 @@ var OrdersClient = class {
|
|
|
2997
3001
|
|
|
2998
3002
|
### Pricing and catalog defaults
|
|
2999
3003
|
|
|
3000
|
-
- Each line can provide `
|
|
3004
|
+
- Each line can provide `unitPrice`, `paidPrice`, and `costPrice`.
|
|
3001
3005
|
- When `productId` is provided, missing price or currency values may resolve from the product catalog.
|
|
3002
|
-
- An explicit `costPrice` updates `product_data.costPrice` and is
|
|
3006
|
+
- An explicit `costPrice` updates `product_data.costPrice` and is snapshotted on
|
|
3003
3007
|
*
|
|
3004
3008
|
* `POST /api/v1/orders`
|
|
3005
3009
|
*/
|
|
@@ -3409,7 +3413,7 @@ var ProductsClient = class {
|
|
|
3409
3413
|
/**
|
|
3410
3414
|
* List Products
|
|
3411
3415
|
*
|
|
3412
|
-
* List products for the authenticated organization with optional filters and pagination.
|
|
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.
|
|
3413
3417
|
|
|
3414
3418
|
### Stock and variants
|
|
3415
3419
|
|
|
@@ -3417,7 +3421,7 @@ var ProductsClient = class {
|
|
|
3417
3421
|
|
|
3418
3422
|
### Duplicate discovery and merge
|
|
3419
3423
|
|
|
3420
|
-
Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root
|
|
3424
|
+
Use status=duplicates, duplicateType=sku and detail=full for exact-SKU candidates. Each root row includes duplicateMatches with peer prod
|
|
3421
3425
|
*
|
|
3422
3426
|
* `GET /api/v1/products`
|
|
3423
3427
|
*/
|
|
@@ -3431,7 +3435,6 @@ var ProductsClient = class {
|
|
|
3431
3435
|
minPrice,
|
|
3432
3436
|
maxPrice,
|
|
3433
3437
|
sortBy,
|
|
3434
|
-
limit,
|
|
3435
3438
|
offset,
|
|
3436
3439
|
store,
|
|
3437
3440
|
storeKeys,
|
|
@@ -3461,7 +3464,6 @@ var ProductsClient = class {
|
|
|
3461
3464
|
minPrice,
|
|
3462
3465
|
maxPrice,
|
|
3463
3466
|
sortBy,
|
|
3464
|
-
limit,
|
|
3465
3467
|
offset,
|
|
3466
3468
|
store,
|
|
3467
3469
|
storeKeys,
|
|
@@ -3735,7 +3737,7 @@ var ProductsClient = class {
|
|
|
3735
3737
|
|
|
3736
3738
|
Supply targetMarketplaces and marketplaceStoreSelections to prepare for specific connected stores. Set deferStoreSelection=true to choose marketplaces only and assign stores later with POST /api/v1/products/marketplace-stores. Omit marketplaceStoreSelections and leave workflow.publish off when deferring. Automatic publishing requires catalog:sync in addition to catalog:write.
|
|
3737
3739
|
|
|
3738
|
-
Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`.
|
|
3740
|
+
Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Taxonomy enrichment can propose missing required sale attributes in its existing attribute request when supported by product evidence. Supplied values take precedence. At Zalora publish time, a missing required
|
|
3739
3741
|
*
|
|
3740
3742
|
* `POST /api/v1/products/bulk-import`
|
|
3741
3743
|
*/
|