@omni-commerce/sdk 0.31.1 → 0.34.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 +6 -0
- package/dist/index.cjs +817 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11553 -6236
- package/dist/index.d.ts +11553 -6236
- package/dist/index.js +813 -8
- 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.34.0";
|
|
37
37
|
var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
|
|
38
38
|
|
|
39
39
|
// src/environments.ts
|
|
@@ -712,6 +712,235 @@ async function waitForJob(http, request, options) {
|
|
|
712
712
|
}
|
|
713
713
|
|
|
714
714
|
// src/generated/resources.ts
|
|
715
|
+
var AdsClient = class {
|
|
716
|
+
constructor(_http) {
|
|
717
|
+
__publicField(this, "_http", _http);
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* List Ads accounts and capabilities
|
|
721
|
+
*
|
|
722
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
723
|
+
*
|
|
724
|
+
* `GET /api/v1/ads/accounts`
|
|
725
|
+
*/
|
|
726
|
+
listAccounts(request = {}, requestOptions) {
|
|
727
|
+
const { marketplaces, organizationId } = request ?? {};
|
|
728
|
+
return this._http.request({
|
|
729
|
+
method: "GET",
|
|
730
|
+
path: "/api/v1/ads/accounts",
|
|
731
|
+
query: { marketplaces, organizationId },
|
|
732
|
+
body: void 0,
|
|
733
|
+
...mergeRequestOptions(requestOptions)
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* List saved and synced ads
|
|
738
|
+
*
|
|
739
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
740
|
+
*
|
|
741
|
+
* `GET /api/v1/ads/campaigns`
|
|
742
|
+
*/
|
|
743
|
+
listCampaigns(request = {}, requestOptions) {
|
|
744
|
+
const { status, q, marketplace, store, offset, organizationId } = request ?? {};
|
|
745
|
+
return this._http.request({
|
|
746
|
+
method: "GET",
|
|
747
|
+
path: "/api/v1/ads/campaigns",
|
|
748
|
+
query: { status, q, marketplace, store, offset, organizationId },
|
|
749
|
+
body: void 0,
|
|
750
|
+
...mergeRequestOptions(requestOptions)
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Draft a multi-store Ads campaign
|
|
755
|
+
*
|
|
756
|
+
* Requires ads:write. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
757
|
+
*
|
|
758
|
+
* `POST /api/v1/ads/campaigns`
|
|
759
|
+
*/
|
|
760
|
+
createCampaign(request, requestOptions) {
|
|
761
|
+
const { ...body } = request ?? {};
|
|
762
|
+
return this._http.request({
|
|
763
|
+
method: "POST",
|
|
764
|
+
path: "/api/v1/ads/campaigns",
|
|
765
|
+
query: void 0,
|
|
766
|
+
body,
|
|
767
|
+
...mergeRequestOptions(requestOptions)
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Approve, stop or retry Ads campaign groups
|
|
772
|
+
*
|
|
773
|
+
* Requires ads:approve. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
774
|
+
*
|
|
775
|
+
* `POST /api/v1/ads/campaigns/actions`
|
|
776
|
+
*/
|
|
777
|
+
actOnCampaigns(request, requestOptions) {
|
|
778
|
+
const { ...body } = request ?? {};
|
|
779
|
+
return this._http.request({
|
|
780
|
+
method: "POST",
|
|
781
|
+
path: "/api/v1/ads/campaigns/actions",
|
|
782
|
+
query: void 0,
|
|
783
|
+
body,
|
|
784
|
+
...mergeRequestOptions(requestOptions)
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Read live marketplace campaigns
|
|
789
|
+
*
|
|
790
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
791
|
+
*
|
|
792
|
+
* `POST /api/v1/ads/campaigns/live`
|
|
793
|
+
*/
|
|
794
|
+
getLiveCampaigns(request, requestOptions) {
|
|
795
|
+
const { ...body } = request ?? {};
|
|
796
|
+
return this._http.request({
|
|
797
|
+
method: "POST",
|
|
798
|
+
path: "/api/v1/ads/campaigns/live",
|
|
799
|
+
query: void 0,
|
|
800
|
+
body,
|
|
801
|
+
...mergeRequestOptions(requestOptions)
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Read saved Ads campaign groups
|
|
806
|
+
*
|
|
807
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
808
|
+
*
|
|
809
|
+
* `POST /api/v1/ads/campaigns/read`
|
|
810
|
+
*/
|
|
811
|
+
getCampaigns(request, requestOptions) {
|
|
812
|
+
const { ...body } = request ?? {};
|
|
813
|
+
return this._http.request({
|
|
814
|
+
method: "POST",
|
|
815
|
+
path: "/api/v1/ads/campaigns/read",
|
|
816
|
+
query: void 0,
|
|
817
|
+
body,
|
|
818
|
+
...mergeRequestOptions(requestOptions)
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Read live Ads performance
|
|
823
|
+
*
|
|
824
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
825
|
+
*
|
|
826
|
+
* `POST /api/v1/ads/performance`
|
|
827
|
+
*/
|
|
828
|
+
getPerformance(request, requestOptions) {
|
|
829
|
+
const { ...body } = request ?? {};
|
|
830
|
+
return this._http.request({
|
|
831
|
+
method: "POST",
|
|
832
|
+
path: "/api/v1/ads/performance",
|
|
833
|
+
query: void 0,
|
|
834
|
+
body,
|
|
835
|
+
...mergeRequestOptions(requestOptions)
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Approve, stop or retry legacy Ads plans
|
|
840
|
+
*
|
|
841
|
+
* Requires ads:approve. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
842
|
+
*
|
|
843
|
+
* `POST /api/v1/ads/plans/actions`
|
|
844
|
+
*/
|
|
845
|
+
actOnPlans(request, requestOptions) {
|
|
846
|
+
const { ...body } = request ?? {};
|
|
847
|
+
return this._http.request({
|
|
848
|
+
method: "POST",
|
|
849
|
+
path: "/api/v1/ads/plans/actions",
|
|
850
|
+
query: void 0,
|
|
851
|
+
body,
|
|
852
|
+
...mergeRequestOptions(requestOptions)
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Read delivery and verification evidence
|
|
857
|
+
*
|
|
858
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
859
|
+
*
|
|
860
|
+
* `POST /api/v1/ads/plans/status`
|
|
861
|
+
*/
|
|
862
|
+
getPlans(request, requestOptions) {
|
|
863
|
+
const { ...body } = request ?? {};
|
|
864
|
+
return this._http.request({
|
|
865
|
+
method: "POST",
|
|
866
|
+
path: "/api/v1/ads/plans/status",
|
|
867
|
+
query: void 0,
|
|
868
|
+
body,
|
|
869
|
+
...mergeRequestOptions(requestOptions)
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Read persisted campaign reports
|
|
874
|
+
*
|
|
875
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
876
|
+
*
|
|
877
|
+
* `GET /api/v1/ads/reports`
|
|
878
|
+
*/
|
|
879
|
+
getReports(request, requestOptions) {
|
|
880
|
+
const {
|
|
881
|
+
from,
|
|
882
|
+
to,
|
|
883
|
+
marketplace,
|
|
884
|
+
country,
|
|
885
|
+
store,
|
|
886
|
+
currency,
|
|
887
|
+
campaign,
|
|
888
|
+
offset,
|
|
889
|
+
organizationId
|
|
890
|
+
} = request ?? {};
|
|
891
|
+
return this._http.request({
|
|
892
|
+
method: "GET",
|
|
893
|
+
path: "/api/v1/ads/reports",
|
|
894
|
+
query: {
|
|
895
|
+
from,
|
|
896
|
+
to,
|
|
897
|
+
marketplace,
|
|
898
|
+
country,
|
|
899
|
+
store,
|
|
900
|
+
currency,
|
|
901
|
+
campaign,
|
|
902
|
+
offset,
|
|
903
|
+
organizationId
|
|
904
|
+
},
|
|
905
|
+
body: void 0,
|
|
906
|
+
...mergeRequestOptions(requestOptions)
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Queue Ads report imports
|
|
911
|
+
*
|
|
912
|
+
* Requires ads:read. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
913
|
+
*
|
|
914
|
+
* `POST /api/v1/ads/sync`
|
|
915
|
+
*/
|
|
916
|
+
syncReports(request, requestOptions) {
|
|
917
|
+
const { ...body } = request ?? {};
|
|
918
|
+
return this._http.request({
|
|
919
|
+
method: "POST",
|
|
920
|
+
path: "/api/v1/ads/sync",
|
|
921
|
+
query: void 0,
|
|
922
|
+
body,
|
|
923
|
+
...mergeRequestOptions(requestOptions)
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Read Ads import job status
|
|
928
|
+
*
|
|
929
|
+
* Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.
|
|
930
|
+
*
|
|
931
|
+
* `POST /api/v1/ads/sync/status`
|
|
932
|
+
*/
|
|
933
|
+
getSyncStatus(request, requestOptions) {
|
|
934
|
+
const { ...body } = request ?? {};
|
|
935
|
+
return this._http.request({
|
|
936
|
+
method: "POST",
|
|
937
|
+
path: "/api/v1/ads/sync/status",
|
|
938
|
+
query: void 0,
|
|
939
|
+
body,
|
|
940
|
+
...mergeRequestOptions(requestOptions)
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
};
|
|
715
944
|
var AgentsGeneralClient = class {
|
|
716
945
|
constructor(_http) {
|
|
717
946
|
__publicField(this, "_http", _http);
|
|
@@ -1446,6 +1675,136 @@ var ApiClient = class {
|
|
|
1446
1675
|
});
|
|
1447
1676
|
}
|
|
1448
1677
|
};
|
|
1678
|
+
var BotsClient = class {
|
|
1679
|
+
constructor(_http) {
|
|
1680
|
+
__publicField(this, "_http", _http);
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* List personal Bots
|
|
1684
|
+
*
|
|
1685
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1686
|
+
*
|
|
1687
|
+
* `GET /api/v1/bots`
|
|
1688
|
+
*/
|
|
1689
|
+
list(request = {}, requestOptions) {
|
|
1690
|
+
const { organizationId, q, page, status } = request ?? {};
|
|
1691
|
+
return this._http.request({
|
|
1692
|
+
method: "GET",
|
|
1693
|
+
path: "/api/v1/bots",
|
|
1694
|
+
query: { organizationId, q, page, status },
|
|
1695
|
+
body: void 0,
|
|
1696
|
+
...mergeRequestOptions(requestOptions)
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Create a personal Bot
|
|
1701
|
+
*
|
|
1702
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1703
|
+
*
|
|
1704
|
+
* `POST /api/v1/bots`
|
|
1705
|
+
*/
|
|
1706
|
+
create(request, requestOptions) {
|
|
1707
|
+
const { organizationId, ...body } = request ?? {};
|
|
1708
|
+
return this._http.request({
|
|
1709
|
+
method: "POST",
|
|
1710
|
+
path: "/api/v1/bots",
|
|
1711
|
+
query: { organizationId },
|
|
1712
|
+
body,
|
|
1713
|
+
...mergeRequestOptions(requestOptions)
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* List a Bot's routines
|
|
1718
|
+
*
|
|
1719
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1720
|
+
*
|
|
1721
|
+
* `GET /api/v1/bots/{botId}/routines`
|
|
1722
|
+
*/
|
|
1723
|
+
listRoutines(request, requestOptions) {
|
|
1724
|
+
const { botId, organizationId } = request ?? {};
|
|
1725
|
+
return this._http.request({
|
|
1726
|
+
method: "GET",
|
|
1727
|
+
path: `/api/v1/bots/${encodePathParam("botId", botId)}/routines`,
|
|
1728
|
+
query: { organizationId },
|
|
1729
|
+
body: void 0,
|
|
1730
|
+
...mergeRequestOptions(requestOptions)
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Manage a Bot's routines
|
|
1735
|
+
*
|
|
1736
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1737
|
+
|
|
1738
|
+
Create, edit, link, pause, resume, delete, test, or run a batch of routines. New personal routines start paused. Reuse the same requestId only when retrying the same request. Inspect every ordered result before retrying failed targets.
|
|
1739
|
+
*
|
|
1740
|
+
* `POST /api/v1/bots/{botId}/routines`
|
|
1741
|
+
*/
|
|
1742
|
+
mutateRoutines(request, requestOptions) {
|
|
1743
|
+
const { botId, organizationId, ...body } = request ?? {};
|
|
1744
|
+
return this._http.request({
|
|
1745
|
+
method: "POST",
|
|
1746
|
+
path: `/api/v1/bots/${encodePathParam("botId", botId)}/routines`,
|
|
1747
|
+
query: { organizationId },
|
|
1748
|
+
body,
|
|
1749
|
+
...mergeRequestOptions(requestOptions)
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* List a Bot's message runs
|
|
1754
|
+
*
|
|
1755
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1756
|
+
*
|
|
1757
|
+
* `GET /api/v1/bots/{botId}/runs`
|
|
1758
|
+
*/
|
|
1759
|
+
listRuns(request, requestOptions) {
|
|
1760
|
+
const { botId, organizationId } = request ?? {};
|
|
1761
|
+
return this._http.request({
|
|
1762
|
+
method: "GET",
|
|
1763
|
+
path: `/api/v1/bots/${encodePathParam("botId", botId)}/runs`,
|
|
1764
|
+
query: { organizationId },
|
|
1765
|
+
body: void 0,
|
|
1766
|
+
...mergeRequestOptions(requestOptions)
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Send a message to a Bot
|
|
1771
|
+
*
|
|
1772
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1773
|
+
|
|
1774
|
+
Reuse the same requestId when retrying a submission. The response Location points to the run status.
|
|
1775
|
+
*
|
|
1776
|
+
* `POST /api/v1/bots/{botId}/runs`
|
|
1777
|
+
*/
|
|
1778
|
+
sendMessage(request, requestOptions) {
|
|
1779
|
+
const { botId, organizationId, ...body } = request ?? {};
|
|
1780
|
+
return this._http.request({
|
|
1781
|
+
method: "POST",
|
|
1782
|
+
path: `/api/v1/bots/${encodePathParam("botId", botId)}/runs`,
|
|
1783
|
+
query: { organizationId },
|
|
1784
|
+
body,
|
|
1785
|
+
...mergeRequestOptions(requestOptions)
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Read a Bot message run
|
|
1790
|
+
*
|
|
1791
|
+
* Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.
|
|
1792
|
+
|
|
1793
|
+
Returns the run's status, visible reply, and approval URL when available. Archived runs retain their status. Reopen their conversation to read the reply after the active run journal expires.
|
|
1794
|
+
*
|
|
1795
|
+
* `GET /api/v1/bots/{botId}/runs/{runId}`
|
|
1796
|
+
*/
|
|
1797
|
+
getRun(request, requestOptions) {
|
|
1798
|
+
const { botId, runId, organizationId } = request ?? {};
|
|
1799
|
+
return this._http.request({
|
|
1800
|
+
method: "GET",
|
|
1801
|
+
path: `/api/v1/bots/${encodePathParam("botId", botId)}/runs/${encodePathParam("runId", runId)}`,
|
|
1802
|
+
query: { organizationId },
|
|
1803
|
+
body: void 0,
|
|
1804
|
+
...mergeRequestOptions(requestOptions)
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1449
1808
|
var BrandKitsClient = class {
|
|
1450
1809
|
constructor(_http) {
|
|
1451
1810
|
__publicField(this, "_http", _http);
|
|
@@ -1612,10 +1971,95 @@ var BulkClient = class {
|
|
|
1612
1971
|
...mergeRequestOptions(requestOptions)
|
|
1613
1972
|
});
|
|
1614
1973
|
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Create Catalog Operation Plan
|
|
1976
|
+
*
|
|
1977
|
+
* Create a staged pricing, catalog record import, or reviewable enrichment plan for up to one million targets. Add enrichment options for listing copy, images, or store taxonomy, or importRecords for new catalog records. Set importRecords.update on a file plan to prepare exact-SKU price or warehouse stock updates for review. An optional selection filter prepares an enrichment plan server-side. Poll status until draft, review the total, and explicitly submit. Repeat the original create request after an interruption. If the selection exceeds the limit, narrow the filters and create a new plan. The initiating identity can upload ordered chunks and submit the plan when complete. Reusing the same idempotency key and options resumes that plan. Requires catalog:write and catalog:read. Enrichment al
|
|
1978
|
+
*
|
|
1979
|
+
* `POST /api/v1/catalog/operations/plan`
|
|
1980
|
+
*/
|
|
1981
|
+
plan(request, requestOptions) {
|
|
1982
|
+
const { organizationId, ...body } = request ?? {};
|
|
1983
|
+
return this._http.request({
|
|
1984
|
+
method: "POST",
|
|
1985
|
+
path: "/api/v1/catalog/operations/plan",
|
|
1986
|
+
query: { organizationId },
|
|
1987
|
+
body,
|
|
1988
|
+
...mergeRequestOptions(requestOptions)
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Append Catalog Operation Chunk
|
|
1993
|
+
*
|
|
1994
|
+
* Upload up to 500 distinct targets at the next chunkIndex, starting at zero. Provide updates for pricing, productIds for enrichment, or products for record imports. Each product belongs to one chunk. Replaying the same chunk index and content is safe and returns the latest upload progress. Pricing captures product versions when targets are appended. Enrichment receipts identify the linked review and report when generation reaches review. Requires catalog:write.
|
|
1995
|
+
*
|
|
1996
|
+
* `POST /api/v1/catalog/operations/plan/append`
|
|
1997
|
+
*/
|
|
1998
|
+
append(request, requestOptions) {
|
|
1999
|
+
const { organizationId, ...body } = request ?? {};
|
|
2000
|
+
return this._http.request({
|
|
2001
|
+
method: "POST",
|
|
2002
|
+
path: "/api/v1/catalog/operations/plan/append",
|
|
2003
|
+
query: { organizationId },
|
|
2004
|
+
body,
|
|
2005
|
+
...mergeRequestOptions(requestOptions)
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Complete Catalog File
|
|
2010
|
+
*
|
|
2011
|
+
* Queue validation and import after all file parts are uploaded. For importRecords.update, validation ends at ready_for_review. Read the ordered preview with bulk.results and submit explicitly with expectedProductCount. For create-only file imports, validation queues the import automatically. Then follow the same operation in bulk.status and bulk.results. Repeat this request after a retryable interruption. Requires catalog:read and catalog:write.
|
|
2012
|
+
*
|
|
2013
|
+
* `POST /api/v1/catalog/operations/plan/file-complete`
|
|
2014
|
+
*/
|
|
2015
|
+
completeFile(request, requestOptions) {
|
|
2016
|
+
const { organizationId, ...body } = request ?? {};
|
|
2017
|
+
return this._http.request({
|
|
2018
|
+
method: "POST",
|
|
2019
|
+
path: "/api/v1/catalog/operations/plan/file-complete",
|
|
2020
|
+
query: { organizationId },
|
|
2021
|
+
body,
|
|
2022
|
+
...mergeRequestOptions(requestOptions)
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Prepare Catalog File Parts
|
|
2027
|
+
*
|
|
2028
|
+
* Request signed PUT URLs for up to eight file parts. Each is 8 MiB except the final part. Send the exact bytes and x-amz-checksum-sha256 header to the signed URL. Previously uploaded matching parts are skipped. Requires catalog:read and catalog:write.
|
|
2029
|
+
*
|
|
2030
|
+
* `POST /api/v1/catalog/operations/plan/file-parts`
|
|
2031
|
+
*/
|
|
2032
|
+
fileParts(request, requestOptions) {
|
|
2033
|
+
const { organizationId, ...body } = request ?? {};
|
|
2034
|
+
return this._http.request({
|
|
2035
|
+
method: "POST",
|
|
2036
|
+
path: "/api/v1/catalog/operations/plan/file-parts",
|
|
2037
|
+
query: { organizationId },
|
|
2038
|
+
body,
|
|
2039
|
+
...mergeRequestOptions(requestOptions)
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Submit Catalog Operation Plan
|
|
2044
|
+
*
|
|
2045
|
+
* Seal and queue the uploaded plan if its product count matches expectedProductCount. Retry the same request if admission is interrupted. Use bulk.status and bulk.results for progress and receipts. Requires the same scopes as plan creation.
|
|
2046
|
+
*
|
|
2047
|
+
* `POST /api/v1/catalog/operations/plan/submit`
|
|
2048
|
+
*/
|
|
2049
|
+
submit(request, requestOptions) {
|
|
2050
|
+
const { organizationId, ...body } = request ?? {};
|
|
2051
|
+
return this._http.request({
|
|
2052
|
+
method: "POST",
|
|
2053
|
+
path: "/api/v1/catalog/operations/plan/submit",
|
|
2054
|
+
query: { organizationId },
|
|
2055
|
+
body,
|
|
2056
|
+
...mergeRequestOptions(requestOptions)
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
1615
2059
|
/**
|
|
1616
2060
|
* Get Catalog Operation Results
|
|
1617
2061
|
*
|
|
1618
|
-
* Read ordered per-product receipts and verification evidence for up to 50 operationIds. Filter status=failed to inspect failures directly.
|
|
2062
|
+
* Read ordered per-product receipts and verification evidence for up to 50 operationIds. Filter status=failed to inspect failures directly. Pass nextPageKey as after on the next request, keeping the operation order and status filter the same. At most 100 rows per page. Requires catalog:read.
|
|
1619
2063
|
*
|
|
1620
2064
|
* `POST /api/v1/catalog/operations/results`
|
|
1621
2065
|
*/
|
|
@@ -1632,7 +2076,7 @@ var BulkClient = class {
|
|
|
1632
2076
|
/**
|
|
1633
2077
|
* Get Catalog Operation Status
|
|
1634
2078
|
*
|
|
1635
|
-
* Read compact progress for up to 50 operationIds in first-requested order. Pending is incomplete, and partial failures remain explicit. Requires catalog:read. Detailed receipts are returned
|
|
2079
|
+
* Read compact progress for up to 50 operationIds in first-requested order. Draft plans are still accepting input. A file update at ready_for_review requires approval via bulk.submit. Pending is incomplete, and partial failures remain explicit. Requires catalog:read. Detailed receipts are returned by the paginated results API.
|
|
1636
2080
|
*
|
|
1637
2081
|
* `POST /api/v1/catalog/operations/status`
|
|
1638
2082
|
*/
|
|
@@ -2391,6 +2835,27 @@ var EmailClient = class {
|
|
|
2391
2835
|
...mergeRequestOptions(requestOptions)
|
|
2392
2836
|
});
|
|
2393
2837
|
}
|
|
2838
|
+
/**
|
|
2839
|
+
* Get Email Drafts
|
|
2840
|
+
*
|
|
2841
|
+
* Read exact unsent drafts in one connected mailbox. Pass one to twenty draft resource IDs, in request order. Duplicate IDs are read once. The result includes a per-draft outcome for every distinct ID.
|
|
2842
|
+
|
|
2843
|
+
### Authorization
|
|
2844
|
+
|
|
2845
|
+
Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
|
|
2846
|
+
*
|
|
2847
|
+
* `POST /api/v1/email/drafts/query`
|
|
2848
|
+
*/
|
|
2849
|
+
getDrafts(request, requestOptions) {
|
|
2850
|
+
const { ...body } = request ?? {};
|
|
2851
|
+
return this._http.request({
|
|
2852
|
+
method: "POST",
|
|
2853
|
+
path: "/api/v1/email/drafts/query",
|
|
2854
|
+
query: void 0,
|
|
2855
|
+
body,
|
|
2856
|
+
...mergeRequestOptions(requestOptions)
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2394
2859
|
/**
|
|
2395
2860
|
* Get Email Message
|
|
2396
2861
|
*
|
|
@@ -2449,6 +2914,27 @@ var EmailClient = class {
|
|
|
2449
2914
|
...mergeRequestOptions(requestOptions)
|
|
2450
2915
|
});
|
|
2451
2916
|
}
|
|
2917
|
+
/**
|
|
2918
|
+
* Get Email Thread
|
|
2919
|
+
*
|
|
2920
|
+
* Read the Gmail or Outlook conversation for a `threadId` from Search Emails. Each message includes headers, up to 8,000 characters of plain text, and read and draft state.
|
|
2921
|
+
|
|
2922
|
+
### Authorization
|
|
2923
|
+
|
|
2924
|
+
Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.
|
|
2925
|
+
*
|
|
2926
|
+
* `GET /api/v1/email/threads/{threadId}`
|
|
2927
|
+
*/
|
|
2928
|
+
getThread(request, requestOptions) {
|
|
2929
|
+
const { threadId, connectionId, organizationId } = request ?? {};
|
|
2930
|
+
return this._http.request({
|
|
2931
|
+
method: "GET",
|
|
2932
|
+
path: `/api/v1/email/threads/${encodePathParam("threadId", threadId)}`,
|
|
2933
|
+
query: { connectionId, organizationId },
|
|
2934
|
+
body: void 0,
|
|
2935
|
+
...mergeRequestOptions(requestOptions)
|
|
2936
|
+
});
|
|
2937
|
+
}
|
|
2452
2938
|
};
|
|
2453
2939
|
var EvaluateClient = class {
|
|
2454
2940
|
constructor(_http) {
|
|
@@ -4808,12 +5294,29 @@ var ReviewQueueClient = class {
|
|
|
4808
5294
|
...mergeRequestOptions(requestOptions)
|
|
4809
5295
|
});
|
|
4810
5296
|
}
|
|
5297
|
+
/**
|
|
5298
|
+
* Apply Review Queue Corrections
|
|
5299
|
+
*
|
|
5300
|
+
* Requires `catalog:write`. Apply up to 100 item corrections across this job's linked scopes using each workflow's existing proposal validation. editedProposal follows the saved workflow proposal shape returned by items; images select existing candidate IDs. Duplicate item corrections are rejected. Product version and gallery checks remain enforced. Once all scopes commit, saved auto-publish requests continue automatically. Use repair-products for corrections to already approved catalog data.
|
|
5301
|
+
*
|
|
5302
|
+
* `POST /api/v1/review-queue/{batchId}/apply`
|
|
5303
|
+
*/
|
|
5304
|
+
apply(request, requestOptions) {
|
|
5305
|
+
const { batchId, ...body } = request ?? {};
|
|
5306
|
+
return this._http.request({
|
|
5307
|
+
method: "POST",
|
|
5308
|
+
path: `/api/v1/review-queue/${encodePathParam("batchId", batchId)}/apply`,
|
|
5309
|
+
query: void 0,
|
|
5310
|
+
body,
|
|
5311
|
+
...mergeRequestOptions(requestOptions)
|
|
5312
|
+
});
|
|
5313
|
+
}
|
|
4811
5314
|
/**
|
|
4812
5315
|
* Approve Review Queue Items
|
|
4813
5316
|
*
|
|
4814
5317
|
* Requires `catalog:write`.
|
|
4815
5318
|
|
|
4816
|
-
Applies up to 100 explicitly selected review item IDs from the job and its linked batches
|
|
5319
|
+
Applies up to 100 explicitly selected review item IDs from the job and its linked batches through the normal stale-product and gallery checks. Already applied items are safe to resubmit. Saved auto-publish requests continue after approval commits and all scopes for that product are applied. Otherwise use publish explicitly. Approval is not confirmation of marketplace publication.
|
|
4817
5320
|
*
|
|
4818
5321
|
* `POST /api/v1/review-queue/{batchId}/approve`
|
|
4819
5322
|
*/
|
|
@@ -4827,12 +5330,54 @@ var ReviewQueueClient = class {
|
|
|
4827
5330
|
...mergeRequestOptions(requestOptions)
|
|
4828
5331
|
});
|
|
4829
5332
|
}
|
|
5333
|
+
/**
|
|
5334
|
+
* Diagnose Review Product Publishing
|
|
5335
|
+
*
|
|
5336
|
+
* Requires `catalog:read`. Diagnose 1–25 exact review product or physical variant IDs. Returns current canonical shipping measurements (grams and cm), product facts and images, variant values, exact store/category fields, required/missing attributes, allowed options and the latest publish job's message, code and request ID. No raw provider request bodies or credentials are exposed. Store, variant and attribute-option pages have explicit continuation offsets. success means diagnosis completed; publishReady describes saved catalog validation and does not promise marketplace acceptance. Use product.updatedAt unchanged for repairs. Only targets belonging to this organization and review are accessible.
|
|
5337
|
+
*
|
|
5338
|
+
* `POST /api/v1/review-queue/{batchId}/diagnose`
|
|
5339
|
+
*/
|
|
5340
|
+
diagnose(request, requestOptions) {
|
|
5341
|
+
const { batchId, ...body } = request ?? {};
|
|
5342
|
+
return this._http.request({
|
|
5343
|
+
method: "POST",
|
|
5344
|
+
path: `/api/v1/review-queue/${encodePathParam("batchId", batchId)}/diagnose`,
|
|
5345
|
+
query: void 0,
|
|
5346
|
+
body,
|
|
5347
|
+
...mergeRequestOptions(requestOptions)
|
|
5348
|
+
});
|
|
5349
|
+
}
|
|
5350
|
+
/**
|
|
5351
|
+
* List Review Queue Item Details
|
|
5352
|
+
*
|
|
5353
|
+
* Requires `catalog:read`. Pages through saved proposals, issues, current/baseline/applied snapshots and publish receipts across every scope in this review job. Limit 1–50; follow nextOffset until hasMore is false. Repeat productIds to filter up to 50 products. Automation state reports each scope separately; fullyAutomatic describes configuration, not successful approval or publication.
|
|
5354
|
+
*
|
|
5355
|
+
* `GET /api/v1/review-queue/{batchId}/items`
|
|
5356
|
+
*/
|
|
5357
|
+
listItems(request, requestOptions) {
|
|
5358
|
+
const {
|
|
5359
|
+
batchId,
|
|
5360
|
+
organizationId,
|
|
5361
|
+
limit,
|
|
5362
|
+
offset,
|
|
5363
|
+
status,
|
|
5364
|
+
workflow,
|
|
5365
|
+
productIds
|
|
5366
|
+
} = request ?? {};
|
|
5367
|
+
return this._http.request({
|
|
5368
|
+
method: "GET",
|
|
5369
|
+
path: `/api/v1/review-queue/${encodePathParam("batchId", batchId)}/items`,
|
|
5370
|
+
query: { organizationId, limit, offset, status, workflow, productIds },
|
|
5371
|
+
body: void 0,
|
|
5372
|
+
...mergeRequestOptions(requestOptions)
|
|
5373
|
+
});
|
|
5374
|
+
}
|
|
4830
5375
|
/**
|
|
4831
5376
|
* Publish Review Queue Products
|
|
4832
5377
|
*
|
|
4833
5378
|
* Requires `catalog:sync`.
|
|
4834
5379
|
|
|
4835
|
-
Specify productIds and visibility. Only products with all review scopes applied and outstanding releases to assigned marketplace stores are eligible. Optionally filter by marketplaces. Inspect every product and listing result for preparation failures. HTTP 202 confirms queue acceptance. Pass every returned correlation to POST /api/v1/commerce/jobs/await
|
|
5380
|
+
Specify productIds and visibility. Only products with all review scopes applied and outstanding releases to assigned marketplace stores are eligible. Optionally filter by marketplaces and exact storeTargets to publish only repaired or failed stores. Inspect every product and listing result for preparation failures. HTTP 202 confirms queue acceptance. Pass every returned correlation to POST /api/v1/commerce/jobs/await and verify marketplace state before reporting publication.
|
|
4836
5381
|
*
|
|
4837
5382
|
* `POST /api/v1/review-queue/{batchId}/publish`
|
|
4838
5383
|
*/
|
|
@@ -4846,12 +5391,63 @@ var ReviewQueueClient = class {
|
|
|
4846
5391
|
...mergeRequestOptions(requestOptions)
|
|
4847
5392
|
});
|
|
4848
5393
|
}
|
|
5394
|
+
/**
|
|
5395
|
+
* Repair Approved Review Products
|
|
5396
|
+
*
|
|
5397
|
+
* Requires `catalog:write`. Correct 1–25 already approved products with expectedUpdatedAt copied exactly from diagnosis. Patches only supplied weight (grams), complete package dimensions (cm) and exact assigned-store category attributes. Validates keys and fixed-choice values against current marketplace metadata. Records evidence URLs and the initiating actor in review history. Conflicting versions and pending review scopes fail explicitly; correct pending proposals through apply first. Shared category attributes belong to the parent; variant values use the variant API. Does not approve or publish implicitly. Reload diagnosis and publish exact repaired stores after success. Duplicate product corrections are rejected.
|
|
5398
|
+
*
|
|
5399
|
+
* `POST /api/v1/review-queue/{batchId}/repair-products`
|
|
5400
|
+
*/
|
|
5401
|
+
repairProducts(request, requestOptions) {
|
|
5402
|
+
const { batchId, ...body } = request ?? {};
|
|
5403
|
+
return this._http.request({
|
|
5404
|
+
method: "POST",
|
|
5405
|
+
path: `/api/v1/review-queue/${encodePathParam("batchId", batchId)}/repair-products`,
|
|
5406
|
+
query: void 0,
|
|
5407
|
+
body,
|
|
5408
|
+
...mergeRequestOptions(requestOptions)
|
|
5409
|
+
});
|
|
5410
|
+
}
|
|
5411
|
+
/**
|
|
5412
|
+
* Retry Review Queue Processing
|
|
5413
|
+
*
|
|
5414
|
+
* Requires `catalog:write`. Explicitly restart existing durable review processing. scope defaults to failed; unfinished also includes unapplied work; all may regenerate applied proposals. Optionally restrict workflow and use a supported review model. No polling schedule is created. Read items to observe processing; this does not confirm publication.
|
|
5415
|
+
*
|
|
5416
|
+
* `POST /api/v1/review-queue/{batchId}/retry`
|
|
5417
|
+
*/
|
|
5418
|
+
retry(request, requestOptions) {
|
|
5419
|
+
const { batchId, ...body } = request ?? {};
|
|
5420
|
+
return this._http.request({
|
|
5421
|
+
method: "POST",
|
|
5422
|
+
path: `/api/v1/review-queue/${encodePathParam("batchId", batchId)}/retry`,
|
|
5423
|
+
query: void 0,
|
|
5424
|
+
body,
|
|
5425
|
+
...mergeRequestOptions(requestOptions)
|
|
5426
|
+
});
|
|
5427
|
+
}
|
|
5428
|
+
/**
|
|
5429
|
+
* Enable Review Queue Automation
|
|
5430
|
+
*
|
|
5431
|
+
* Requires both `catalog:write` and `catalog:sync`. Enable auto approval for enrichment, taxonomy and images plus saved auto-publish requests on 1–100 existing root review jobs, through the same durable worker as the app. Applies eligible proposals and continues publishing after all scopes commit. Blocked or unverified facts remain visible for the bot to diagnose and correct. Read items.automation for per-scope configuration and publishing for actual outcomes. Inspect every batch result; acceptance does not mean the job is already fully automatic or published.
|
|
5432
|
+
*
|
|
5433
|
+
* `POST /api/v1/review-queue/automation`
|
|
5434
|
+
*/
|
|
5435
|
+
enableAutomation(request, requestOptions) {
|
|
5436
|
+
const { ...body } = request ?? {};
|
|
5437
|
+
return this._http.request({
|
|
5438
|
+
method: "POST",
|
|
5439
|
+
path: "/api/v1/review-queue/automation",
|
|
5440
|
+
query: void 0,
|
|
5441
|
+
body,
|
|
5442
|
+
...mergeRequestOptions(requestOptions)
|
|
5443
|
+
});
|
|
5444
|
+
}
|
|
4849
5445
|
/**
|
|
4850
5446
|
* Get Review Queue Settings
|
|
4851
5447
|
*
|
|
4852
5448
|
* Requires catalog:review-settings for bearer credentials and company settings read permission for delegated users.
|
|
4853
5449
|
|
|
4854
|
-
Returns the organization
|
|
5450
|
+
Returns the organization auto-apply switch and enrichment/taxonomy confidence defaults.
|
|
4855
5451
|
*
|
|
4856
5452
|
* `GET /api/v1/review-queue/settings`
|
|
4857
5453
|
*/
|
|
@@ -4870,7 +5466,7 @@ var ReviewQueueClient = class {
|
|
|
4870
5466
|
*
|
|
4871
5467
|
* Requires catalog:review-settings for bearer credentials and company settings write permission for delegated users.
|
|
4872
5468
|
|
|
4873
|
-
|
|
5469
|
+
Set autoApplyHighConfidence and/or confidence thresholds from 0.50 to 1.00. Existing review jobs retain their saved settings.
|
|
4874
5470
|
*
|
|
4875
5471
|
* `PATCH /api/v1/review-queue/settings`
|
|
4876
5472
|
*/
|
|
@@ -5858,10 +6454,12 @@ var ZaloraClient = class {
|
|
|
5858
6454
|
var OmniGeneratedClient = class {
|
|
5859
6455
|
constructor(_http) {
|
|
5860
6456
|
__publicField(this, "_http", _http);
|
|
6457
|
+
__publicField(this, "ads");
|
|
5861
6458
|
__publicField(this, "agents");
|
|
5862
6459
|
__publicField(this, "analytics");
|
|
5863
6460
|
__publicField(this, "aop");
|
|
5864
6461
|
__publicField(this, "api");
|
|
6462
|
+
__publicField(this, "bots");
|
|
5865
6463
|
__publicField(this, "brandKits");
|
|
5866
6464
|
__publicField(this, "brandsgateway");
|
|
5867
6465
|
__publicField(this, "bulk");
|
|
@@ -5903,10 +6501,12 @@ var OmniGeneratedClient = class {
|
|
|
5903
6501
|
__publicField(this, "webhooks");
|
|
5904
6502
|
__publicField(this, "wiki");
|
|
5905
6503
|
__publicField(this, "zalora");
|
|
6504
|
+
this.ads = new AdsClient(this._http);
|
|
5906
6505
|
this.agents = new AgentsClient(this._http);
|
|
5907
6506
|
this.analytics = new AnalyticsClient(this._http);
|
|
5908
6507
|
this.aop = new AopClient(this._http);
|
|
5909
6508
|
this.api = new ApiClient(this._http);
|
|
6509
|
+
this.bots = new BotsClient(this._http);
|
|
5910
6510
|
this.brandKits = new BrandKitsClient(this._http);
|
|
5911
6511
|
this.brandsgateway = new BrandsgatewayClient(this._http);
|
|
5912
6512
|
this.bulk = new BulkClient(this._http);
|
|
@@ -5961,6 +6561,211 @@ var OmniClient = class extends OmniGeneratedClient {
|
|
|
5961
6561
|
}
|
|
5962
6562
|
};
|
|
5963
6563
|
|
|
6564
|
+
// src/catalog-file.ts
|
|
6565
|
+
var partSize = 8 * 1024 * 1024;
|
|
6566
|
+
var maxFileSize = 512 * 1024 * 1024;
|
|
6567
|
+
var parallelParts = 4;
|
|
6568
|
+
async function submitCatalogFile(client, request, file, options) {
|
|
6569
|
+
if (!file.size || file.size > maxFileSize)
|
|
6570
|
+
throw new Error("Provide a catalog file between 1 byte and 512 MiB.");
|
|
6571
|
+
if (!options?.digest && !globalThis.crypto?.subtle)
|
|
6572
|
+
throw new Error(
|
|
6573
|
+
"Catalog file uploads require Web Crypto or a SHA-256 digest implementation."
|
|
6574
|
+
);
|
|
6575
|
+
const chunk = (index) => file.slice(index * partSize, (index + 1) * partSize);
|
|
6576
|
+
const hashes = [];
|
|
6577
|
+
const digest = options?.digest ?? ((bytes) => globalThis.crypto.subtle.digest("SHA-256", bytes));
|
|
6578
|
+
const api = options?.signal ? { ...options.api, abortSignal: options.signal } : options?.api;
|
|
6579
|
+
const base64 = (bytes) => btoa(String.fromCharCode(...bytes));
|
|
6580
|
+
const count = Math.ceil(file.size / partSize);
|
|
6581
|
+
const combined = new Uint8Array(count * 32);
|
|
6582
|
+
for (let index = 0; index < count; index++) {
|
|
6583
|
+
options?.signal?.throwIfAborted();
|
|
6584
|
+
const hash = new Uint8Array(
|
|
6585
|
+
await digest(await (await chunk(index)).arrayBuffer())
|
|
6586
|
+
);
|
|
6587
|
+
hashes.push(hash);
|
|
6588
|
+
combined.set(hash, index * 32);
|
|
6589
|
+
}
|
|
6590
|
+
const {
|
|
6591
|
+
organizationId,
|
|
6592
|
+
idempotencyKey,
|
|
6593
|
+
format,
|
|
6594
|
+
title,
|
|
6595
|
+
sessionId,
|
|
6596
|
+
columnMapping,
|
|
6597
|
+
update,
|
|
6598
|
+
syncToMarketplaces
|
|
6599
|
+
} = request;
|
|
6600
|
+
const { data: plan } = await client.bulk.plan(
|
|
6601
|
+
{
|
|
6602
|
+
organizationId,
|
|
6603
|
+
idempotencyKey,
|
|
6604
|
+
sessionId,
|
|
6605
|
+
syncToMarketplaces,
|
|
6606
|
+
importRecords: {
|
|
6607
|
+
title,
|
|
6608
|
+
update,
|
|
6609
|
+
file: {
|
|
6610
|
+
sizeBytes: file.size,
|
|
6611
|
+
format,
|
|
6612
|
+
columnMapping,
|
|
6613
|
+
sha256: base64(new Uint8Array(await digest(combined)))
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
},
|
|
6617
|
+
api
|
|
6618
|
+
);
|
|
6619
|
+
if (!plan?.operationId)
|
|
6620
|
+
throw new Error("The server did not return a catalog operation ID.");
|
|
6621
|
+
const target = { organizationId, operationId: plan.operationId };
|
|
6622
|
+
for (let start = 0; start < count; start += parallelParts) {
|
|
6623
|
+
options?.signal?.throwIfAborted();
|
|
6624
|
+
const parts = hashes.slice(start, start + parallelParts).map((hash, index) => ({
|
|
6625
|
+
partNumber: start + index + 1,
|
|
6626
|
+
sha256: base64(hash)
|
|
6627
|
+
}));
|
|
6628
|
+
const { data } = await client.bulk.fileParts({ ...target, parts }, api);
|
|
6629
|
+
if (!data || data.partSizeBytes !== partSize)
|
|
6630
|
+
throw new Error("Invalid catalog upload response.");
|
|
6631
|
+
if (data.accepted) break;
|
|
6632
|
+
if (data.parts.length !== parts.length)
|
|
6633
|
+
throw new Error("The upload response omitted file parts.");
|
|
6634
|
+
const results = await Promise.allSettled(
|
|
6635
|
+
data.parts.map(async (part, index) => {
|
|
6636
|
+
const expected = parts[index];
|
|
6637
|
+
const size = Math.min(
|
|
6638
|
+
partSize,
|
|
6639
|
+
file.size - (expected.partNumber - 1) * partSize
|
|
6640
|
+
);
|
|
6641
|
+
if (part.partNumber !== expected.partNumber || part.sizeBytes !== size)
|
|
6642
|
+
throw new Error("The upload response changed a file part.");
|
|
6643
|
+
if (part.uploaded) return;
|
|
6644
|
+
if (!part.uploadUrl || new URL(part.uploadUrl).protocol !== "https:")
|
|
6645
|
+
throw new Error("The server did not return a secure upload URL.");
|
|
6646
|
+
const body = await chunk(expected.partNumber - 1);
|
|
6647
|
+
if (body.size !== size)
|
|
6648
|
+
throw new Error("The catalog file changed during upload.");
|
|
6649
|
+
const response = await (options?.fetch ?? fetch)(part.uploadUrl, {
|
|
6650
|
+
method: "PUT",
|
|
6651
|
+
body,
|
|
6652
|
+
headers: { "x-amz-checksum-sha256": expected.sha256 },
|
|
6653
|
+
credentials: "omit",
|
|
6654
|
+
redirect: "error",
|
|
6655
|
+
signal: options?.signal
|
|
6656
|
+
});
|
|
6657
|
+
if (!response.ok)
|
|
6658
|
+
throw new Error(
|
|
6659
|
+
`Upload part ${expected.partNumber} returned HTTP ${response.status}. Reuse the same file and key to resume.`
|
|
6660
|
+
);
|
|
6661
|
+
})
|
|
6662
|
+
);
|
|
6663
|
+
for (const result of results)
|
|
6664
|
+
if (result.status === "rejected") throw result.reason;
|
|
6665
|
+
}
|
|
6666
|
+
return client.bulk.completeFile(target, api);
|
|
6667
|
+
}
|
|
6668
|
+
async function* readCatalogFileFailures(client, request, options) {
|
|
6669
|
+
const { organizationId } = request;
|
|
6670
|
+
const operationId = request.operationId.trim().toLowerCase();
|
|
6671
|
+
let after;
|
|
6672
|
+
for (; ; ) {
|
|
6673
|
+
const { data } = await client.bulk.results(
|
|
6674
|
+
{
|
|
6675
|
+
operationIds: [operationId],
|
|
6676
|
+
organizationId,
|
|
6677
|
+
after,
|
|
6678
|
+
status: "failed",
|
|
6679
|
+
limit: 100,
|
|
6680
|
+
includeRequest: false
|
|
6681
|
+
},
|
|
6682
|
+
options
|
|
6683
|
+
);
|
|
6684
|
+
if (!data)
|
|
6685
|
+
throw new Error("The server did not return catalog file results.");
|
|
6686
|
+
yield* data.results;
|
|
6687
|
+
if (!data.hasMore) return;
|
|
6688
|
+
if (!data.nextPageKey || data.nextPageKey.operationId !== operationId || after && data.nextPageKey.ordinal <= after.ordinal)
|
|
6689
|
+
throw new Error(
|
|
6690
|
+
"The server did not advance the catalog file results cursor."
|
|
6691
|
+
);
|
|
6692
|
+
after = data.nextPageKey;
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
|
|
6696
|
+
// src/catalog-pricing.ts
|
|
6697
|
+
var CHUNK_SIZE = 500;
|
|
6698
|
+
var CHUNK_BYTES = 7 * 1024 * 1024;
|
|
6699
|
+
async function submitCatalogTargets(client, request, source, appendBody, identity, options) {
|
|
6700
|
+
const { organizationId } = request;
|
|
6701
|
+
const { data: plan } = await client.bulk.plan(request, options);
|
|
6702
|
+
if (!plan?.operationId)
|
|
6703
|
+
throw new Error("The server did not return a catalog plan ID.");
|
|
6704
|
+
const { operationId } = plan;
|
|
6705
|
+
const encoder2 = new TextEncoder();
|
|
6706
|
+
let chunk = [];
|
|
6707
|
+
let chunkSize = 0;
|
|
6708
|
+
let chunkIndex = 0;
|
|
6709
|
+
let expectedProductCount = 0;
|
|
6710
|
+
const append = async () => {
|
|
6711
|
+
await client.bulk.append(
|
|
6712
|
+
{ organizationId, operationId, chunkIndex, ...appendBody(chunk) },
|
|
6713
|
+
options
|
|
6714
|
+
);
|
|
6715
|
+
expectedProductCount += new Set(chunk.map(identity)).size;
|
|
6716
|
+
chunkIndex += 1;
|
|
6717
|
+
chunk = [];
|
|
6718
|
+
chunkSize = 0;
|
|
6719
|
+
};
|
|
6720
|
+
for await (const item of source) {
|
|
6721
|
+
const bytes = encoder2.encode(JSON.stringify(item)).byteLength + 1;
|
|
6722
|
+
if (bytes > CHUNK_BYTES)
|
|
6723
|
+
throw new Error("A catalog target exceeds the request size limit.");
|
|
6724
|
+
if (chunk.length && (chunk.length === CHUNK_SIZE || chunkSize + bytes > CHUNK_BYTES))
|
|
6725
|
+
await append();
|
|
6726
|
+
chunk.push(item);
|
|
6727
|
+
chunkSize += bytes;
|
|
6728
|
+
if (chunk.length === CHUNK_SIZE) await append();
|
|
6729
|
+
}
|
|
6730
|
+
if (chunk.length) await append();
|
|
6731
|
+
if (!expectedProductCount)
|
|
6732
|
+
throw new Error("Provide at least one catalog target.");
|
|
6733
|
+
return client.bulk.submit(
|
|
6734
|
+
{ organizationId, operationId, expectedProductCount },
|
|
6735
|
+
options
|
|
6736
|
+
);
|
|
6737
|
+
}
|
|
6738
|
+
function submitCatalogPricing(client, request, updates, options) {
|
|
6739
|
+
return submitCatalogTargets(
|
|
6740
|
+
client,
|
|
6741
|
+
request,
|
|
6742
|
+
updates,
|
|
6743
|
+
(rows) => ({ updates: rows }),
|
|
6744
|
+
({ productId }) => productId.trim().toLowerCase(),
|
|
6745
|
+
options
|
|
6746
|
+
);
|
|
6747
|
+
}
|
|
6748
|
+
function submitCatalogRecords(client, request, products, options) {
|
|
6749
|
+
return submitCatalogTargets(
|
|
6750
|
+
client,
|
|
6751
|
+
{ ...request, importRecords: request.importRecords ?? {} },
|
|
6752
|
+
products,
|
|
6753
|
+
(rows) => ({ products: rows }),
|
|
6754
|
+
({ sku }) => sku.trim(),
|
|
6755
|
+
options
|
|
6756
|
+
);
|
|
6757
|
+
}
|
|
6758
|
+
function submitCatalogEnrichment(client, request, productIds, options) {
|
|
6759
|
+
return submitCatalogTargets(
|
|
6760
|
+
client,
|
|
6761
|
+
request,
|
|
6762
|
+
productIds,
|
|
6763
|
+
(rows) => ({ productIds: rows }),
|
|
6764
|
+
(id) => id.trim().toLowerCase(),
|
|
6765
|
+
options
|
|
6766
|
+
);
|
|
6767
|
+
}
|
|
6768
|
+
|
|
5964
6769
|
// src/webhooks.ts
|
|
5965
6770
|
var encoder = new TextEncoder();
|
|
5966
6771
|
var WEBHOOK_SIGNATURE_HEADER = "x-omni-signature";
|
|
@@ -6060,6 +6865,6 @@ __export(api_exports, {
|
|
|
6060
6865
|
OmniGeneratedClient: () => OmniGeneratedClient
|
|
6061
6866
|
});
|
|
6062
6867
|
|
|
6063
|
-
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 };
|
|
6868
|
+
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, readCatalogFileFailures, signWebhookPayload, submitCatalogEnrichment, submitCatalogFile, submitCatalogPricing, submitCatalogRecords, verifyWebhookSignature };
|
|
6064
6869
|
//# sourceMappingURL=index.js.map
|
|
6065
6870
|
//# sourceMappingURL=index.js.map
|