@omni-commerce/sdk 0.13.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 +94 -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 +497 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2698 -378
- package/dist/index.d.ts +2698 -378
- package/dist/index.js +497 -21
- 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.cjs
CHANGED
|
@@ -35,7 +35,7 @@ function normalizeClientOptions(options = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var SDK_VERSION = "0.
|
|
38
|
+
var SDK_VERSION = "0.17.0";
|
|
39
39
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
40
40
|
|
|
41
41
|
// src/environments.ts
|
|
@@ -71,9 +71,9 @@ function defaultErrorMessage(statusCode, body) {
|
|
|
71
71
|
function extractErrorMessage(body) {
|
|
72
72
|
if (typeof body === "string" && body.trim()) return body;
|
|
73
73
|
if (!body || typeof body !== "object") return void 0;
|
|
74
|
-
const
|
|
74
|
+
const record2 = body;
|
|
75
75
|
for (const key of ["error", "message", "detail"]) {
|
|
76
|
-
const value =
|
|
76
|
+
const value = record2[key];
|
|
77
77
|
if (typeof value === "string" && value.trim()) return value;
|
|
78
78
|
}
|
|
79
79
|
return void 0;
|
|
@@ -461,6 +461,177 @@ function encodePathParam(name, value) {
|
|
|
461
461
|
return encodeURIComponent(value);
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
+
// src/products.ts
|
|
465
|
+
var ProductScanError = class extends Error {
|
|
466
|
+
constructor(partial, cause) {
|
|
467
|
+
super(
|
|
468
|
+
"Product scan failed. Resume from partial.next after saving partial.items."
|
|
469
|
+
);
|
|
470
|
+
__publicField(this, "partial", partial);
|
|
471
|
+
__publicField(this, "cause", cause);
|
|
472
|
+
this.name = "ProductScanError";
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
async function scanProducts(list, request, options = {}) {
|
|
476
|
+
const { maxPages = 1, onProgress, ...requestOptions } = options;
|
|
477
|
+
if (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 100)
|
|
478
|
+
throw new RangeError("maxPages must be an integer between 1 and 100.");
|
|
479
|
+
if ("queryParams" in requestOptions)
|
|
480
|
+
throw new TypeError("Pass scan filters in the request, not queryParams.");
|
|
481
|
+
let next = { limit: 50, offset: 0, ...request };
|
|
482
|
+
const items = [];
|
|
483
|
+
let pagesRead = 0;
|
|
484
|
+
const progress = () => ({
|
|
485
|
+
pagesRead,
|
|
486
|
+
itemsRead: items.length,
|
|
487
|
+
complete: next === null,
|
|
488
|
+
next: next ? { ...next } : null
|
|
489
|
+
});
|
|
490
|
+
try {
|
|
491
|
+
while (next && pagesRead < maxPages) {
|
|
492
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
493
|
+
const current = next;
|
|
494
|
+
const page = await list(
|
|
495
|
+
{ ...current, includeSummary: false },
|
|
496
|
+
requestOptions
|
|
497
|
+
);
|
|
498
|
+
const pagination = page.pagination;
|
|
499
|
+
if (!Array.isArray(page.items) || typeof pagination?.hasMore !== "boolean")
|
|
500
|
+
throw new Error("Invalid product page response.");
|
|
501
|
+
if (pagination.hasMore) {
|
|
502
|
+
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))
|
|
503
|
+
throw new Error("Product pagination did not advance.");
|
|
504
|
+
const continuation = {
|
|
505
|
+
...current,
|
|
506
|
+
offset: pagination.nextOffset
|
|
507
|
+
};
|
|
508
|
+
if (pagination.nextCursor) continuation.cursor = pagination.nextCursor;
|
|
509
|
+
else delete continuation.cursor;
|
|
510
|
+
next = continuation;
|
|
511
|
+
} else next = null;
|
|
512
|
+
items.push(...page.items);
|
|
513
|
+
pagesRead++;
|
|
514
|
+
await onProgress?.(progress(), [...page.items]);
|
|
515
|
+
}
|
|
516
|
+
return { ...progress(), items };
|
|
517
|
+
} catch (cause) {
|
|
518
|
+
throw new ProductScanError({ ...progress(), items }, cause);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/product-batches.ts
|
|
523
|
+
function validateItems(items) {
|
|
524
|
+
if (!Array.isArray(items) || items.length < 1 || items.length > 100)
|
|
525
|
+
throw new RangeError("Provide between 1 and 100 products per batch.");
|
|
526
|
+
}
|
|
527
|
+
function normalizeProductId(value) {
|
|
528
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 160)
|
|
529
|
+
throw new TypeError(
|
|
530
|
+
"Each product ID must be a nonempty string of at most 160 characters."
|
|
531
|
+
);
|
|
532
|
+
return value.trim();
|
|
533
|
+
}
|
|
534
|
+
function requestsForIds(request) {
|
|
535
|
+
if ("productId" in request)
|
|
536
|
+
throw new TypeError("Use productIds, not productId, for a batch.");
|
|
537
|
+
const { productIds, ...shared } = request;
|
|
538
|
+
validateItems(productIds);
|
|
539
|
+
return [...new Set(Array.from(productIds, normalizeProductId))].map(
|
|
540
|
+
(productId) => ({
|
|
541
|
+
...shared,
|
|
542
|
+
productId
|
|
543
|
+
})
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
var record = (value) => value !== null && typeof value === "object" ? value : {};
|
|
547
|
+
function jobIdsFrom(value) {
|
|
548
|
+
const response = record(value);
|
|
549
|
+
const data = record(response.data);
|
|
550
|
+
const targets = Array.isArray(data.results) ? data.results.map(record) : [];
|
|
551
|
+
return [
|
|
552
|
+
...new Set(
|
|
553
|
+
[
|
|
554
|
+
response.jobId,
|
|
555
|
+
data.jobBatchId,
|
|
556
|
+
...targets.flatMap((target) => [
|
|
557
|
+
target.jobId,
|
|
558
|
+
...Array.isArray(target.correlations) ? target.correlations.map((correlation) => record(correlation).id) : []
|
|
559
|
+
])
|
|
560
|
+
].filter((id) => typeof id === "string" && id.length > 0)
|
|
561
|
+
)
|
|
562
|
+
];
|
|
563
|
+
}
|
|
564
|
+
async function runProductBatch(operation, requests, successKey, options = {}) {
|
|
565
|
+
const { concurrency = 3, ...requestOptions } = options;
|
|
566
|
+
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 10)
|
|
567
|
+
throw new RangeError("concurrency must be an integer between 1 and 10.");
|
|
568
|
+
const results = new Array(requests.length);
|
|
569
|
+
let next = 0;
|
|
570
|
+
const worker = async () => {
|
|
571
|
+
while (next < requests.length) {
|
|
572
|
+
const index = next++;
|
|
573
|
+
const request = requests[index];
|
|
574
|
+
let attempted = false;
|
|
575
|
+
try {
|
|
576
|
+
requestOptions.abortSignal?.throwIfAborted();
|
|
577
|
+
attempted = true;
|
|
578
|
+
const data = await operation(request, requestOptions);
|
|
579
|
+
const success = record(data)[successKey] === true;
|
|
580
|
+
results[index] = {
|
|
581
|
+
productId: request.productId,
|
|
582
|
+
success,
|
|
583
|
+
attempted,
|
|
584
|
+
data,
|
|
585
|
+
jobIds: jobIdsFrom(data),
|
|
586
|
+
...success ? {} : { error: new OmniError({ body: data }) }
|
|
587
|
+
};
|
|
588
|
+
} catch (error) {
|
|
589
|
+
results[index] = {
|
|
590
|
+
productId: request.productId,
|
|
591
|
+
success: false,
|
|
592
|
+
attempted,
|
|
593
|
+
error,
|
|
594
|
+
jobIds: jobIdsFrom(
|
|
595
|
+
error instanceof OmniError ? error.body : void 0
|
|
596
|
+
)
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
await Promise.all(
|
|
602
|
+
Array.from({ length: Math.min(concurrency, requests.length) }, worker)
|
|
603
|
+
);
|
|
604
|
+
const succeededCount = results.filter((result) => result.success).length;
|
|
605
|
+
return {
|
|
606
|
+
success: succeededCount === requests.length,
|
|
607
|
+
productIds: requests.map((request) => request.productId),
|
|
608
|
+
succeededCount,
|
|
609
|
+
failedCount: requests.length - succeededCount,
|
|
610
|
+
results,
|
|
611
|
+
jobIds: [...new Set(results.flatMap((result) => result.jobIds))]
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function batchPublishProducts(publish, request, options) {
|
|
615
|
+
return runProductBatch(publish, requestsForIds(request), "ok", options);
|
|
616
|
+
}
|
|
617
|
+
function batchDelistProducts(delist, request, options) {
|
|
618
|
+
return runProductBatch(delist, requestsForIds(request), "ok", options);
|
|
619
|
+
}
|
|
620
|
+
function batchUpdateProducts(update, request, options) {
|
|
621
|
+
if ("productId" in request || "productIds" in request)
|
|
622
|
+
throw new TypeError("Use updates for a batch of catalog edits.");
|
|
623
|
+
validateItems(request.updates);
|
|
624
|
+
const seen = /* @__PURE__ */ new Set();
|
|
625
|
+
const updates = Array.from(request.updates, (update2) => {
|
|
626
|
+
const productId = normalizeProductId(update2?.productId);
|
|
627
|
+
if (seen.has(productId))
|
|
628
|
+
throw new TypeError("Provide only one update per product ID.");
|
|
629
|
+
seen.add(productId);
|
|
630
|
+
return { ...update2, productId };
|
|
631
|
+
});
|
|
632
|
+
return runProductBatch(update, updates, "success", options);
|
|
633
|
+
}
|
|
634
|
+
|
|
464
635
|
// src/jobs.ts
|
|
465
636
|
var SUCCESS_STATUSES = /* @__PURE__ */ new Set([
|
|
466
637
|
"completed",
|
|
@@ -488,16 +659,16 @@ var JobFailedError = class extends OmniError {
|
|
|
488
659
|
};
|
|
489
660
|
function readJobStatus(payload) {
|
|
490
661
|
if (!payload || typeof payload !== "object") return void 0;
|
|
491
|
-
const
|
|
492
|
-
const nested =
|
|
662
|
+
const record2 = payload;
|
|
663
|
+
const nested = record2.data;
|
|
493
664
|
if (nested && typeof nested === "object") {
|
|
494
665
|
const nestedStatus = nested.status;
|
|
495
666
|
if (typeof nestedStatus === "string" && nestedStatus.trim()) {
|
|
496
667
|
return nestedStatus;
|
|
497
668
|
}
|
|
498
669
|
}
|
|
499
|
-
if (typeof
|
|
500
|
-
return
|
|
670
|
+
if (typeof record2.status === "string" && record2.status.trim()) {
|
|
671
|
+
return record2.status;
|
|
501
672
|
}
|
|
502
673
|
return void 0;
|
|
503
674
|
}
|
|
@@ -1107,6 +1278,100 @@ var AopClient = class {
|
|
|
1107
1278
|
});
|
|
1108
1279
|
}
|
|
1109
1280
|
};
|
|
1281
|
+
var BrandKitsClient = class {
|
|
1282
|
+
constructor(_http) {
|
|
1283
|
+
__publicField(this, "_http", _http);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* List Brand Kits
|
|
1287
|
+
*
|
|
1288
|
+
* 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.
|
|
1289
|
+
*
|
|
1290
|
+
* `GET /api/v1/brand-kits`
|
|
1291
|
+
*/
|
|
1292
|
+
list(request = {}, requestOptions) {
|
|
1293
|
+
const { organizationId, q, limit, offset } = request ?? {};
|
|
1294
|
+
return this._http.request({
|
|
1295
|
+
method: "GET",
|
|
1296
|
+
path: "/api/v1/brand-kits",
|
|
1297
|
+
query: { organizationId, q, limit, offset },
|
|
1298
|
+
body: void 0,
|
|
1299
|
+
...mergeRequestOptions(requestOptions)
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Create Brand Kit
|
|
1304
|
+
*
|
|
1305
|
+
* Create a full brand kit with optional imageSourceUrls. Requires branding:write. All brandKit fields are supported; omitted fields receive canonical defaults.
|
|
1306
|
+
|
|
1307
|
+
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.
|
|
1308
|
+
*
|
|
1309
|
+
* `POST /api/v1/brand-kits`
|
|
1310
|
+
*/
|
|
1311
|
+
create(request, requestOptions) {
|
|
1312
|
+
const { ...body } = request ?? {};
|
|
1313
|
+
return this._http.request({
|
|
1314
|
+
method: "POST",
|
|
1315
|
+
path: "/api/v1/brand-kits",
|
|
1316
|
+
query: void 0,
|
|
1317
|
+
body,
|
|
1318
|
+
...mergeRequestOptions(requestOptions)
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Delete Brand Kit
|
|
1323
|
+
*
|
|
1324
|
+
* Delete the organization-owned kit and its saved brand image-source websites. Requires branding:write. Historical job snapshots are preserved.
|
|
1325
|
+
*
|
|
1326
|
+
* `DELETE /api/v1/brand-kits/{brandKitId}`
|
|
1327
|
+
*/
|
|
1328
|
+
delete(request, requestOptions) {
|
|
1329
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1330
|
+
return this._http.request({
|
|
1331
|
+
method: "DELETE",
|
|
1332
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1333
|
+
query: { organizationId },
|
|
1334
|
+
body: void 0,
|
|
1335
|
+
...mergeRequestOptions(requestOptions)
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Get Brand Kit
|
|
1340
|
+
*
|
|
1341
|
+
* Read the complete kit and imageSourceUrls. Requires branding:read.
|
|
1342
|
+
*
|
|
1343
|
+
* `GET /api/v1/brand-kits/{brandKitId}`
|
|
1344
|
+
*/
|
|
1345
|
+
get(request, requestOptions) {
|
|
1346
|
+
const { brandKitId, organizationId } = request ?? {};
|
|
1347
|
+
return this._http.request({
|
|
1348
|
+
method: "GET",
|
|
1349
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1350
|
+
query: { organizationId },
|
|
1351
|
+
body: void 0,
|
|
1352
|
+
...mergeRequestOptions(requestOptions)
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Update Brand Kit
|
|
1357
|
+
*
|
|
1358
|
+
* Edit name, any nested brandKit fields, and imageSourceUrls. Requires branding:write. Nested objects merge and arrays replace; omitted fields are preserved.
|
|
1359
|
+
|
|
1360
|
+
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.
|
|
1361
|
+
*
|
|
1362
|
+
* `PATCH /api/v1/brand-kits/{brandKitId}`
|
|
1363
|
+
*/
|
|
1364
|
+
update(request, requestOptions) {
|
|
1365
|
+
const { brandKitId, ...body } = request ?? {};
|
|
1366
|
+
return this._http.request({
|
|
1367
|
+
method: "PATCH",
|
|
1368
|
+
path: `/api/v1/brand-kits/${encodePathParam("brandKitId", brandKitId)}`,
|
|
1369
|
+
query: void 0,
|
|
1370
|
+
body,
|
|
1371
|
+
...mergeRequestOptions(requestOptions)
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1110
1375
|
var BrandsgatewayClient = class {
|
|
1111
1376
|
constructor(_http) {
|
|
1112
1377
|
__publicField(this, "_http", _http);
|
|
@@ -1557,6 +1822,56 @@ var ImagesClient = class {
|
|
|
1557
1822
|
});
|
|
1558
1823
|
}
|
|
1559
1824
|
};
|
|
1825
|
+
var InventoryClient = class {
|
|
1826
|
+
constructor(_http) {
|
|
1827
|
+
__publicField(this, "_http", _http);
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* List Inventory Groups
|
|
1831
|
+
*
|
|
1832
|
+
* 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.
|
|
1833
|
+
|
|
1834
|
+
### Stock and listing absence
|
|
1835
|
+
|
|
1836
|
+
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.
|
|
1837
|
+
|
|
1838
|
+
listingPresence reports saved-catalog evidence and unknown missing-SKU families. It does not establish fresh live marketplace absence. Stock quantities fro
|
|
1839
|
+
*
|
|
1840
|
+
* `GET /api/v1/inventory`
|
|
1841
|
+
*/
|
|
1842
|
+
list(request = {}, requestOptions) {
|
|
1843
|
+
const {
|
|
1844
|
+
productIds,
|
|
1845
|
+
query,
|
|
1846
|
+
marketplace,
|
|
1847
|
+
country,
|
|
1848
|
+
storeIds,
|
|
1849
|
+
unlistedMarketplaces,
|
|
1850
|
+
groupBy,
|
|
1851
|
+
status,
|
|
1852
|
+
offset,
|
|
1853
|
+
limit
|
|
1854
|
+
} = request ?? {};
|
|
1855
|
+
return this._http.request({
|
|
1856
|
+
method: "GET",
|
|
1857
|
+
path: "/api/v1/inventory",
|
|
1858
|
+
query: {
|
|
1859
|
+
productIds,
|
|
1860
|
+
query,
|
|
1861
|
+
marketplace,
|
|
1862
|
+
country,
|
|
1863
|
+
storeIds,
|
|
1864
|
+
unlistedMarketplaces,
|
|
1865
|
+
groupBy,
|
|
1866
|
+
status,
|
|
1867
|
+
offset,
|
|
1868
|
+
limit
|
|
1869
|
+
},
|
|
1870
|
+
body: void 0,
|
|
1871
|
+
...mergeRequestOptions(requestOptions)
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1560
1875
|
var JobsClient = class {
|
|
1561
1876
|
constructor(_http) {
|
|
1562
1877
|
__publicField(this, "_http", _http);
|
|
@@ -2241,7 +2556,19 @@ var ProductsClient = class {
|
|
|
2241
2556
|
maxPrice,
|
|
2242
2557
|
sortBy,
|
|
2243
2558
|
limit,
|
|
2244
|
-
offset
|
|
2559
|
+
offset,
|
|
2560
|
+
store,
|
|
2561
|
+
storeKeys,
|
|
2562
|
+
brands,
|
|
2563
|
+
bundleType,
|
|
2564
|
+
language,
|
|
2565
|
+
hasImage,
|
|
2566
|
+
stock,
|
|
2567
|
+
publishedFrom,
|
|
2568
|
+
publishedTo,
|
|
2569
|
+
publishedTimeZone,
|
|
2570
|
+
cursor,
|
|
2571
|
+
includeSummary
|
|
2245
2572
|
} = request ?? {};
|
|
2246
2573
|
return this._http.request({
|
|
2247
2574
|
method: "GET",
|
|
@@ -2256,7 +2583,19 @@ var ProductsClient = class {
|
|
|
2256
2583
|
maxPrice,
|
|
2257
2584
|
sortBy,
|
|
2258
2585
|
limit,
|
|
2259
|
-
offset
|
|
2586
|
+
offset,
|
|
2587
|
+
store,
|
|
2588
|
+
storeKeys,
|
|
2589
|
+
brands,
|
|
2590
|
+
bundleType,
|
|
2591
|
+
language,
|
|
2592
|
+
hasImage,
|
|
2593
|
+
stock,
|
|
2594
|
+
publishedFrom,
|
|
2595
|
+
publishedTo,
|
|
2596
|
+
publishedTimeZone,
|
|
2597
|
+
cursor,
|
|
2598
|
+
includeSummary
|
|
2260
2599
|
},
|
|
2261
2600
|
body: void 0,
|
|
2262
2601
|
...mergeRequestOptions(requestOptions)
|
|
@@ -2510,18 +2849,14 @@ var ProductsClient = class {
|
|
|
2510
2849
|
*
|
|
2511
2850
|
* Queue a bulk product import for the authenticated organization.
|
|
2512
2851
|
|
|
2852
|
+
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.
|
|
2853
|
+
|
|
2513
2854
|
### Input options
|
|
2514
2855
|
|
|
2515
2856
|
- Upload a CSV (2 MiB) or JSON products file (8 MiB) using `multipart/form-data`.
|
|
2516
2857
|
- Send JSON with a `products` array of 1–5,000 flat product objects (8 MiB request maximum).
|
|
2517
2858
|
- Send JSON with inline `csvText`.
|
|
2518
|
-
- Send
|
|
2519
|
-
|
|
2520
|
-
### Asynchronous result
|
|
2521
|
-
|
|
2522
|
-
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}`.
|
|
2523
|
-
|
|
2524
|
-
Cancel an in-flight import with `POST /api/v1/jobs/{jobId}/cancel`.
|
|
2859
|
+
- Send
|
|
2525
2860
|
*
|
|
2526
2861
|
* `POST /api/v1/products/bulk-import`
|
|
2527
2862
|
*/
|
|
@@ -2535,6 +2870,54 @@ var ProductsClient = class {
|
|
|
2535
2870
|
...mergeRequestOptions(requestOptions)
|
|
2536
2871
|
});
|
|
2537
2872
|
}
|
|
2873
|
+
/**
|
|
2874
|
+
* Get Import Retry Progress
|
|
2875
|
+
*
|
|
2876
|
+
* 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.
|
|
2877
|
+
|
|
2878
|
+
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.
|
|
2879
|
+
*
|
|
2880
|
+
* `GET /api/v1/products/bulk-import/retries/{retryJobId}`
|
|
2881
|
+
*/
|
|
2882
|
+
getBulkImportRetry(request, requestOptions) {
|
|
2883
|
+
const { retryJobId, organizationId } = request ?? {};
|
|
2884
|
+
return this._http.request({
|
|
2885
|
+
method: "GET",
|
|
2886
|
+
path: `/api/v1/products/bulk-import/retries/${encodePathParam("retryJobId", retryJobId)}`,
|
|
2887
|
+
query: { organizationId },
|
|
2888
|
+
body: void 0,
|
|
2889
|
+
...mergeRequestOptions(requestOptions)
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
/**
|
|
2893
|
+
* Retry Failed Import or Review Jobs
|
|
2894
|
+
*
|
|
2895
|
+
* Retry 1–20 jobs with durable background execution. Requires catalog:write.
|
|
2896
|
+
|
|
2897
|
+
### Targets
|
|
2898
|
+
|
|
2899
|
+
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.
|
|
2900
|
+
|
|
2901
|
+
### Retry scope
|
|
2902
|
+
|
|
2903
|
+
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.
|
|
2904
|
+
|
|
2905
|
+
### Results
|
|
2906
|
+
|
|
2907
|
+
Use the returned ord
|
|
2908
|
+
*
|
|
2909
|
+
* `POST /api/v1/products/bulk-import/retry`
|
|
2910
|
+
*/
|
|
2911
|
+
retryBulkImport(request, requestOptions) {
|
|
2912
|
+
const { ...body } = request ?? {};
|
|
2913
|
+
return this._http.request({
|
|
2914
|
+
method: "POST",
|
|
2915
|
+
path: "/api/v1/products/bulk-import/retry",
|
|
2916
|
+
query: void 0,
|
|
2917
|
+
body,
|
|
2918
|
+
...mergeRequestOptions(requestOptions)
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2538
2921
|
/**
|
|
2539
2922
|
* Compare Product Market Prices
|
|
2540
2923
|
*
|
|
@@ -2606,6 +2989,63 @@ var ProductsClient = class {
|
|
|
2606
2989
|
...mergeRequestOptions(requestOptions)
|
|
2607
2990
|
});
|
|
2608
2991
|
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Count Products
|
|
2994
|
+
*
|
|
2995
|
+
* Count matching catalog parent products using the Products page's canonical filters and authorization, without loading rows, pricing, or location data.
|
|
2996
|
+
|
|
2997
|
+
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.
|
|
2998
|
+
|
|
2999
|
+
Authenticate with a read-only catalog credential; organization comes only from that credential.
|
|
3000
|
+
*
|
|
3001
|
+
* `GET /api/v1/products/count`
|
|
3002
|
+
*/
|
|
3003
|
+
count(request = {}, requestOptions) {
|
|
3004
|
+
const {
|
|
3005
|
+
status,
|
|
3006
|
+
marketplace,
|
|
3007
|
+
country,
|
|
3008
|
+
q,
|
|
3009
|
+
sku,
|
|
3010
|
+
minPrice,
|
|
3011
|
+
maxPrice,
|
|
3012
|
+
store,
|
|
3013
|
+
storeKeys,
|
|
3014
|
+
brands,
|
|
3015
|
+
bundleType,
|
|
3016
|
+
language,
|
|
3017
|
+
hasImage,
|
|
3018
|
+
stock,
|
|
3019
|
+
publishedFrom,
|
|
3020
|
+
publishedTo,
|
|
3021
|
+
publishedTimeZone
|
|
3022
|
+
} = request ?? {};
|
|
3023
|
+
return this._http.request({
|
|
3024
|
+
method: "GET",
|
|
3025
|
+
path: "/api/v1/products/count",
|
|
3026
|
+
query: {
|
|
3027
|
+
status,
|
|
3028
|
+
marketplace,
|
|
3029
|
+
country,
|
|
3030
|
+
q,
|
|
3031
|
+
sku,
|
|
3032
|
+
minPrice,
|
|
3033
|
+
maxPrice,
|
|
3034
|
+
store,
|
|
3035
|
+
storeKeys,
|
|
3036
|
+
brands,
|
|
3037
|
+
bundleType,
|
|
3038
|
+
language,
|
|
3039
|
+
hasImage,
|
|
3040
|
+
stock,
|
|
3041
|
+
publishedFrom,
|
|
3042
|
+
publishedTo,
|
|
3043
|
+
publishedTimeZone
|
|
3044
|
+
},
|
|
3045
|
+
body: void 0,
|
|
3046
|
+
...mergeRequestOptions(requestOptions)
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
2609
3049
|
/**
|
|
2610
3050
|
* Queue Product Enrichment
|
|
2611
3051
|
*
|
|
@@ -2613,9 +3053,9 @@ var ProductsClient = class {
|
|
|
2613
3053
|
|
|
2614
3054
|
### Enrichment options
|
|
2615
3055
|
|
|
2616
|
-
Fields, instructions and auto-apply settings use the canonical enrichment service. Exclude name from selectedFields to preserve titles. Weight and dimensions are always included;
|
|
3056
|
+
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.
|
|
2617
3057
|
|
|
2618
|
-
autoApplyHighConfidence defaults to false.
|
|
3058
|
+
autoApplyHighConfidence defaults to false.
|
|
2619
3059
|
*
|
|
2620
3060
|
* `POST /api/v1/products/enrich`
|
|
2621
3061
|
*/
|
|
@@ -2629,6 +3069,38 @@ var ProductsClient = class {
|
|
|
2629
3069
|
...mergeRequestOptions(requestOptions)
|
|
2630
3070
|
});
|
|
2631
3071
|
}
|
|
3072
|
+
/** Read a bounded chunk without summary classification; persist progress to resume. */
|
|
3073
|
+
scan(request = {}, options) {
|
|
3074
|
+
return scanProducts(
|
|
3075
|
+
(page, requestOptions) => this.list(page, requestOptions),
|
|
3076
|
+
request,
|
|
3077
|
+
options
|
|
3078
|
+
);
|
|
3079
|
+
}
|
|
3080
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3081
|
+
batchPublish(request, options) {
|
|
3082
|
+
return batchPublishProducts(
|
|
3083
|
+
(item, requestOptions) => this.publish(item, requestOptions),
|
|
3084
|
+
request,
|
|
3085
|
+
options
|
|
3086
|
+
);
|
|
3087
|
+
}
|
|
3088
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3089
|
+
batchDelist(request, options) {
|
|
3090
|
+
return batchDelistProducts(
|
|
3091
|
+
(item, requestOptions) => this.delist(item, requestOptions),
|
|
3092
|
+
request,
|
|
3093
|
+
options
|
|
3094
|
+
);
|
|
3095
|
+
}
|
|
3096
|
+
/** Process 1–100 products with bounded concurrency and ordered per-product results. */
|
|
3097
|
+
batchUpdate(request, options) {
|
|
3098
|
+
return batchUpdateProducts(
|
|
3099
|
+
(item, requestOptions) => this.update(item, requestOptions),
|
|
3100
|
+
request,
|
|
3101
|
+
options
|
|
3102
|
+
);
|
|
3103
|
+
}
|
|
2632
3104
|
};
|
|
2633
3105
|
var PromotionsClient = class {
|
|
2634
3106
|
constructor(_http) {
|
|
@@ -3458,6 +3930,7 @@ var OmniGeneratedClient = class {
|
|
|
3458
3930
|
__publicField(this, "agents");
|
|
3459
3931
|
__publicField(this, "analytics");
|
|
3460
3932
|
__publicField(this, "aop");
|
|
3933
|
+
__publicField(this, "brandKits");
|
|
3461
3934
|
__publicField(this, "brandsgateway");
|
|
3462
3935
|
__publicField(this, "campaigns");
|
|
3463
3936
|
__publicField(this, "catalog");
|
|
@@ -3468,6 +3941,7 @@ var OmniGeneratedClient = class {
|
|
|
3468
3941
|
__publicField(this, "evaluate");
|
|
3469
3942
|
__publicField(this, "feed");
|
|
3470
3943
|
__publicField(this, "images");
|
|
3944
|
+
__publicField(this, "inventory");
|
|
3471
3945
|
__publicField(this, "jobs");
|
|
3472
3946
|
__publicField(this, "looks");
|
|
3473
3947
|
__publicField(this, "marketplaces");
|
|
@@ -3493,6 +3967,7 @@ var OmniGeneratedClient = class {
|
|
|
3493
3967
|
this.agents = new AgentsClient(this._http);
|
|
3494
3968
|
this.analytics = new AnalyticsClient(this._http);
|
|
3495
3969
|
this.aop = new AopClient(this._http);
|
|
3970
|
+
this.brandKits = new BrandKitsClient(this._http);
|
|
3496
3971
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
3497
3972
|
this.campaigns = new CampaignsClient(this._http);
|
|
3498
3973
|
this.catalog = new CatalogClient(this._http);
|
|
@@ -3503,6 +3978,7 @@ var OmniGeneratedClient = class {
|
|
|
3503
3978
|
this.evaluate = new EvaluateClient(this._http);
|
|
3504
3979
|
this.feed = new FeedClient(this._http);
|
|
3505
3980
|
this.images = new ImagesClient(this._http);
|
|
3981
|
+
this.inventory = new InventoryClient(this._http);
|
|
3506
3982
|
this.jobs = new JobsClient(this._http);
|
|
3507
3983
|
this.looks = new LooksClient(this._http);
|
|
3508
3984
|
this.marketplaces = new MarketplacesClient(this._http);
|
|
@@ -3548,8 +4024,8 @@ function headerValue(headers, name) {
|
|
|
3548
4024
|
if (typeof Headers !== "undefined" && headers instanceof Headers) {
|
|
3549
4025
|
return headers.get(name) ?? headers.get(name.toLowerCase()) ?? void 0;
|
|
3550
4026
|
}
|
|
3551
|
-
const
|
|
3552
|
-
const direct =
|
|
4027
|
+
const record2 = headers;
|
|
4028
|
+
const direct = record2[name] ?? record2[name.toLowerCase()];
|
|
3553
4029
|
if (Array.isArray(direct)) return direct[0];
|
|
3554
4030
|
return direct ?? void 0;
|
|
3555
4031
|
}
|
|
@@ -3649,6 +4125,7 @@ exports.OmniClient = OmniClient;
|
|
|
3649
4125
|
exports.OmniEnvironment = OmniEnvironment;
|
|
3650
4126
|
exports.OmniError = OmniError;
|
|
3651
4127
|
exports.OmniTimeoutError = OmniTimeoutError;
|
|
4128
|
+
exports.ProductScanError = ProductScanError;
|
|
3652
4129
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3653
4130
|
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
3654
4131
|
exports.TooManyRequestsError = TooManyRequestsError;
|