@omni-commerce/sdk 0.12.0 → 0.17.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 +108 -12
- package/dist/embed.cjs +7 -1
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.d.cts +5 -0
- package/dist/embed.d.ts +5 -0
- package/dist/embed.global.js +4 -4
- package/dist/embed.global.js.map +1 -1
- package/dist/embed.js +7 -1
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +513 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5299 -2615
- package/dist/index.d.ts +5299 -2615
- package/dist/index.js +513 -27
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +34 -6
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +34 -6
- package/dist/react.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.17.0";
|
|
37
37
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
38
38
|
|
|
39
39
|
// src/environments.ts
|
|
@@ -69,9 +69,9 @@ function defaultErrorMessage(statusCode, body) {
|
|
|
69
69
|
function extractErrorMessage(body) {
|
|
70
70
|
if (typeof body === "string" && body.trim()) return body;
|
|
71
71
|
if (!body || typeof body !== "object") return void 0;
|
|
72
|
-
const
|
|
72
|
+
const record2 = body;
|
|
73
73
|
for (const key of ["error", "message", "detail"]) {
|
|
74
|
-
const value =
|
|
74
|
+
const value = record2[key];
|
|
75
75
|
if (typeof value === "string" && value.trim()) return value;
|
|
76
76
|
}
|
|
77
77
|
return void 0;
|
|
@@ -459,6 +459,177 @@ function encodePathParam(name, value) {
|
|
|
459
459
|
return encodeURIComponent(value);
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
// src/products.ts
|
|
463
|
+
var ProductScanError = class extends Error {
|
|
464
|
+
constructor(partial, cause) {
|
|
465
|
+
super(
|
|
466
|
+
"Product scan failed. Resume from partial.next after saving partial.items."
|
|
467
|
+
);
|
|
468
|
+
__publicField(this, "partial", partial);
|
|
469
|
+
__publicField(this, "cause", cause);
|
|
470
|
+
this.name = "ProductScanError";
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
async function scanProducts(list, request, options = {}) {
|
|
474
|
+
const { maxPages = 1, onProgress, ...requestOptions } = options;
|
|
475
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 100)
|
|
476
|
+
throw new RangeError("maxPages must be an integer between 1 and 100.");
|
|
477
|
+
if ("queryParams" in requestOptions)
|
|
478
|
+
throw new TypeError("Pass scan filters in the request, not queryParams.");
|
|
479
|
+
let next = { limit: 50, offset: 0, ...request };
|
|
480
|
+
const items = [];
|
|
481
|
+
let pagesRead = 0;
|
|
482
|
+
const progress = () => ({
|
|
483
|
+
pagesRead,
|
|
484
|
+
itemsRead: items.length,
|
|
485
|
+
complete: next === null,
|
|
486
|
+
next: next ? { ...next } : null
|
|
487
|
+
});
|
|
488
|
+
try {
|
|
489
|
+
while (next && pagesRead < maxPages) {
|
|
490
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
491
|
+
const current = next;
|
|
492
|
+
const page = await list(
|
|
493
|
+
{ ...current, includeSummary: false },
|
|
494
|
+
requestOptions
|
|
495
|
+
);
|
|
496
|
+
const pagination = page.pagination;
|
|
497
|
+
if (!Array.isArray(page.items) || typeof pagination?.hasMore !== "boolean")
|
|
498
|
+
throw new Error("Invalid product page response.");
|
|
499
|
+
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
|
+
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;
|
|
509
|
+
} else next = null;
|
|
510
|
+
items.push(...page.items);
|
|
511
|
+
pagesRead++;
|
|
512
|
+
await onProgress?.(progress(), [...page.items]);
|
|
513
|
+
}
|
|
514
|
+
return { ...progress(), items };
|
|
515
|
+
} catch (cause) {
|
|
516
|
+
throw new ProductScanError({ ...progress(), items }, cause);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/product-batches.ts
|
|
521
|
+
function validateItems(items) {
|
|
522
|
+
if (!Array.isArray(items) || items.length < 1 || items.length > 100)
|
|
523
|
+
throw new RangeError("Provide between 1 and 100 products per batch.");
|
|
524
|
+
}
|
|
525
|
+
function normalizeProductId(value) {
|
|
526
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 160)
|
|
527
|
+
throw new TypeError(
|
|
528
|
+
"Each product ID must be a nonempty string of at most 160 characters."
|
|
529
|
+
);
|
|
530
|
+
return value.trim();
|
|
531
|
+
}
|
|
532
|
+
function requestsForIds(request) {
|
|
533
|
+
if ("productId" in request)
|
|
534
|
+
throw new TypeError("Use productIds, not productId, for a batch.");
|
|
535
|
+
const { productIds, ...shared } = request;
|
|
536
|
+
validateItems(productIds);
|
|
537
|
+
return [...new Set(Array.from(productIds, normalizeProductId))].map(
|
|
538
|
+
(productId) => ({
|
|
539
|
+
...shared,
|
|
540
|
+
productId
|
|
541
|
+
})
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
var record = (value) => value !== null && typeof value === "object" ? value : {};
|
|
545
|
+
function jobIdsFrom(value) {
|
|
546
|
+
const response = record(value);
|
|
547
|
+
const data = record(response.data);
|
|
548
|
+
const targets = Array.isArray(data.results) ? data.results.map(record) : [];
|
|
549
|
+
return [
|
|
550
|
+
...new Set(
|
|
551
|
+
[
|
|
552
|
+
response.jobId,
|
|
553
|
+
data.jobBatchId,
|
|
554
|
+
...targets.flatMap((target) => [
|
|
555
|
+
target.jobId,
|
|
556
|
+
...Array.isArray(target.correlations) ? target.correlations.map((correlation) => record(correlation).id) : []
|
|
557
|
+
])
|
|
558
|
+
].filter((id) => typeof id === "string" && id.length > 0)
|
|
559
|
+
)
|
|
560
|
+
];
|
|
561
|
+
}
|
|
562
|
+
async function runProductBatch(operation, requests, successKey, options = {}) {
|
|
563
|
+
const { concurrency = 3, ...requestOptions } = options;
|
|
564
|
+
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 10)
|
|
565
|
+
throw new RangeError("concurrency must be an integer between 1 and 10.");
|
|
566
|
+
const results = new Array(requests.length);
|
|
567
|
+
let next = 0;
|
|
568
|
+
const worker = async () => {
|
|
569
|
+
while (next < requests.length) {
|
|
570
|
+
const index = next++;
|
|
571
|
+
const request = requests[index];
|
|
572
|
+
let attempted = false;
|
|
573
|
+
try {
|
|
574
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
575
|
+
attempted = true;
|
|
576
|
+
const data = await operation(request, requestOptions);
|
|
577
|
+
const success = record(data)[successKey] === true;
|
|
578
|
+
results[index] = {
|
|
579
|
+
productId: request.productId,
|
|
580
|
+
success,
|
|
581
|
+
attempted,
|
|
582
|
+
data,
|
|
583
|
+
jobIds: jobIdsFrom(data),
|
|
584
|
+
...success ? {} : { error: new OmniError({ body: data }) }
|
|
585
|
+
};
|
|
586
|
+
} catch (error) {
|
|
587
|
+
results[index] = {
|
|
588
|
+
productId: request.productId,
|
|
589
|
+
success: false,
|
|
590
|
+
attempted,
|
|
591
|
+
error,
|
|
592
|
+
jobIds: jobIdsFrom(
|
|
593
|
+
error instanceof OmniError ? error.body : void 0
|
|
594
|
+
)
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
await Promise.all(
|
|
600
|
+
Array.from({ length: Math.min(concurrency, requests.length) }, worker)
|
|
601
|
+
);
|
|
602
|
+
const succeededCount = results.filter((result) => result.success).length;
|
|
603
|
+
return {
|
|
604
|
+
success: succeededCount === requests.length,
|
|
605
|
+
productIds: requests.map((request) => request.productId),
|
|
606
|
+
succeededCount,
|
|
607
|
+
failedCount: requests.length - succeededCount,
|
|
608
|
+
results,
|
|
609
|
+
jobIds: [...new Set(results.flatMap((result) => result.jobIds))]
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function batchPublishProducts(publish, request, options) {
|
|
613
|
+
return runProductBatch(publish, requestsForIds(request), "ok", options);
|
|
614
|
+
}
|
|
615
|
+
function batchDelistProducts(delist, request, options) {
|
|
616
|
+
return runProductBatch(delist, requestsForIds(request), "ok", options);
|
|
617
|
+
}
|
|
618
|
+
function batchUpdateProducts(update, request, options) {
|
|
619
|
+
if ("productId" in request || "productIds" in request)
|
|
620
|
+
throw new TypeError("Use updates for a batch of catalog edits.");
|
|
621
|
+
validateItems(request.updates);
|
|
622
|
+
const seen = /* @__PURE__ */ new Set();
|
|
623
|
+
const updates = Array.from(request.updates, (update2) => {
|
|
624
|
+
const productId = normalizeProductId(update2?.productId);
|
|
625
|
+
if (seen.has(productId))
|
|
626
|
+
throw new TypeError("Provide only one update per product ID.");
|
|
627
|
+
seen.add(productId);
|
|
628
|
+
return { ...update2, productId };
|
|
629
|
+
});
|
|
630
|
+
return runProductBatch(update, updates, "success", options);
|
|
631
|
+
}
|
|
632
|
+
|
|
462
633
|
// src/jobs.ts
|
|
463
634
|
var SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
464
635
|
"completed",
|
|
@@ -486,16 +657,16 @@ var JobFailedError = class extends OmniError {
|
|
|
486
657
|
};
|
|
487
658
|
function readJobStatus(payload) {
|
|
488
659
|
if (!payload || typeof payload !== "object") return void 0;
|
|
489
|
-
const
|
|
490
|
-
const nested =
|
|
660
|
+
const record2 = payload;
|
|
661
|
+
const nested = record2.data;
|
|
491
662
|
if (nested && typeof nested === "object") {
|
|
492
663
|
const nestedStatus = nested.status;
|
|
493
664
|
if (typeof nestedStatus === "string" && nestedStatus.trim()) {
|
|
494
665
|
return nestedStatus;
|
|
495
666
|
}
|
|
496
667
|
}
|
|
497
|
-
if (typeof
|
|
498
|
-
return
|
|
668
|
+
if (typeof record2.status === "string" && record2.status.trim()) {
|
|
669
|
+
return record2.status;
|
|
499
670
|
}
|
|
500
671
|
return void 0;
|
|
501
672
|
}
|
|
@@ -1105,6 +1276,100 @@ var AopClient = class {
|
|
|
1105
1276
|
});
|
|
1106
1277
|
}
|
|
1107
1278
|
};
|
|
1279
|
+
var BrandKitsClient = class {
|
|
1280
|
+
constructor(_http) {
|
|
1281
|
+
__publicField(this, "_http", _http);
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* List Brand Kits
|
|
1285
|
+
*
|
|
1286
|
+
* List full brand kits and canonical image-source websites. Requires branding:read. Supports q, limit (1–1000), and offset. Bearer credentials resolve the organization; sessions supply organizationId.
|
|
1287
|
+
*
|
|
1288
|
+
* `GET /api/v1/brand-kits`
|
|
1289
|
+
*/
|
|
1290
|
+
list(request = {}, requestOptions) {
|
|
1291
|
+
const { organizationId, q, limit, offset } = request ?? {};
|
|
1292
|
+
return this._http.request({
|
|
1293
|
+
method: "GET",
|
|
1294
|
+
path: "/api/v1/brand-kits",
|
|
1295
|
+
query: { organizationId, q, limit, offset },
|
|
1296
|
+
body: void 0,
|
|
1297
|
+
...mergeRequestOptions(requestOptions)
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Create Brand Kit
|
|
1302
|
+
*
|
|
1303
|
+
* Create a full brand kit with optional imageSourceUrls. Requires branding:write. All brandKit fields are supported; omitted fields receive canonical defaults.
|
|
1304
|
+
|
|
1305
|
+
Source websites accept HTTP(S) URLs or domain/path scopes and return normalized host/path values. The kit and sources save atomically. Use public HTTP(S) URLs for logo/icons; embedded images are rejected.
|
|
1306
|
+
*
|
|
1307
|
+
* `POST /api/v1/brand-kits`
|
|
1308
|
+
*/
|
|
1309
|
+
create(request, requestOptions) {
|
|
1310
|
+
const { ...body } = request ?? {};
|
|
1311
|
+
return this._http.request({
|
|
1312
|
+
method: "POST",
|
|
1313
|
+
path: "/api/v1/brand-kits",
|
|
1314
|
+
query: void 0,
|
|
1315
|
+
body,
|
|
1316
|
+
...mergeRequestOptions(requestOptions)
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Delete Brand Kit
|
|
1321
|
+
*
|
|
1322
|
+
* Delete the organization-owned kit and its saved brand image-source websites. Requires branding:write. Historical job snapshots are preserved.
|
|
1323
|
+
*
|
|
1324
|
+
* `DELETE /api/v1/brand-kits/{brandKitId}`
|
|
1325
|
+
*/
|
|
1326
|
+
delete(request, requestOptions) {
|
|
1327
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1328
|
+
return this._http.request({
|
|
1329
|
+
method: "DELETE",
|
|
1330
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1331
|
+
query: { organizationId },
|
|
1332
|
+
body: void 0,
|
|
1333
|
+
...mergeRequestOptions(requestOptions)
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Get Brand Kit
|
|
1338
|
+
*
|
|
1339
|
+
* Read the complete kit and imageSourceUrls. Requires branding:read.
|
|
1340
|
+
*
|
|
1341
|
+
* `GET /api/v1/brand-kits/{brandKitId}`
|
|
1342
|
+
*/
|
|
1343
|
+
get(request, requestOptions) {
|
|
1344
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1345
|
+
return this._http.request({
|
|
1346
|
+
method: "GET",
|
|
1347
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1348
|
+
query: { organizationId },
|
|
1349
|
+
body: void 0,
|
|
1350
|
+
...mergeRequestOptions(requestOptions)
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Update Brand Kit
|
|
1355
|
+
*
|
|
1356
|
+
* Edit name, any nested brandKit fields, and imageSourceUrls. Requires branding:write. Nested objects merge and arrays replace; omitted fields are preserved.
|
|
1357
|
+
|
|
1358
|
+
imageSourceUrls: [] clears websites. Renaming keeps source websites attached. Parent kit IDs must belong to this organization. Existing running jobs keep their frozen source snapshot until explicitly retried with brandKitIds.
|
|
1359
|
+
*
|
|
1360
|
+
* `PATCH /api/v1/brand-kits/{brandKitId}`
|
|
1361
|
+
*/
|
|
1362
|
+
update(request, requestOptions) {
|
|
1363
|
+
const { brandKitId, ...body } = request ?? {};
|
|
1364
|
+
return this._http.request({
|
|
1365
|
+
method: "PATCH",
|
|
1366
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1367
|
+
query: void 0,
|
|
1368
|
+
body,
|
|
1369
|
+
...mergeRequestOptions(requestOptions)
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1108
1373
|
var BrandsgatewayClient = class {
|
|
1109
1374
|
constructor(_http) {
|
|
1110
1375
|
__publicField(this, "_http", _http);
|
|
@@ -1555,6 +1820,56 @@ var ImagesClient = class {
|
|
|
1555
1820
|
});
|
|
1556
1821
|
}
|
|
1557
1822
|
};
|
|
1823
|
+
var InventoryClient = class {
|
|
1824
|
+
constructor(_http) {
|
|
1825
|
+
__publicField(this, "_http", _http);
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* List Inventory Groups
|
|
1829
|
+
*
|
|
1830
|
+
* Read active inventory using the same canonical quantities, filters and grouping as the inventory assistant. Requires catalog:read and inventory.read permission. Organization scope comes only from the credential.
|
|
1831
|
+
|
|
1832
|
+
### Stock and listing absence
|
|
1833
|
+
|
|
1834
|
+
status=in_stock means positive available stock (on hand minus locked), with variants rolled up for product groups. unlistedMarketplaces checks every organization store and the entire saved catalog, including product/variant identities, exact catalog SKUs, and historical listings. Source marketplace/country/storeIds filters do not restrict absence evidence. All supported marketplaces are accepted.
|
|
1835
|
+
|
|
1836
|
+
listingPresence reports saved-catalog evidence and unknown missing-SKU families. It does not establish fresh live marketplace absence. Stock quantities fro
|
|
1837
|
+
*
|
|
1838
|
+
* `GET /api/v1/inventory`
|
|
1839
|
+
*/
|
|
1840
|
+
list(request = {}, requestOptions) {
|
|
1841
|
+
const {
|
|
1842
|
+
productIds,
|
|
1843
|
+
query,
|
|
1844
|
+
marketplace,
|
|
1845
|
+
country,
|
|
1846
|
+
storeIds,
|
|
1847
|
+
unlistedMarketplaces,
|
|
1848
|
+
groupBy,
|
|
1849
|
+
status,
|
|
1850
|
+
offset,
|
|
1851
|
+
limit
|
|
1852
|
+
} = request ?? {};
|
|
1853
|
+
return this._http.request({
|
|
1854
|
+
method: "GET",
|
|
1855
|
+
path: "/api/v1/inventory",
|
|
1856
|
+
query: {
|
|
1857
|
+
productIds,
|
|
1858
|
+
query,
|
|
1859
|
+
marketplace,
|
|
1860
|
+
country,
|
|
1861
|
+
storeIds,
|
|
1862
|
+
unlistedMarketplaces,
|
|
1863
|
+
groupBy,
|
|
1864
|
+
status,
|
|
1865
|
+
offset,
|
|
1866
|
+
limit
|
|
1867
|
+
},
|
|
1868
|
+
body: void 0,
|
|
1869
|
+
...mergeRequestOptions(requestOptions)
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
};
|
|
1558
1873
|
var JobsClient = class {
|
|
1559
1874
|
constructor(_http) {
|
|
1560
1875
|
__publicField(this, "_http", _http);
|
|
@@ -2239,7 +2554,19 @@ var ProductsClient = class {
|
|
|
2239
2554
|
maxPrice,
|
|
2240
2555
|
sortBy,
|
|
2241
2556
|
limit,
|
|
2242
|
-
offset
|
|
2557
|
+
offset,
|
|
2558
|
+
store,
|
|
2559
|
+
storeKeys,
|
|
2560
|
+
brands,
|
|
2561
|
+
bundleType,
|
|
2562
|
+
language,
|
|
2563
|
+
hasImage,
|
|
2564
|
+
stock,
|
|
2565
|
+
publishedFrom,
|
|
2566
|
+
publishedTo,
|
|
2567
|
+
publishedTimeZone,
|
|
2568
|
+
cursor,
|
|
2569
|
+
includeSummary
|
|
2243
2570
|
} = request ?? {};
|
|
2244
2571
|
return this._http.request({
|
|
2245
2572
|
method: "GET",
|
|
@@ -2254,7 +2581,19 @@ var ProductsClient = class {
|
|
|
2254
2581
|
maxPrice,
|
|
2255
2582
|
sortBy,
|
|
2256
2583
|
limit,
|
|
2257
|
-
offset
|
|
2584
|
+
offset,
|
|
2585
|
+
store,
|
|
2586
|
+
storeKeys,
|
|
2587
|
+
brands,
|
|
2588
|
+
bundleType,
|
|
2589
|
+
language,
|
|
2590
|
+
hasImage,
|
|
2591
|
+
stock,
|
|
2592
|
+
publishedFrom,
|
|
2593
|
+
publishedTo,
|
|
2594
|
+
publishedTimeZone,
|
|
2595
|
+
cursor,
|
|
2596
|
+
includeSummary
|
|
2258
2597
|
},
|
|
2259
2598
|
body: void 0,
|
|
2260
2599
|
...mergeRequestOptions(requestOptions)
|
|
@@ -2477,12 +2816,22 @@ var ProductsClient = class {
|
|
|
2477
2816
|
});
|
|
2478
2817
|
}
|
|
2479
2818
|
/**
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2819
|
+
* Publish Product
|
|
2820
|
+
*
|
|
2821
|
+
* ### Publishing
|
|
2822
|
+
|
|
2823
|
+
Queue durable marketplace publish/update jobs for a product. Omit marketplaces to use every enabled or already listed marketplace, or name the marketplaces to target. Omit updateFields for a full publish with live/draft visibility. Set updateFields to update only saved values for those fields on existing listings with assigned stores; other fields and listing visibility stay unchanged. No new listing is created by a selected-field update.
|
|
2824
|
+
|
|
2825
|
+
### Marketplace capabilities
|
|
2826
|
+
|
|
2827
|
+
SEO is Shopify-only; highlights support Lazada, TikTok and Amazon; attributes exclude WhatsApp. Category-only updates require a full publish on TikTok and Amazon. Unsupported combinations and missing listings/stores return explicit per-marketplace failures while valid targets continue.
|
|
2828
|
+
|
|
2829
|
+
### Completion
|
|
2830
|
+
|
|
2831
|
+
Accept
|
|
2832
|
+
*
|
|
2833
|
+
* `POST /api/v1/products/{productId}/publish`
|
|
2834
|
+
*/
|
|
2486
2835
|
publish(request, requestOptions) {
|
|
2487
2836
|
const { productId, ...body } = request ?? {};
|
|
2488
2837
|
return this._http.request({
|
|
@@ -2498,18 +2847,14 @@ var ProductsClient = class {
|
|
|
2498
2847
|
*
|
|
2499
2848
|
* Queue a bulk product import for the authenticated organization.
|
|
2500
2849
|
|
|
2850
|
+
Supply explicit SKU options in each row's `variationAttributes` and native marketplace attributes in `marketplaceAttributes`. Enrichment never infers SKU options. At Zalora publish time, a missing required Size defaults to One Size only when valid for the selected category and supplied size system. Supplied sizes are preserved; missing or incompatible size systems and other required options block publishing. Each row remains a standalone product; no child variants are created for the default.
|
|
2851
|
+
|
|
2501
2852
|
### Input options
|
|
2502
2853
|
|
|
2503
2854
|
- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.
|
|
2504
2855
|
- Send JSON with a `products` array of 1–5,000 flat product objects (8 MiB request maximum).
|
|
2505
2856
|
- Send JSON with inline `csvText`.
|
|
2506
|
-
- Send
|
|
2507
|
-
|
|
2508
|
-
### Asynchronous result
|
|
2509
|
-
|
|
2510
|
-
The API creates import rows, then queues draft creation and AI Review through Inngest. Completed import jobs expose `reviewBatchIds`, `reviewUrls`, and `reviewWarnings`; generated changes require Review approval. Poll the returned `bulk_...` job with `GET /api/v1/jobs/{jobId}`.
|
|
2511
|
-
|
|
2512
|
-
Cancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.
|
|
2857
|
+
- Send
|
|
2513
2858
|
*
|
|
2514
2859
|
* `POST /api/v1/products/bulk-import`
|
|
2515
2860
|
*/
|
|
@@ -2523,6 +2868,54 @@ var ProductsClient = class {
|
|
|
2523
2868
|
...mergeRequestOptions(requestOptions)
|
|
2524
2869
|
});
|
|
2525
2870
|
}
|
|
2871
|
+
/**
|
|
2872
|
+
* Get Import Retry Progress
|
|
2873
|
+
*
|
|
2874
|
+
* Read actual row and review generation progress using an importretry_... handle. Requires catalog:read. success is null while running, true only for successful completion, and false for missing targets, dispatch failure, or stage failures.
|
|
2875
|
+
|
|
2876
|
+
Row IDs, review request IDs, errors, and per-stage counts remain available. The same handle works with GET /api/v1/jobs/{jobId} and SDK jobs.wait.
|
|
2877
|
+
*
|
|
2878
|
+
* `GET /api/v1/products/bulk-import/retries/{retryJobId}`
|
|
2879
|
+
*/
|
|
2880
|
+
getBulkImportRetry(request, requestOptions) {
|
|
2881
|
+
const { retryJobId, organizationId } = request ?? {};
|
|
2882
|
+
return this._http.request({
|
|
2883
|
+
method: "GET",
|
|
2884
|
+
path: `/api/v1/products/bulk-import/retries/${encodePathParam("retryJobId", retryJobId)}`,
|
|
2885
|
+
query: { organizationId },
|
|
2886
|
+
body: void 0,
|
|
2887
|
+
...mergeRequestOptions(requestOptions)
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* Retry Failed Import or Review Jobs
|
|
2892
|
+
*
|
|
2893
|
+
* Retry 1–20 jobs with durable background execution. Requires catalog:write.
|
|
2894
|
+
|
|
2895
|
+
### Targets
|
|
2896
|
+
|
|
2897
|
+
jobIds accepts import UUIDs, bulk_... developer job handles, or review_<batch UUID> for a Review job (including jobs created in the app). Inputs are trimmed, bounded, and deduplicated in first-requested order.
|
|
2898
|
+
|
|
2899
|
+
### Retry scope
|
|
2900
|
+
|
|
2901
|
+
stages=all retries failed source rows and linked review stages; stages=images retries failed review images only. Completed work, applied products, cancelled stages, and active work are preserved. Optional brandKitIds replaces image-source selection using the kits' current organization-owned websites. Omit it to keep frozen sources. To resume interrupted dispatch, pass an importretry_... handle without overrides; the saved target plan is reused.
|
|
2902
|
+
|
|
2903
|
+
### Results
|
|
2904
|
+
|
|
2905
|
+
Use the returned ord
|
|
2906
|
+
*
|
|
2907
|
+
* `POST /api/v1/products/bulk-import/retry`
|
|
2908
|
+
*/
|
|
2909
|
+
retryBulkImport(request, requestOptions) {
|
|
2910
|
+
const { ...body } = request ?? {};
|
|
2911
|
+
return this._http.request({
|
|
2912
|
+
method: "POST",
|
|
2913
|
+
path: "/api/v1/products/bulk-import/retry",
|
|
2914
|
+
query: void 0,
|
|
2915
|
+
body,
|
|
2916
|
+
...mergeRequestOptions(requestOptions)
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2526
2919
|
/**
|
|
2527
2920
|
* Compare Product Market Prices
|
|
2528
2921
|
*
|
|
@@ -2594,6 +2987,63 @@ var ProductsClient = class {
|
|
|
2594
2987
|
...mergeRequestOptions(requestOptions)
|
|
2595
2988
|
});
|
|
2596
2989
|
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Count Products
|
|
2992
|
+
*
|
|
2993
|
+
* Count matching catalog parent products using the Products page's canonical filters and authorization, without loading rows, pricing, or location data.
|
|
2994
|
+
|
|
2995
|
+
Products are counted once even when multiple listings match. This does not count variants or verify live marketplace status. status is the catalog lifecycle/derived view. All marketplaces are supported. Use storeKeys for exact marketplace/country/account identity.
|
|
2996
|
+
|
|
2997
|
+
Authenticate with a read-only catalog credential; organization comes only from that credential.
|
|
2998
|
+
*
|
|
2999
|
+
* `GET /api/v1/products/count`
|
|
3000
|
+
*/
|
|
3001
|
+
count(request = {}, requestOptions) {
|
|
3002
|
+
const {
|
|
3003
|
+
status,
|
|
3004
|
+
marketplace,
|
|
3005
|
+
country,
|
|
3006
|
+
q,
|
|
3007
|
+
sku,
|
|
3008
|
+
minPrice,
|
|
3009
|
+
maxPrice,
|
|
3010
|
+
store,
|
|
3011
|
+
storeKeys,
|
|
3012
|
+
brands,
|
|
3013
|
+
bundleType,
|
|
3014
|
+
language,
|
|
3015
|
+
hasImage,
|
|
3016
|
+
stock,
|
|
3017
|
+
publishedFrom,
|
|
3018
|
+
publishedTo,
|
|
3019
|
+
publishedTimeZone
|
|
3020
|
+
} = request ?? {};
|
|
3021
|
+
return this._http.request({
|
|
3022
|
+
method: "GET",
|
|
3023
|
+
path: "/api/v1/products/count",
|
|
3024
|
+
query: {
|
|
3025
|
+
status,
|
|
3026
|
+
marketplace,
|
|
3027
|
+
country,
|
|
3028
|
+
q,
|
|
3029
|
+
sku,
|
|
3030
|
+
minPrice,
|
|
3031
|
+
maxPrice,
|
|
3032
|
+
store,
|
|
3033
|
+
storeKeys,
|
|
3034
|
+
brands,
|
|
3035
|
+
bundleType,
|
|
3036
|
+
language,
|
|
3037
|
+
hasImage,
|
|
3038
|
+
stock,
|
|
3039
|
+
publishedFrom,
|
|
3040
|
+
publishedTo,
|
|
3041
|
+
publishedTimeZone
|
|
3042
|
+
},
|
|
3043
|
+
body: void 0,
|
|
3044
|
+
...mergeRequestOptions(requestOptions)
|
|
3045
|
+
});
|
|
3046
|
+
}
|
|
2597
3047
|
/**
|
|
2598
3048
|
* Queue Product Enrichment
|
|
2599
3049
|
*
|
|
@@ -2601,9 +3051,9 @@ var ProductsClient = class {
|
|
|
2601
3051
|
|
|
2602
3052
|
### Enrichment options
|
|
2603
3053
|
|
|
2604
|
-
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included;
|
|
3054
|
+
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included; images are not queued here. Optional marketplaceStoreSelections maps each marketplace to an array of connected store IDs. Multiple stores on one marketplace get independent category and attribute reviews in the same review group. Set includeListingCopy=false for taxonomy only. Store countries come from the authenticated organization connections.
|
|
2605
3055
|
|
|
2606
|
-
autoApplyHighConfidence defaults to false.
|
|
3056
|
+
autoApplyHighConfidence defaults to false.
|
|
2607
3057
|
*
|
|
2608
3058
|
* `POST /api/v1/products/enrich`
|
|
2609
3059
|
*/
|
|
@@ -2617,6 +3067,38 @@ var ProductsClient = class {
|
|
|
2617
3067
|
...mergeRequestOptions(requestOptions)
|
|
2618
3068
|
});
|
|
2619
3069
|
}
|
|
3070
|
+
/** Read a bounded chunk without summary classification; persist progress to resume. */
|
|
3071
|
+
scan(request = {}, options) {
|
|
3072
|
+
return scanProducts(
|
|
3073
|
+
(page, requestOptions) => this.list(page, requestOptions),
|
|
3074
|
+
request,
|
|
3075
|
+
options
|
|
3076
|
+
);
|
|
3077
|
+
}
|
|
3078
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3079
|
+
batchPublish(request, options) {
|
|
3080
|
+
return batchPublishProducts(
|
|
3081
|
+
(item, requestOptions) => this.publish(item, requestOptions),
|
|
3082
|
+
request,
|
|
3083
|
+
options
|
|
3084
|
+
);
|
|
3085
|
+
}
|
|
3086
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3087
|
+
batchDelist(request, options) {
|
|
3088
|
+
return batchDelistProducts(
|
|
3089
|
+
(item, requestOptions) => this.delist(item, requestOptions),
|
|
3090
|
+
request,
|
|
3091
|
+
options
|
|
3092
|
+
);
|
|
3093
|
+
}
|
|
3094
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3095
|
+
batchUpdate(request, options) {
|
|
3096
|
+
return batchUpdateProducts(
|
|
3097
|
+
(item, requestOptions) => this.update(item, requestOptions),
|
|
3098
|
+
request,
|
|
3099
|
+
options
|
|
3100
|
+
);
|
|
3101
|
+
}
|
|
2620
3102
|
};
|
|
2621
3103
|
var PromotionsClient = class {
|
|
2622
3104
|
constructor(_http) {
|
|
@@ -3446,6 +3928,7 @@ var OmniGeneratedClient = class {
|
|
|
3446
3928
|
__publicField(this, "agents");
|
|
3447
3929
|
__publicField(this, "analytics");
|
|
3448
3930
|
__publicField(this, "aop");
|
|
3931
|
+
__publicField(this, "brandKits");
|
|
3449
3932
|
__publicField(this, "brandsgateway");
|
|
3450
3933
|
__publicField(this, "campaigns");
|
|
3451
3934
|
__publicField(this, "catalog");
|
|
@@ -3456,6 +3939,7 @@ var OmniGeneratedClient = class {
|
|
|
3456
3939
|
__publicField(this, "evaluate");
|
|
3457
3940
|
__publicField(this, "feed");
|
|
3458
3941
|
__publicField(this, "images");
|
|
3942
|
+
__publicField(this, "inventory");
|
|
3459
3943
|
__publicField(this, "jobs");
|
|
3460
3944
|
__publicField(this, "looks");
|
|
3461
3945
|
__publicField(this, "marketplaces");
|
|
@@ -3481,6 +3965,7 @@ var OmniGeneratedClient = class {
|
|
|
3481
3965
|
this.agents = new AgentsClient(this._http);
|
|
3482
3966
|
this.analytics = new AnalyticsClient(this._http);
|
|
3483
3967
|
this.aop = new AopClient(this._http);
|
|
3968
|
+
this.brandKits = new BrandKitsClient(this._http);
|
|
3484
3969
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3485
3970
|
this.campaigns = new CampaignsClient(this._http);
|
|
3486
3971
|
this.catalog = new CatalogClient(this._http);
|
|
@@ -3491,6 +3976,7 @@ var OmniGeneratedClient = class {
|
|
|
3491
3976
|
this.evaluate = new EvaluateClient(this._http);
|
|
3492
3977
|
this.feed = new FeedClient(this._http);
|
|
3493
3978
|
this.images = new ImagesClient(this._http);
|
|
3979
|
+
this.inventory = new InventoryClient(this._http);
|
|
3494
3980
|
this.jobs = new JobsClient(this._http);
|
|
3495
3981
|
this.looks = new LooksClient(this._http);
|
|
3496
3982
|
this.marketplaces = new MarketplacesClient(this._http);
|
|
@@ -3536,8 +4022,8 @@ function headerValue(headers, name) {
|
|
|
3536
4022
|
if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
3537
4023
|
return headers.get(name) ?? headers.get(name.toLowerCase()) ?? void 0;
|
|
3538
4024
|
}
|
|
3539
|
-
const
|
|
3540
|
-
const direct =
|
|
4025
|
+
const record2 = headers;
|
|
4026
|
+
const direct = record2[name] ?? record2[name.toLowerCase()];
|
|
3541
4027
|
if (Array.isArray(direct)) return direct[0];
|
|
3542
4028
|
return direct ?? void 0;
|
|
3543
4029
|
}
|
|
@@ -3625,6 +4111,6 @@ __export(api_exports, {
|
|
|
3625
4111
|
OmniGeneratedClient: () => OmniGeneratedClient
|
|
3626
4112
|
});
|
|
3627
4113
|
|
|
3628
|
-
export { BadGatewayError, BadRequestError, ForbiddenError, HttpResponsePromise, InternalServerError, JobFailedError, NotFoundError, api_exports as Omni, OmniClient, OmniEnvironment, OmniError, OmniTimeoutError, SDK_VERSION, ServiceUnavailableError, TooManyRequestsError, UnauthorizedError, UnprocessableEntityError, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, constructEvent, signWebhookPayload, verifyWebhookSignature };
|
|
4114
|
+
export { BadGatewayError, BadRequestError, ForbiddenError, HttpResponsePromise, InternalServerError, JobFailedError, NotFoundError, api_exports as Omni, OmniClient, OmniEnvironment, OmniError, OmniTimeoutError, ProductScanError, SDK_VERSION, ServiceUnavailableError, TooManyRequestsError, UnauthorizedError, UnprocessableEntityError, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, constructEvent, signWebhookPayload, verifyWebhookSignature };
|
|
3629
4115
|
//# sourceMappingURL=index.js.map
|
|
3630
4116
|
//# sourceMappingURL=index.js.map
|