@spscommerce/asst-api 0.0.1-beta.1 → 0.0.1-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ItemCategoriesSearch-44b87663.d.ts +318 -0
- package/dist/ItemCategoriesSearch-e0870a34.d.ts +318 -0
- package/dist/ItemCategoriesSearch-e3298650.d.ts +319 -0
- package/dist/ItemCategoriesSearch-ec43591f.d.ts +319 -0
- package/dist/ItemCategory-14816deb.d.ts +99 -0
- package/dist/ItemErrorDetails-0eed9761.d.ts +3200 -0
- package/dist/ItemErrorDetails-1614b511.d.ts +3137 -0
- package/dist/ItemErrorDetails-1bd2821e.d.ts +3137 -0
- package/dist/ItemErrorDetails-b2c79d10.d.ts +3197 -0
- package/dist/ItemErrorDetails-ba155b70.d.ts +3269 -0
- package/dist/ItemErrorDetails-bc465036.d.ts +3200 -0
- package/dist/ItemErrorDetails-e6e400aa.d.ts +3197 -0
- package/dist/ItemErrorDetailsResult-0b4a628c.d.ts +3032 -0
- package/dist/ItemErrorDetailsResult-8317ab6e.d.ts +3092 -0
- package/dist/ItemErrorDetailsResult-859368da.d.ts +3032 -0
- package/dist/ItemErrorDetailsResult-9ac97c24.d.ts +3032 -0
- package/dist/ItemErrorDetailsResult-ae90f329.d.ts +3097 -0
- package/dist/ItemErrorDetailsResult-c12c4eac.d.ts +3032 -0
- package/dist/ItemErrorDetailsResult-c62caeae.d.ts +3092 -0
- package/dist/ItemErrorDetailsResult-fbc33a43.d.ts +3097 -0
- package/dist/ItemStatusResponse-7f871d5a.d.ts +91 -0
- package/dist/TradingPartnerAccessByCompanyId-29866586.d.ts +97 -0
- package/dist/TradingPartnerAccessByCompanyId-43f83fb6.d.ts +130 -0
- package/dist/TradingPartnerAccessByCompanyId-53b868a8.d.ts +125 -0
- package/dist/TradingPartnerAccessByCompanyId-b227f0c5.d.ts +125 -0
- package/dist/TradingPartnerAccessByCompanyId-e7a1d443.d.ts +129 -0
- package/dist/chunk-3CJG5LDN.js +360 -0
- package/dist/chunk-3FMMM7IS.js +80 -0
- package/dist/chunk-3JRE7YYE.js +4576 -0
- package/dist/chunk-4HWZ3JEH.js +328 -0
- package/dist/chunk-4WER3ZLX.js +4576 -0
- package/dist/chunk-5YWAQNT6.js +4634 -0
- package/dist/chunk-6ZNFOWTV.js +78 -0
- package/dist/chunk-CB3PVPHS.js +344 -0
- package/dist/chunk-ETURPA7W.js +326 -0
- package/dist/chunk-F3KCLICG.js +77 -0
- package/dist/chunk-FS6LHGAR.js +87 -0
- package/dist/chunk-G36FM5OA.js +327 -0
- package/dist/chunk-GDFX3WTX.js +78 -0
- package/dist/chunk-GSUSBCHT.js +4576 -0
- package/dist/chunk-IHIEBLQV.js +4576 -0
- package/dist/chunk-ITWMRXLD.js +328 -0
- package/dist/chunk-J3A66IGS.js +389 -0
- package/dist/chunk-LYMGZWSR.js +80 -0
- package/dist/chunk-N2OYWNHF.js +80 -0
- package/dist/chunk-OA6PO3QG.js +78 -0
- package/dist/chunk-OBXZRDPY.js +77 -0
- package/dist/chunk-OI47EFQH.js +82 -0
- package/dist/chunk-OVOZIZA2.js +326 -0
- package/dist/chunk-RRGAJ4ZS.js +4576 -0
- package/dist/chunk-T3UCSW2B.js +81 -0
- package/dist/chunk-VNFU2PUV.js +4577 -0
- package/dist/chunk-WN2FPUF3.js +4577 -0
- package/dist/chunk-XMNYZGXF.js +84 -0
- package/dist/chunk-YCQUK6KV.js +85 -0
- package/dist/index.cjs +1001 -84
- package/dist/index.d.ts +197 -46
- package/dist/index.js +23 -56
- package/dist/msw.cjs +1056 -65
- package/dist/msw.d.ts +638 -76
- package/dist/msw.js +317 -54
- package/dist/zod.cjs +812 -17
- package/dist/zod.d.ts +4 -2
- package/dist/zod.js +112 -52
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -32,65 +32,24 @@ var lib_exports = {};
|
|
|
32
32
|
__export(lib_exports, {
|
|
33
33
|
AsstClient: () => AsstClient,
|
|
34
34
|
BASE_URLS: () => BASE_URLS,
|
|
35
|
+
createAttributesApi: () => createAttributesApi,
|
|
35
36
|
createCategoriesApi: () => createCategoriesApi,
|
|
37
|
+
createCompanyFeaturesApi: () => createCompanyFeaturesApi,
|
|
38
|
+
createErrorsApi: () => createErrorsApi,
|
|
36
39
|
createExportsApi: () => createExportsApi,
|
|
40
|
+
createFeatureFlagsApi: () => createFeatureFlagsApi,
|
|
37
41
|
createImportsApi: () => createImportsApi,
|
|
42
|
+
createItemsApi: () => createItemsApi,
|
|
43
|
+
createLocaleApi: () => createLocaleApi,
|
|
38
44
|
createProductTypesApi: () => createProductTypesApi,
|
|
39
|
-
|
|
45
|
+
createSpreadsheetTemplateApi: () => createSpreadsheetTemplateApi,
|
|
46
|
+
createTradingPartnerAccessApi: () => createTradingPartnerAccessApi,
|
|
47
|
+
createWhoAmIApi: () => createWhoAmIApi
|
|
40
48
|
});
|
|
41
49
|
module.exports = __toCommonJS(lib_exports);
|
|
42
50
|
|
|
43
51
|
// lib/asstClient.ts
|
|
44
52
|
var import_ky_universal = __toESM(require("ky-universal"), 1);
|
|
45
|
-
var BASE_URLS = {
|
|
46
|
-
local: "https://localhost:8443",
|
|
47
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway",
|
|
48
|
-
prod: "https://api.spscommerce.com/assortment/gateway"
|
|
49
|
-
};
|
|
50
|
-
var AsstClient = class {
|
|
51
|
-
#client = import_ky_universal.default.create({
|
|
52
|
-
prefixUrl: BASE_URLS["test"],
|
|
53
|
-
retry: 0
|
|
54
|
-
});
|
|
55
|
-
#baseUrl = BASE_URLS["test"];
|
|
56
|
-
#subscriptionCallback;
|
|
57
|
-
constructor(options) {
|
|
58
|
-
this.updateConfig(options);
|
|
59
|
-
}
|
|
60
|
-
updateConfig(options) {
|
|
61
|
-
this.#client = this.#client.extend(options);
|
|
62
|
-
if (options.prefixUrl) {
|
|
63
|
-
this.#baseUrl = options.prefixUrl;
|
|
64
|
-
}
|
|
65
|
-
if (this.#subscriptionCallback) {
|
|
66
|
-
this.#subscriptionCallback(options);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
getBaseUrl() {
|
|
70
|
-
return this.#baseUrl;
|
|
71
|
-
}
|
|
72
|
-
subscribeToConfigChange(subscriptionCallback) {
|
|
73
|
-
this.#subscriptionCallback = subscriptionCallback;
|
|
74
|
-
}
|
|
75
|
-
get(url, options) {
|
|
76
|
-
return this.#client.get(url, options);
|
|
77
|
-
}
|
|
78
|
-
post(url, options) {
|
|
79
|
-
return this.#client.post(url, options);
|
|
80
|
-
}
|
|
81
|
-
put(url, options) {
|
|
82
|
-
return this.#client.put(url, options);
|
|
83
|
-
}
|
|
84
|
-
patch(url, options) {
|
|
85
|
-
return this.#client.patch(url, options);
|
|
86
|
-
}
|
|
87
|
-
head(url, options) {
|
|
88
|
-
return this.#client.head(url, options);
|
|
89
|
-
}
|
|
90
|
-
delete(url, options) {
|
|
91
|
-
return this.#client.delete(url, options);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
53
|
|
|
95
54
|
// ../../node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.mjs
|
|
96
55
|
var util;
|
|
@@ -3774,13 +3733,80 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3774
3733
|
ZodError
|
|
3775
3734
|
});
|
|
3776
3735
|
|
|
3736
|
+
// lib/asstClient.ts
|
|
3737
|
+
var baseUrlsSchema = z.object({
|
|
3738
|
+
local: z.literal("https://localhost:8443"),
|
|
3739
|
+
test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
|
|
3740
|
+
prod: z.literal("https://api.spscommerce.com/assortment/gateway")
|
|
3741
|
+
});
|
|
3742
|
+
var BASE_URLS = {
|
|
3743
|
+
local: "https://localhost:8443",
|
|
3744
|
+
test: "https://integration.api.spscommerce.com/assortment/gateway",
|
|
3745
|
+
prod: "https://api.spscommerce.com/assortment/gateway"
|
|
3746
|
+
};
|
|
3747
|
+
var envSchema = baseUrlsSchema.keyof();
|
|
3748
|
+
var initialConfig = {
|
|
3749
|
+
prefixUrl: BASE_URLS["test"],
|
|
3750
|
+
retry: 0
|
|
3751
|
+
};
|
|
3752
|
+
var AsstClient = class {
|
|
3753
|
+
#client = import_ky_universal.default.create(initialConfig);
|
|
3754
|
+
#baseUrl = BASE_URLS["test"];
|
|
3755
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
3756
|
+
#currentConfig = initialConfig;
|
|
3757
|
+
constructor(options) {
|
|
3758
|
+
if (options) {
|
|
3759
|
+
this.updateConfig(options);
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
updateConfig(options) {
|
|
3763
|
+
this.#client = this.#client.extend(options);
|
|
3764
|
+
this.#currentConfig = options;
|
|
3765
|
+
if (options.prefixUrl) {
|
|
3766
|
+
this.#baseUrl = options.prefixUrl;
|
|
3767
|
+
}
|
|
3768
|
+
this.#listeners.forEach((listener) => listener(options));
|
|
3769
|
+
}
|
|
3770
|
+
getBaseUrl() {
|
|
3771
|
+
return this.#baseUrl;
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
3775
|
+
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
3776
|
+
* @returns Function to unsubscribe to config changes
|
|
3777
|
+
*/
|
|
3778
|
+
subscribeToConfigChange(listener) {
|
|
3779
|
+
this.#listeners.add(listener);
|
|
3780
|
+
listener(this.#currentConfig);
|
|
3781
|
+
return () => this.#listeners.delete(listener);
|
|
3782
|
+
}
|
|
3783
|
+
get(url, options) {
|
|
3784
|
+
return this.#client.get(url, options);
|
|
3785
|
+
}
|
|
3786
|
+
post(url, options) {
|
|
3787
|
+
return this.#client.post(url, options);
|
|
3788
|
+
}
|
|
3789
|
+
put(url, options) {
|
|
3790
|
+
return this.#client.put(url, options);
|
|
3791
|
+
}
|
|
3792
|
+
patch(url, options) {
|
|
3793
|
+
return this.#client.patch(url, options);
|
|
3794
|
+
}
|
|
3795
|
+
head(url, options) {
|
|
3796
|
+
return this.#client.head(url, options);
|
|
3797
|
+
}
|
|
3798
|
+
delete(url, options) {
|
|
3799
|
+
return this.#client.delete(url, options);
|
|
3800
|
+
}
|
|
3801
|
+
};
|
|
3802
|
+
|
|
3777
3803
|
// lib/imports/models/ImportDetail.ts
|
|
3778
3804
|
var importDetailSchema = z.object({
|
|
3779
|
-
completedAt: z.
|
|
3805
|
+
completedAt: z.number().nullish(),
|
|
3780
3806
|
errorCount: z.number(),
|
|
3781
3807
|
importId: z.number(),
|
|
3782
3808
|
name: z.string(),
|
|
3783
|
-
startedAt: z.
|
|
3809
|
+
startedAt: z.string().nullish(),
|
|
3784
3810
|
status: z.string(),
|
|
3785
3811
|
uploadedAt: z.string()
|
|
3786
3812
|
});
|
|
@@ -3793,7 +3819,7 @@ var importSchema = z.object({
|
|
|
3793
3819
|
|
|
3794
3820
|
// lib/imports/models/ImportError.ts
|
|
3795
3821
|
var importErrorSchema = z.object({
|
|
3796
|
-
attribute: z.string(),
|
|
3822
|
+
attribute: z.string().nullish(),
|
|
3797
3823
|
description: z.string(),
|
|
3798
3824
|
importErrorId: z.number(),
|
|
3799
3825
|
row: z.number()
|
|
@@ -3819,15 +3845,15 @@ var importStatusEnumSchema = z.enum([
|
|
|
3819
3845
|
|
|
3820
3846
|
// lib/imports/models/ImportsStatus.ts
|
|
3821
3847
|
var importsStatusSchema = z.object({
|
|
3822
|
-
completedAt: z.
|
|
3823
|
-
docInEventId: z.
|
|
3824
|
-
errorCount: z.
|
|
3848
|
+
completedAt: z.string().nullish(),
|
|
3849
|
+
docInEventId: z.string().nullish(),
|
|
3850
|
+
errorCount: z.number().nullish(),
|
|
3825
3851
|
importId: z.number(),
|
|
3826
|
-
invalidItemCount: z.
|
|
3827
|
-
name: z.string(),
|
|
3852
|
+
invalidItemCount: z.number().nullish(),
|
|
3853
|
+
name: z.string().nullish(),
|
|
3828
3854
|
status: importStatusEnumSchema,
|
|
3829
|
-
totalItemCount: z.
|
|
3830
|
-
validItemCount: z.
|
|
3855
|
+
totalItemCount: z.number().nullish(),
|
|
3856
|
+
validItemCount: z.number().nullish()
|
|
3831
3857
|
});
|
|
3832
3858
|
|
|
3833
3859
|
// lib/imports/models/VendorPartnerAttGroups.ts
|
|
@@ -3847,7 +3873,6 @@ var generateImportTemplateParamsSchema = z.object({
|
|
|
3847
3873
|
});
|
|
3848
3874
|
|
|
3849
3875
|
// lib/imports/index.ts
|
|
3850
|
-
var import_query_string = __toESM(require("query-string"), 1);
|
|
3851
3876
|
var BASE_URL = "imports";
|
|
3852
3877
|
function createImportsApi(client) {
|
|
3853
3878
|
async function getImportErrors(importId, params, signal) {
|
|
@@ -3873,15 +3898,12 @@ function createImportsApi(client) {
|
|
|
3873
3898
|
return z.array(vendorPartnerAttGroupsSchema).parse(data);
|
|
3874
3899
|
}
|
|
3875
3900
|
async function generateImportTemplate(params) {
|
|
3876
|
-
const searchParams = params ? import_query_string.default.stringify(params, {
|
|
3877
|
-
arrayFormat: "comma",
|
|
3878
|
-
skipEmptyString: true
|
|
3879
|
-
}) : void 0;
|
|
3880
3901
|
const response = await client.get(`${BASE_URL}/template/generate`, {
|
|
3881
|
-
searchParams,
|
|
3902
|
+
searchParams: params,
|
|
3882
3903
|
headers: {
|
|
3883
3904
|
Accept: "application/octet-stream"
|
|
3884
|
-
}
|
|
3905
|
+
},
|
|
3906
|
+
timeout: false
|
|
3885
3907
|
});
|
|
3886
3908
|
const disposition = response.headers.get("content-disposition") || "";
|
|
3887
3909
|
const filename = disposition.match(/filename="(.+)"/)?.[1];
|
|
@@ -3908,13 +3930,38 @@ function createImportsApi(client) {
|
|
|
3908
3930
|
}
|
|
3909
3931
|
|
|
3910
3932
|
// lib/exports/index.ts
|
|
3911
|
-
var BASE_URL2 = "
|
|
3933
|
+
var BASE_URL2 = "exports";
|
|
3934
|
+
var BASE_URL_V2 = "v2/exports";
|
|
3912
3935
|
function createExportsApi(client) {
|
|
3913
3936
|
async function createExport(data) {
|
|
3914
|
-
await client.post(`${
|
|
3937
|
+
await client.post(`${BASE_URL_V2}/add`, { json: data });
|
|
3938
|
+
}
|
|
3939
|
+
async function downloadItems(params) {
|
|
3940
|
+
const searchParams = { ...params, ids: params.ids.join(",") };
|
|
3941
|
+
const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
|
|
3942
|
+
searchParams,
|
|
3943
|
+
headers: {
|
|
3944
|
+
Accept: "application/octet-stream"
|
|
3945
|
+
},
|
|
3946
|
+
timeout: false
|
|
3947
|
+
});
|
|
3948
|
+
const disposition = response.headers.get("content-disposition") || "";
|
|
3949
|
+
const filename = disposition.match(/filename="(.+)"/)?.[1];
|
|
3950
|
+
const downloadUrl = window.URL.createObjectURL(
|
|
3951
|
+
new Blob([await response.blob()])
|
|
3952
|
+
);
|
|
3953
|
+
const link = document.createElement("a");
|
|
3954
|
+
link.href = downloadUrl;
|
|
3955
|
+
if (filename) {
|
|
3956
|
+
link.download = filename;
|
|
3957
|
+
}
|
|
3958
|
+
document.body.appendChild(link);
|
|
3959
|
+
link.click();
|
|
3960
|
+
link.remove();
|
|
3915
3961
|
}
|
|
3916
3962
|
return {
|
|
3917
|
-
createExport
|
|
3963
|
+
createExport,
|
|
3964
|
+
downloadItems
|
|
3918
3965
|
};
|
|
3919
3966
|
}
|
|
3920
3967
|
|
|
@@ -3931,11 +3978,10 @@ var attrProdTypeSchema = z.object({
|
|
|
3931
3978
|
});
|
|
3932
3979
|
|
|
3933
3980
|
// lib/productTypes/index.ts
|
|
3934
|
-
var import_query_string2 = __toESM(require("query-string"), 1);
|
|
3935
3981
|
var BASE_URL3 = "product-types";
|
|
3936
3982
|
function createProductTypesApi(client) {
|
|
3937
3983
|
async function getProductTypes(params, signal) {
|
|
3938
|
-
const searchParams = params ?
|
|
3984
|
+
const searchParams = params ? { retailerIds: params.retailerIds.join(",") } : void 0;
|
|
3939
3985
|
const data = await client.get(`${BASE_URL3}/all`, {
|
|
3940
3986
|
searchParams,
|
|
3941
3987
|
signal
|
|
@@ -3950,9 +3996,10 @@ function createProductTypesApi(client) {
|
|
|
3950
3996
|
// lib/tradingPartners/models/Connection.ts
|
|
3951
3997
|
var connectionSchema = z.object({
|
|
3952
3998
|
catalog_id: z.number(),
|
|
3953
|
-
catalog_name: z.string(),
|
|
3999
|
+
catalog_name: z.string().nullable(),
|
|
3954
4000
|
partner_company_name: z.string(),
|
|
3955
|
-
partner_company_id: z.number()
|
|
4001
|
+
partner_company_id: z.number(),
|
|
4002
|
+
partner_org_id: z.string()
|
|
3956
4003
|
});
|
|
3957
4004
|
|
|
3958
4005
|
// lib/tradingPartners/models/TradingPartnerAccessByCompanyId.ts
|
|
@@ -3985,13 +4032,13 @@ var itemCategorySchema = z.object({
|
|
|
3985
4032
|
companyId: z.number(),
|
|
3986
4033
|
name: z.string(),
|
|
3987
4034
|
isActive: z.number(),
|
|
3988
|
-
createdDate: z.
|
|
3989
|
-
categorytimestamp: z.
|
|
4035
|
+
createdDate: z.number().nullish(),
|
|
4036
|
+
categorytimestamp: z.number().nullish(),
|
|
3990
4037
|
typeId: z.number(),
|
|
3991
4038
|
type: z.string(),
|
|
3992
|
-
categorykey: z.
|
|
3993
|
-
description: z.
|
|
3994
|
-
categoryCatalogName: z.
|
|
4039
|
+
categorykey: z.string().nullish(),
|
|
4040
|
+
description: z.string().nullish(),
|
|
4041
|
+
categoryCatalogName: z.string().nullish()
|
|
3995
4042
|
});
|
|
3996
4043
|
|
|
3997
4044
|
// lib/categories/models/ItemCategoriesSearch.ts
|
|
@@ -4000,6 +4047,30 @@ var itemCategoriesSearchSchema = z.object({
|
|
|
4000
4047
|
data: z.array(itemCategorySchema)
|
|
4001
4048
|
});
|
|
4002
4049
|
|
|
4050
|
+
// lib/categories/models/Hierarchy.ts
|
|
4051
|
+
var baseHierarchySchema = z.object({
|
|
4052
|
+
id: z.string(),
|
|
4053
|
+
name: z.string().nullish(),
|
|
4054
|
+
description: z.string().nullish(),
|
|
4055
|
+
type: z.string().nullish()
|
|
4056
|
+
});
|
|
4057
|
+
var hierarchySchema = baseHierarchySchema.extend(
|
|
4058
|
+
{
|
|
4059
|
+
child: z.lazy(() => hierarchySchema).nullable()
|
|
4060
|
+
}
|
|
4061
|
+
);
|
|
4062
|
+
|
|
4063
|
+
// lib/categories/models/ItemHierarchy.ts
|
|
4064
|
+
var itemHierarchySchema = z.object({
|
|
4065
|
+
itemId: z.string(),
|
|
4066
|
+
hierarchies: z.array(hierarchySchema)
|
|
4067
|
+
});
|
|
4068
|
+
|
|
4069
|
+
// lib/categories/models/ItemHierarchyResponse.ts
|
|
4070
|
+
var itemHierarchyResponseSchema = z.object({
|
|
4071
|
+
itemHierarchies: z.array(itemHierarchySchema)
|
|
4072
|
+
});
|
|
4073
|
+
|
|
4003
4074
|
// lib/categories/index.ts
|
|
4004
4075
|
var BASE_URL5 = "categories";
|
|
4005
4076
|
function createCategoriesApi(client) {
|
|
@@ -4011,28 +4082,874 @@ function createCategoriesApi(client) {
|
|
|
4011
4082
|
return itemCategoriesSearchSchema.parse(data);
|
|
4012
4083
|
}
|
|
4013
4084
|
async function getProductCodes(params, signal) {
|
|
4085
|
+
const searchParams = { type: "PRODUCT_CODE" };
|
|
4086
|
+
if (params?.categoryName) {
|
|
4087
|
+
searchParams.categoryName = params.categoryName;
|
|
4088
|
+
}
|
|
4089
|
+
if (params?.catalogId) {
|
|
4090
|
+
searchParams.catalogId = params.catalogId;
|
|
4091
|
+
}
|
|
4092
|
+
if (params?.selectionCodeId) {
|
|
4093
|
+
searchParams.selectionCodeId = params.selectionCodeId;
|
|
4094
|
+
}
|
|
4014
4095
|
const data = await client.get(`${BASE_URL5}/search-category`, {
|
|
4015
|
-
searchParams
|
|
4016
|
-
signal
|
|
4096
|
+
searchParams,
|
|
4097
|
+
signal,
|
|
4098
|
+
timeout: false
|
|
4017
4099
|
}).json();
|
|
4018
4100
|
return itemCategoriesSearchSchema.parse(data);
|
|
4019
4101
|
}
|
|
4020
4102
|
async function getSelectionCodes(params, signal) {
|
|
4103
|
+
const searchParams = { type: "SELECTION_CODE" };
|
|
4104
|
+
if (params?.categoryName) {
|
|
4105
|
+
searchParams.categoryName = params.categoryName;
|
|
4106
|
+
}
|
|
4107
|
+
if (params?.catalogId) {
|
|
4108
|
+
searchParams.catalogId = params.catalogId;
|
|
4109
|
+
}
|
|
4021
4110
|
const data = await client.get(`${BASE_URL5}/search-category`, {
|
|
4022
|
-
searchParams
|
|
4111
|
+
searchParams,
|
|
4023
4112
|
signal
|
|
4024
4113
|
}).json();
|
|
4025
4114
|
return itemCategoriesSearchSchema.parse(data);
|
|
4026
4115
|
}
|
|
4027
|
-
|
|
4116
|
+
async function getItemHierarchy(itemIds) {
|
|
4117
|
+
const data = await client.post(`${BASE_URL5}/item-hierarchy`, { json: { itemIds } }).json();
|
|
4118
|
+
return itemHierarchyResponseSchema.parse(data);
|
|
4119
|
+
}
|
|
4120
|
+
return { getCatalogs, getProductCodes, getSelectionCodes, getItemHierarchy };
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
// lib/attributes/models/AttributeMetaData.ts
|
|
4124
|
+
var attributeMetaDataSchema = z.object({
|
|
4125
|
+
dbName: z.string(),
|
|
4126
|
+
label: z.string(),
|
|
4127
|
+
group: z.string(),
|
|
4128
|
+
aliases: z.array(z.string()),
|
|
4129
|
+
orderBy: z.string().or(z.number()),
|
|
4130
|
+
type: z.string(),
|
|
4131
|
+
storageType: z.string(),
|
|
4132
|
+
rsxPath: z.string(),
|
|
4133
|
+
indexed: z.boolean(),
|
|
4134
|
+
repeatable: z.boolean(),
|
|
4135
|
+
extended: z.boolean(),
|
|
4136
|
+
hybrid: z.boolean(),
|
|
4137
|
+
userVisible: z.boolean(),
|
|
4138
|
+
retailerOwnedId: z.number().nullish()
|
|
4139
|
+
});
|
|
4140
|
+
|
|
4141
|
+
// lib/attributes/models/AttributeSummary.ts
|
|
4142
|
+
var attributeSummarySchema = z.object({
|
|
4143
|
+
attributeId: z.number(),
|
|
4144
|
+
attributeName: z.string(),
|
|
4145
|
+
displayName: z.string(),
|
|
4146
|
+
modifiedBy: z.string(),
|
|
4147
|
+
modifiedDate: z.number(),
|
|
4148
|
+
retailerOwnedId: z.number().nullish(),
|
|
4149
|
+
clusterAttrGroupId: z.number().nullish(),
|
|
4150
|
+
attributeType: z.string()
|
|
4151
|
+
});
|
|
4152
|
+
|
|
4153
|
+
// lib/attributes/models/AttributesByCompany.ts
|
|
4154
|
+
var attributesByCompanySchema = z.object({
|
|
4155
|
+
next: z.string().nullish(),
|
|
4156
|
+
previous: z.string().nullish(),
|
|
4157
|
+
count: z.number(),
|
|
4158
|
+
results: z.array(attributeSummarySchema)
|
|
4159
|
+
});
|
|
4160
|
+
|
|
4161
|
+
// lib/attributes/models/AttrDatatypeNameEnum.ts
|
|
4162
|
+
var attrDatatypeNameEnumSchema = z.enum([
|
|
4163
|
+
"TEXT",
|
|
4164
|
+
"SET",
|
|
4165
|
+
"INTEGER",
|
|
4166
|
+
"FLOAT",
|
|
4167
|
+
"BOOLEAN",
|
|
4168
|
+
"DATE",
|
|
4169
|
+
"KEYVALUE",
|
|
4170
|
+
"STRING",
|
|
4171
|
+
"REAL"
|
|
4172
|
+
]);
|
|
4173
|
+
|
|
4174
|
+
// lib/attributes/models/AttributeGroup.ts
|
|
4175
|
+
var attributeGroupSchema = z.object({
|
|
4176
|
+
attrGroupId: z.number(),
|
|
4177
|
+
attrGroupType: z.object({
|
|
4178
|
+
attrGroupTypeId: z.number(),
|
|
4179
|
+
groupTypeName: z.string(),
|
|
4180
|
+
primary: z.boolean(),
|
|
4181
|
+
restricted: z.boolean()
|
|
4182
|
+
}),
|
|
4183
|
+
attrGroupTypeId: z.number(),
|
|
4184
|
+
groupName: z.string(),
|
|
4185
|
+
isDefault: z.boolean(),
|
|
4186
|
+
orderWeight: z.number(),
|
|
4187
|
+
primary: z.boolean()
|
|
4188
|
+
});
|
|
4189
|
+
|
|
4190
|
+
// lib/attributes/models/AttributeDefinition.ts
|
|
4191
|
+
var parentAttributeSchema = z.object({
|
|
4192
|
+
attrDataTypeId: z.number(),
|
|
4193
|
+
attrDatatype: z.object({
|
|
4194
|
+
attrDatatypeId: z.number(),
|
|
4195
|
+
datatypeName: attrDatatypeNameEnumSchema,
|
|
4196
|
+
displayOnly: z.boolean()
|
|
4197
|
+
}),
|
|
4198
|
+
attrGroupId: z.number(),
|
|
4199
|
+
attrGroups: z.array(attributeGroupSchema),
|
|
4200
|
+
attrRoundId: z.number(),
|
|
4201
|
+
attrStorageId: z.number(),
|
|
4202
|
+
attributeId: z.number(),
|
|
4203
|
+
attributeName: z.string(),
|
|
4204
|
+
createdBy: z.string(),
|
|
4205
|
+
createdDate: z.number(),
|
|
4206
|
+
description: z.string().optional(),
|
|
4207
|
+
displayName: z.string(),
|
|
4208
|
+
modifiedDate: z.number(),
|
|
4209
|
+
orderWeight: z.number(),
|
|
4210
|
+
parentAttributeId: z.number().optional(),
|
|
4211
|
+
primaryAttrGroup: attributeGroupSchema
|
|
4212
|
+
});
|
|
4213
|
+
var attributeDefinitionSchema = z.object({
|
|
4214
|
+
attrDataTypeId: z.number(),
|
|
4215
|
+
attrDatatype: z.object({
|
|
4216
|
+
attrDatatypeId: z.number(),
|
|
4217
|
+
datatypeName: attrDatatypeNameEnumSchema,
|
|
4218
|
+
displayOnly: z.boolean()
|
|
4219
|
+
}),
|
|
4220
|
+
attrGroupId: z.number(),
|
|
4221
|
+
attrGroups: z.array(attributeGroupSchema),
|
|
4222
|
+
attrRestrictions: z.array(
|
|
4223
|
+
z.object({
|
|
4224
|
+
attrRestrictId: z.number(),
|
|
4225
|
+
ignoreGlobal: z.boolean().optional(),
|
|
4226
|
+
isDefault: z.boolean(),
|
|
4227
|
+
isEssential: z.boolean(),
|
|
4228
|
+
locale: z.string(),
|
|
4229
|
+
mandatory: z.boolean(),
|
|
4230
|
+
repeatable: z.boolean(),
|
|
4231
|
+
minLength: z.number().optional(),
|
|
4232
|
+
maxLength: z.number().optional()
|
|
4233
|
+
})
|
|
4234
|
+
).optional(),
|
|
4235
|
+
attrRoundId: z.number(),
|
|
4236
|
+
attrStorage: z.object({
|
|
4237
|
+
attrStorageId: z.number(),
|
|
4238
|
+
storageName: z.string()
|
|
4239
|
+
}),
|
|
4240
|
+
attrStorageId: z.number(),
|
|
4241
|
+
attrValues: z.array(
|
|
4242
|
+
z.object({
|
|
4243
|
+
attrKeyPair: z.string(),
|
|
4244
|
+
attrValueId: z.number().optional(),
|
|
4245
|
+
isDefault: z.boolean(),
|
|
4246
|
+
locale: z.string(),
|
|
4247
|
+
value: z.string()
|
|
4248
|
+
})
|
|
4249
|
+
).optional(),
|
|
4250
|
+
attributeId: z.number(),
|
|
4251
|
+
attributeName: z.string(),
|
|
4252
|
+
createdBy: z.string(),
|
|
4253
|
+
createdDate: z.number(),
|
|
4254
|
+
description: z.string().optional(),
|
|
4255
|
+
displayName: z.string(),
|
|
4256
|
+
modifiedDate: z.number(),
|
|
4257
|
+
orderWeight: z.number().optional(),
|
|
4258
|
+
parentAttribute: parentAttributeSchema.optional(),
|
|
4259
|
+
parentAttributeId: z.number().optional(),
|
|
4260
|
+
primaryAttrGroup: attributeGroupSchema
|
|
4261
|
+
});
|
|
4262
|
+
|
|
4263
|
+
// lib/attributes/models/AttributeValidValues.ts
|
|
4264
|
+
var attributeValidValuesSchema = z.object({
|
|
4265
|
+
value: z.string(),
|
|
4266
|
+
isDefault: z.boolean(),
|
|
4267
|
+
locale: z.string(),
|
|
4268
|
+
createdBy: z.string(),
|
|
4269
|
+
createdDate: z.number(),
|
|
4270
|
+
modifiedDate: z.number(),
|
|
4271
|
+
modifiedBy: z.string(),
|
|
4272
|
+
attributeId: z.number(),
|
|
4273
|
+
attrValueId: z.number(),
|
|
4274
|
+
attrKeyPair: z.string()
|
|
4275
|
+
});
|
|
4276
|
+
|
|
4277
|
+
// lib/attributes/index.ts
|
|
4278
|
+
var BASE_URL6 = "attributes";
|
|
4279
|
+
function createAttributesApi(client) {
|
|
4280
|
+
async function getAllAttributes(signal) {
|
|
4281
|
+
const data = await client.get(`${BASE_URL6}`, { signal }).json();
|
|
4282
|
+
return z.array(attributeMetaDataSchema).parse(data);
|
|
4283
|
+
}
|
|
4284
|
+
async function getAllAttributesByCompany(params, signal) {
|
|
4285
|
+
const data = await client.get(`${BASE_URL6}/company`, {
|
|
4286
|
+
searchParams: params,
|
|
4287
|
+
signal
|
|
4288
|
+
}).json();
|
|
4289
|
+
return attributesByCompanySchema.parse(data);
|
|
4290
|
+
}
|
|
4291
|
+
async function getAttributesExtensiveInfo(signal) {
|
|
4292
|
+
const data = await client.get(`${BASE_URL6}/registry/editui`, { signal }).json();
|
|
4293
|
+
return z.array(attributeDefinitionSchema).parse(data);
|
|
4294
|
+
}
|
|
4295
|
+
async function getAttributeValidValues(attributeDbName, signal) {
|
|
4296
|
+
const data = await client.get(`${BASE_URL6}/registry/attribute/${attributeDbName}/values`, {
|
|
4297
|
+
signal
|
|
4298
|
+
}).json();
|
|
4299
|
+
return z.array(attributeValidValuesSchema).parse(data);
|
|
4300
|
+
}
|
|
4301
|
+
async function getCompanyInterestedAttributes(signal) {
|
|
4302
|
+
const data = await client.get(`${BASE_URL6}/company/interested-attributes`, { signal }).json();
|
|
4303
|
+
return z.array(z.string()).parse(data);
|
|
4304
|
+
}
|
|
4305
|
+
return {
|
|
4306
|
+
getAllAttributes,
|
|
4307
|
+
getAllAttributesByCompany,
|
|
4308
|
+
getAttributesExtensiveInfo,
|
|
4309
|
+
getAttributeValidValues,
|
|
4310
|
+
getCompanyInterestedAttributes
|
|
4311
|
+
};
|
|
4312
|
+
}
|
|
4313
|
+
|
|
4314
|
+
// lib/locale/models/Locale.ts
|
|
4315
|
+
var localeSchema = z.object({
|
|
4316
|
+
localeCode: z.string(),
|
|
4317
|
+
localeDescription: z.string()
|
|
4318
|
+
});
|
|
4319
|
+
|
|
4320
|
+
// lib/locale/index.ts
|
|
4321
|
+
var BASE_URL7 = "locale";
|
|
4322
|
+
function createLocaleApi(client) {
|
|
4323
|
+
async function getLocale(signal) {
|
|
4324
|
+
const data = await client.get(`${BASE_URL7}`, { signal }).json();
|
|
4325
|
+
return z.array(localeSchema).parse(data);
|
|
4326
|
+
}
|
|
4327
|
+
return {
|
|
4328
|
+
getLocale
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4332
|
+
// lib/spreadsheetTemplate/models/SpreadsheetTemplateCompany.ts
|
|
4333
|
+
var spreadsheetTemplateCompanySchema = z.object({
|
|
4334
|
+
companyName: z.string(),
|
|
4335
|
+
companyId: z.number(),
|
|
4336
|
+
createdAt: z.number()
|
|
4337
|
+
});
|
|
4338
|
+
|
|
4339
|
+
// lib/spreadsheetTemplate/models/SpreadsheetTemplate.ts
|
|
4340
|
+
var spreadsheetTemplateSchema = z.object({
|
|
4341
|
+
id: z.number(),
|
|
4342
|
+
fileLocation: z.string(),
|
|
4343
|
+
name: z.string(),
|
|
4344
|
+
templateType: z.string(),
|
|
4345
|
+
maxItemsPerDoc: z.number(),
|
|
4346
|
+
companies: z.array(spreadsheetTemplateCompanySchema),
|
|
4347
|
+
createdBy: z.string().nullish(),
|
|
4348
|
+
createdAt: z.number().nullish(),
|
|
4349
|
+
modifiedBy: z.string().nullish(),
|
|
4350
|
+
modifiedAt: z.number().nullish()
|
|
4351
|
+
});
|
|
4352
|
+
|
|
4353
|
+
// lib/spreadsheetTemplate/index.ts
|
|
4354
|
+
var BASE_URL8 = "templates";
|
|
4355
|
+
function createSpreadsheetTemplateApi(client) {
|
|
4356
|
+
async function getTemplates(signal) {
|
|
4357
|
+
const data = await client.get(`${BASE_URL8}`, { signal }).json();
|
|
4358
|
+
return z.array(spreadsheetTemplateSchema).parse(data);
|
|
4359
|
+
}
|
|
4360
|
+
return {
|
|
4361
|
+
getTemplates
|
|
4362
|
+
};
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4365
|
+
// lib/whoami/models/IdentityServiceDatetimePreferences.ts
|
|
4366
|
+
var identityServiceDatetimePreferencesSchema = z.object({
|
|
4367
|
+
DATE_TIME: z.string(),
|
|
4368
|
+
TIME: z.string(),
|
|
4369
|
+
SHORT_DATE: z.string(),
|
|
4370
|
+
LONG_DATETIME: z.string(),
|
|
4371
|
+
LONG_TIME: z.string(),
|
|
4372
|
+
DATE: z.string()
|
|
4373
|
+
});
|
|
4374
|
+
|
|
4375
|
+
// lib/whoami/models/IdentityServiceOrganizationMetadata.ts
|
|
4376
|
+
var identityServiceOrganizationMetadataSchema = z.object({
|
|
4377
|
+
namespace: z.string(),
|
|
4378
|
+
key: z.string(),
|
|
4379
|
+
value: z.string()
|
|
4380
|
+
});
|
|
4381
|
+
|
|
4382
|
+
// lib/whoami/models/IdentityServiceOrganization.ts
|
|
4383
|
+
var identityServiceOrganizationSchema = z.object({
|
|
4384
|
+
organization_name: z.string().optional(),
|
|
4385
|
+
organization_site: z.string().optional(),
|
|
4386
|
+
namespace: z.string().optional(),
|
|
4387
|
+
id: z.string(),
|
|
4388
|
+
permissions: z.array(z.string()).optional(),
|
|
4389
|
+
metadata: identityServiceOrganizationMetadataSchema.optional()
|
|
4390
|
+
});
|
|
4391
|
+
|
|
4392
|
+
// lib/whoami/models/IdentityServicePreferences.ts
|
|
4393
|
+
var identityServicePreferencesSchema = z.object({
|
|
4394
|
+
locale: z.string(),
|
|
4395
|
+
timezone: z.string(),
|
|
4396
|
+
cpUpgrade: z.string().optional(),
|
|
4397
|
+
language: z.array(z.string()),
|
|
4398
|
+
datetime: identityServiceDatetimePreferencesSchema
|
|
4399
|
+
});
|
|
4400
|
+
|
|
4401
|
+
// lib/whoami/models/IdentityServiceUser.ts
|
|
4402
|
+
var identityServiceUserSchema = z.object({
|
|
4403
|
+
id: z.string(),
|
|
4404
|
+
email: z.string().optional(),
|
|
4405
|
+
first_name: z.string().optional(),
|
|
4406
|
+
last_name: z.string().optional(),
|
|
4407
|
+
job_title: z.string().optional(),
|
|
4408
|
+
externally_managed: z.boolean().optional(),
|
|
4409
|
+
city: z.string().optional(),
|
|
4410
|
+
name: z.string(),
|
|
4411
|
+
state: z.string().optional(),
|
|
4412
|
+
country: z.string().optional(),
|
|
4413
|
+
user_type: z.string().optional(),
|
|
4414
|
+
token_type: z.string().optional(),
|
|
4415
|
+
avatar_image_id: z.string().optional(),
|
|
4416
|
+
avatar_image_url: z.string().optional(),
|
|
4417
|
+
origin_avatar_image_id: z.string().optional(),
|
|
4418
|
+
bio: z.string().optional(),
|
|
4419
|
+
phone_number: z.string().optional(),
|
|
4420
|
+
twitter_handle: z.string().optional(),
|
|
4421
|
+
linkedin_url: z.string().optional(),
|
|
4422
|
+
description: z.string().optional(),
|
|
4423
|
+
preferences: identityServicePreferencesSchema.optional(),
|
|
4424
|
+
roles: z.array(z.string()),
|
|
4425
|
+
organization: identityServiceOrganizationSchema,
|
|
4426
|
+
password: z.string(),
|
|
4427
|
+
verified: z.boolean()
|
|
4428
|
+
});
|
|
4429
|
+
|
|
4430
|
+
// lib/whoami/models/RegisteredService.ts
|
|
4431
|
+
var registeredServiceSchema = z.object({
|
|
4432
|
+
serviceId: z.number(),
|
|
4433
|
+
identityServiceId: z.number(),
|
|
4434
|
+
name: z.string(),
|
|
4435
|
+
isActive: z.boolean()
|
|
4436
|
+
});
|
|
4437
|
+
|
|
4438
|
+
// lib/whoami/models/UserAccount.ts
|
|
4439
|
+
var userAccountSchema = z.object({
|
|
4440
|
+
identityUser: identityServiceUserSchema,
|
|
4441
|
+
companyId: z.number(),
|
|
4442
|
+
companyName: z.string(),
|
|
4443
|
+
name: z.string(),
|
|
4444
|
+
assortmentPartnerCompanyId: z.number().nullish(),
|
|
4445
|
+
retailer: z.boolean(),
|
|
4446
|
+
supplier: z.boolean(),
|
|
4447
|
+
registeredService: registeredServiceSchema,
|
|
4448
|
+
uniqueAttributes: z.array(z.string()),
|
|
4449
|
+
admin: z.boolean(),
|
|
4450
|
+
adminToolUser: z.boolean(),
|
|
4451
|
+
attributeRegistryAdmin: z.boolean(),
|
|
4452
|
+
attributeRegistryDev: z.boolean(),
|
|
4453
|
+
attributeRegistryRsx: z.boolean(),
|
|
4454
|
+
attributeRegistryUser: z.boolean(),
|
|
4455
|
+
attributeRegistryViewer: z.boolean()
|
|
4456
|
+
});
|
|
4457
|
+
|
|
4458
|
+
// lib/whoami/index.ts
|
|
4459
|
+
var BASE_URL9 = "whoami";
|
|
4460
|
+
function createWhoAmIApi(client) {
|
|
4461
|
+
async function whoAmI(signal) {
|
|
4462
|
+
const data = await client.get(`${BASE_URL9}`, { signal }).json();
|
|
4463
|
+
return userAccountSchema.parse(data);
|
|
4464
|
+
}
|
|
4465
|
+
return {
|
|
4466
|
+
whoAmI
|
|
4467
|
+
};
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
// lib/companyFeatures/index.ts
|
|
4471
|
+
var BASE_URL10 = "feature";
|
|
4472
|
+
function createCompanyFeaturesApi(client) {
|
|
4473
|
+
async function checkIfStageItemSetupIsEnabled(signal) {
|
|
4474
|
+
const data = await client.get(`${BASE_URL10}/isphaseditemsetupenabled`, {
|
|
4475
|
+
signal
|
|
4476
|
+
}).json();
|
|
4477
|
+
return z.boolean().parse(data);
|
|
4478
|
+
}
|
|
4479
|
+
return {
|
|
4480
|
+
checkIfStageItemSetupIsEnabled
|
|
4481
|
+
};
|
|
4482
|
+
}
|
|
4483
|
+
|
|
4484
|
+
// lib/featureFlags/index.ts
|
|
4485
|
+
var BASE_URL11 = "feature-flag";
|
|
4486
|
+
function createFeatureFlagsApi(client) {
|
|
4487
|
+
async function checkEnableItemsApiEndpointsForImports(signal) {
|
|
4488
|
+
const data = await client.get(`${BASE_URL11}/enable-items-api-endpoints-for-imports/`, {
|
|
4489
|
+
signal
|
|
4490
|
+
}).json();
|
|
4491
|
+
return z.boolean().parse(data);
|
|
4492
|
+
}
|
|
4493
|
+
return {
|
|
4494
|
+
checkEnableItemsApiEndpointsForImports
|
|
4495
|
+
};
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4498
|
+
// lib/items/models/ItemHeader.ts
|
|
4499
|
+
var itemHeaderSchema = z.object({
|
|
4500
|
+
status: z.string().optional(),
|
|
4501
|
+
catalogName: z.string(),
|
|
4502
|
+
productCodeName: z.string(),
|
|
4503
|
+
selectionCodeName: z.string(),
|
|
4504
|
+
gtin: z.string(),
|
|
4505
|
+
upc: z.string(),
|
|
4506
|
+
ean: z.string(),
|
|
4507
|
+
isbn: z.string(),
|
|
4508
|
+
partNumber: z.string(),
|
|
4509
|
+
lastUpdatedDateString: z.string(),
|
|
4510
|
+
companyId: z.string(),
|
|
4511
|
+
itemInfoId: z.string()
|
|
4512
|
+
});
|
|
4513
|
+
|
|
4514
|
+
// lib/items/models/PhaseEnum.ts
|
|
4515
|
+
var phaseEnumSchema = z.enum([
|
|
4516
|
+
"CORE",
|
|
4517
|
+
"CORE_PLUS",
|
|
4518
|
+
"CORE_ADVANCED",
|
|
4519
|
+
"ENRICHED",
|
|
4520
|
+
"STANDARD_REQUIREMENTS"
|
|
4521
|
+
]);
|
|
4522
|
+
|
|
4523
|
+
// lib/items/models/TradingPartnerStage.ts
|
|
4524
|
+
var tradingPartnerStageSchema = z.object({
|
|
4525
|
+
companyId: z.number(),
|
|
4526
|
+
companyName: z.string(),
|
|
4527
|
+
stage: z.nullable(phaseEnumSchema),
|
|
4528
|
+
isValid: z.boolean()
|
|
4529
|
+
});
|
|
4530
|
+
|
|
4531
|
+
// lib/items/models/ItemMap.ts
|
|
4532
|
+
var itemMapSchema = z.object({
|
|
4533
|
+
rn: z.number().optional(),
|
|
4534
|
+
iteminfoid: z.string(),
|
|
4535
|
+
tradingPartnerStages: z.array(tradingPartnerStageSchema).optional(),
|
|
4536
|
+
gtin: z.string().nullish(),
|
|
4537
|
+
catalogname: z.string().nullish(),
|
|
4538
|
+
isbn: z.string().nullish(),
|
|
4539
|
+
lastupdateddatestring: z.string().nullish(),
|
|
4540
|
+
upc: z.string().nullish(),
|
|
4541
|
+
productcodename: z.string().nullish(),
|
|
4542
|
+
ean: z.string().nullish(),
|
|
4543
|
+
selectioncodename: z.string().nullish(),
|
|
4544
|
+
createddatestring: z.string().nullish(),
|
|
4545
|
+
partnumber: z.string().nullish(),
|
|
4546
|
+
consumeravailabledatestring: z.string().nullish(),
|
|
4547
|
+
status: z.string().nullish(),
|
|
4548
|
+
nrfcolorcode: z.array(z.string()).nullish(),
|
|
4549
|
+
nrfsizecode: z.array(z.string()).nullish(),
|
|
4550
|
+
productcolordescription: z.array(z.string()).nullish(),
|
|
4551
|
+
productsizedescription: z.array(z.string()).nullish()
|
|
4552
|
+
}).passthrough();
|
|
4553
|
+
|
|
4554
|
+
// lib/items/models/ItemTable.ts
|
|
4555
|
+
var itemTableSchema = z.object({
|
|
4556
|
+
headers: itemHeaderSchema,
|
|
4557
|
+
itemMaps: z.array(itemMapSchema)
|
|
4558
|
+
});
|
|
4559
|
+
|
|
4560
|
+
// lib/items/models/ItemSearchView.ts
|
|
4561
|
+
var itemSearchViewSchema = z.object({
|
|
4562
|
+
itemTable: itemTableSchema,
|
|
4563
|
+
hasNext: z.boolean(),
|
|
4564
|
+
count: z.number()
|
|
4565
|
+
});
|
|
4566
|
+
|
|
4567
|
+
// lib/exports/models/ExportType.ts
|
|
4568
|
+
var exportTypeEnum = z.enum(["ALL", "UPDATES", "DELTAS_UPDATE", "NO_BUYER_PART_NUMBER"]);
|
|
4569
|
+
|
|
4570
|
+
// lib/exports/models/ExportFrequency.ts
|
|
4571
|
+
var exportFrequencyEnum = z.enum([
|
|
4572
|
+
"IMMEDIATE",
|
|
4573
|
+
"ONETIME",
|
|
4574
|
+
"DAILY",
|
|
4575
|
+
"WEEKLY",
|
|
4576
|
+
"MONTHLY"
|
|
4577
|
+
]);
|
|
4578
|
+
|
|
4579
|
+
// lib/exports/models/ExportDayOfWeek.ts
|
|
4580
|
+
var exportDayOfWeekEnum = z.enum([
|
|
4581
|
+
"MON",
|
|
4582
|
+
"TUE",
|
|
4583
|
+
"WED",
|
|
4584
|
+
"THU",
|
|
4585
|
+
"FRI",
|
|
4586
|
+
"SAT",
|
|
4587
|
+
"SUN"
|
|
4588
|
+
]);
|
|
4589
|
+
|
|
4590
|
+
// lib/exports/models/Export.ts
|
|
4591
|
+
var exportSchema = z.object({
|
|
4592
|
+
exportName: z.string(),
|
|
4593
|
+
exportDescription: z.string(),
|
|
4594
|
+
isActive: z.boolean(),
|
|
4595
|
+
exportType: exportTypeEnum,
|
|
4596
|
+
exportFrequency: exportFrequencyEnum,
|
|
4597
|
+
includeValidAttributes: z.optional(z.boolean()),
|
|
4598
|
+
dayOfMonth: z.optional(z.number()),
|
|
4599
|
+
dayOfWeek: z.optional(exportDayOfWeekEnum),
|
|
4600
|
+
hourOfDay: z.optional(z.number()),
|
|
4601
|
+
date: z.optional(z.string()),
|
|
4602
|
+
catalogIds: z.optional(z.array(z.number())),
|
|
4603
|
+
itemInfoIds: z.optional(z.array(z.number())),
|
|
4604
|
+
excludeItemInfoIds: z.optional(z.array(z.number())),
|
|
4605
|
+
selectionCodeIds: z.optional(z.array(z.number())),
|
|
4606
|
+
productCodeIds: z.optional(z.array(z.number())),
|
|
4607
|
+
productTypes: z.optional(z.array(z.string())),
|
|
4608
|
+
deliveryType: z.optional(z.string()),
|
|
4609
|
+
spreadsheetTemplateId: z.optional(z.number()),
|
|
4610
|
+
emailAddresses: z.optional(z.array(z.string())),
|
|
4611
|
+
subjectLine: z.optional(z.string()),
|
|
4612
|
+
additionalLocales: z.optional(z.array(z.string()))
|
|
4613
|
+
});
|
|
4614
|
+
|
|
4615
|
+
// lib/exports/models/DownloadItemsParams.ts
|
|
4616
|
+
var downLoadItemsParamsSchema = z.object({
|
|
4617
|
+
"multi-sheet": z.boolean(),
|
|
4618
|
+
ids: z.array(z.string())
|
|
4619
|
+
});
|
|
4620
|
+
|
|
4621
|
+
// lib/errors/models/ItemErrorDetails.ts
|
|
4622
|
+
var itemErrorDetailsSchema = z.object({
|
|
4623
|
+
errorMessage: z.string(),
|
|
4624
|
+
attributeName: z.string().nullable(),
|
|
4625
|
+
tradingPartnerNames: z.array(z.string()),
|
|
4626
|
+
phases: z.array(phaseEnumSchema),
|
|
4627
|
+
attributeDbNames: z.array(z.string()),
|
|
4628
|
+
tradingPartnerStages: z.array(tradingPartnerStageSchema),
|
|
4629
|
+
repeatableGroupId: z.string().nullish()
|
|
4630
|
+
});
|
|
4631
|
+
|
|
4632
|
+
// lib/errors/models/ItemErrorDetailsResult.ts
|
|
4633
|
+
var itemErrorDetailsResultSchema = z.object({
|
|
4634
|
+
itemInfoId: z.number(),
|
|
4635
|
+
upc: z.string().nullish(),
|
|
4636
|
+
isbn: z.string().nullish(),
|
|
4637
|
+
gtin: z.string().nullish(),
|
|
4638
|
+
partnumber: z.string().nullish(),
|
|
4639
|
+
ean: z.string().nullish(),
|
|
4640
|
+
itemName: z.string().nullable(),
|
|
4641
|
+
itemErrorDetails: z.array(itemErrorDetailsSchema)
|
|
4642
|
+
});
|
|
4643
|
+
|
|
4644
|
+
// lib/items/models/AttributeDetail.ts
|
|
4645
|
+
var attributeDetailSchema = z.object({
|
|
4646
|
+
type: attrDatatypeNameEnumSchema,
|
|
4647
|
+
name: z.string(),
|
|
4648
|
+
value: z.string().or(z.number()).or(z.array(z.string())).or(z.array(z.number())).nullable(),
|
|
4649
|
+
label: z.string(),
|
|
4650
|
+
group: z.string(),
|
|
4651
|
+
orderBy: z.number().or(z.string()).nullish()
|
|
4652
|
+
});
|
|
4653
|
+
|
|
4654
|
+
// lib/items/models/CategoryEnum.ts
|
|
4655
|
+
var categoryEnumSchema = z.enum([
|
|
4656
|
+
"AKA",
|
|
4657
|
+
"CATALOG",
|
|
4658
|
+
"EXPORT",
|
|
4659
|
+
"LABEL",
|
|
4660
|
+
"LEGACY_PRODUCT_TYPE",
|
|
4661
|
+
"PRODUCT_CLASSIFICATION",
|
|
4662
|
+
"PRODUCT_CODE",
|
|
4663
|
+
"SELECTION_CODE",
|
|
4664
|
+
"TAXONOMY_ROOT"
|
|
4665
|
+
]);
|
|
4666
|
+
|
|
4667
|
+
// lib/items/models/ComponentDetails.ts
|
|
4668
|
+
var componentDetailsSchema = z.object({
|
|
4669
|
+
itemInfoId: z.number(),
|
|
4670
|
+
description: z.string(),
|
|
4671
|
+
saleable: z.boolean(),
|
|
4672
|
+
valid: z.boolean(),
|
|
4673
|
+
uniqueCriteria: z.array(
|
|
4674
|
+
z.object({
|
|
4675
|
+
name: z.string(),
|
|
4676
|
+
value: z.string()
|
|
4677
|
+
})
|
|
4678
|
+
)
|
|
4679
|
+
});
|
|
4680
|
+
|
|
4681
|
+
// lib/items/models/RepeatableGroup.ts
|
|
4682
|
+
var repeatableGroupSchema = z.object({
|
|
4683
|
+
repeatableGroupId: z.string(),
|
|
4684
|
+
repeatableNumber: z.number()
|
|
4685
|
+
});
|
|
4686
|
+
|
|
4687
|
+
// lib/items/models/GroupedAttributeList.ts
|
|
4688
|
+
var groupedAttributeListSchema = z.object({
|
|
4689
|
+
type: z.string(),
|
|
4690
|
+
rows: z.array(z.array(attributeDetailSchema)),
|
|
4691
|
+
repeatableGroups: z.array(repeatableGroupSchema)
|
|
4692
|
+
});
|
|
4693
|
+
|
|
4694
|
+
// lib/items/models/GroupedAttributes.ts
|
|
4695
|
+
var groupedAttributesSchema = z.object({
|
|
4696
|
+
type: z.string(),
|
|
4697
|
+
attributes: z.array(attributeDetailSchema),
|
|
4698
|
+
attributeGroups: z.array(groupedAttributeListSchema)
|
|
4699
|
+
});
|
|
4700
|
+
|
|
4701
|
+
// lib/items/models/HierarchyCategory.ts
|
|
4702
|
+
var hierarchyCategorySchema = z.object({
|
|
4703
|
+
name: z.string(),
|
|
4704
|
+
description: z.string().nullish(),
|
|
4705
|
+
id: z.number(),
|
|
4706
|
+
companyId: z.number(),
|
|
4707
|
+
type: categoryEnumSchema
|
|
4708
|
+
});
|
|
4709
|
+
|
|
4710
|
+
// lib/items/models/HierarchyDetails.ts
|
|
4711
|
+
var hierarchyDetailsSchema = z.object({
|
|
4712
|
+
catalogs: z.array(hierarchyCategorySchema),
|
|
4713
|
+
selectionCodes: z.array(hierarchyCategorySchema),
|
|
4714
|
+
productCodes: z.array(hierarchyCategorySchema)
|
|
4715
|
+
});
|
|
4716
|
+
|
|
4717
|
+
// lib/items/models/PackComponentItemInfo.ts
|
|
4718
|
+
var packComponentItemInfoSchema = z.object({
|
|
4719
|
+
companyid: z.number(),
|
|
4720
|
+
createddate: z.number(),
|
|
4721
|
+
isServiceApi: z.boolean(),
|
|
4722
|
+
isactive: z.number(),
|
|
4723
|
+
isvalid: z.number(),
|
|
4724
|
+
itemType: z.string(),
|
|
4725
|
+
iteminfoid: z.number(),
|
|
4726
|
+
itemtimestamp: z.number(),
|
|
4727
|
+
serviceId: z.number(),
|
|
4728
|
+
attributes: z.record(z.string(), z.string().or(z.array(z.string())))
|
|
4729
|
+
});
|
|
4730
|
+
|
|
4731
|
+
// lib/items/models/ItemPrice.ts
|
|
4732
|
+
var itemPriceSchema = z.object({
|
|
4733
|
+
amount: z.number(),
|
|
4734
|
+
currency: z.string(),
|
|
4735
|
+
id: z.number().nullish(),
|
|
4736
|
+
priceDivision: z.string().nullish(),
|
|
4737
|
+
iteminfoid: z.number().nullish(),
|
|
4738
|
+
startdate: z.string().nullish(),
|
|
4739
|
+
enddate: z.string().nullish(),
|
|
4740
|
+
qualifier: z.string(),
|
|
4741
|
+
region: z.string().nullish(),
|
|
4742
|
+
regionqualifier: z.string().nullish(),
|
|
4743
|
+
regiondescription: z.string().nullish(),
|
|
4744
|
+
partnercompanyid: z.string().nullish(),
|
|
4745
|
+
itempricetimestamp: z.number().nullish(),
|
|
4746
|
+
range_type: z.string().nullish(),
|
|
4747
|
+
date_range_type: z.string().nullish(),
|
|
4748
|
+
min_range: z.number().nullish(),
|
|
4749
|
+
gtin: z.string().nullish(),
|
|
4750
|
+
priceConditionDescription: z.string().nullish(),
|
|
4751
|
+
priceUnitQuantity: z.number().nullish(),
|
|
4752
|
+
priceUnitQuantityUOM: z.string().nullish()
|
|
4753
|
+
});
|
|
4754
|
+
|
|
4755
|
+
// lib/items/models/PackComponentDetails.ts
|
|
4756
|
+
var packComponentDetailsSchema = z.object({
|
|
4757
|
+
itemInfo: packComponentItemInfoSchema,
|
|
4758
|
+
itemPrices: z.array(itemPriceSchema)
|
|
4759
|
+
});
|
|
4760
|
+
|
|
4761
|
+
// lib/items/models/GroupedItem.ts
|
|
4762
|
+
var groupedItemSchema = z.object({
|
|
4763
|
+
iteminfoid: z.number(),
|
|
4764
|
+
companyid: z.number(),
|
|
4765
|
+
status: z.string(),
|
|
4766
|
+
createdDate: z.string(),
|
|
4767
|
+
lastUpdatedDate: z.string(),
|
|
4768
|
+
identifiers: z.record(z.string(), z.any()),
|
|
4769
|
+
hierarchyDetails: hierarchyDetailsSchema,
|
|
4770
|
+
groupedAttributes: z.array(groupedAttributesSchema),
|
|
4771
|
+
packComponentDetails: z.array(packComponentDetailsSchema),
|
|
4772
|
+
childComponentDetails: z.array(componentDetailsSchema),
|
|
4773
|
+
parentComponentDetails: z.array(componentDetailsSchema),
|
|
4774
|
+
locales: z.array(z.string())
|
|
4775
|
+
});
|
|
4776
|
+
|
|
4777
|
+
// lib/items/models/ItemDetailView.ts
|
|
4778
|
+
var itemDetailViewSchema = z.object({
|
|
4779
|
+
item: groupedItemSchema
|
|
4780
|
+
});
|
|
4781
|
+
|
|
4782
|
+
// lib/items/models/Bulb.ts
|
|
4783
|
+
var bulbSchema = z.object({
|
|
4784
|
+
iteminfoid: z.number(),
|
|
4785
|
+
id: z.number(),
|
|
4786
|
+
shape: z.string(),
|
|
4787
|
+
position: z.number(),
|
|
4788
|
+
quantity: z.number(),
|
|
4789
|
+
basetype: z.string(),
|
|
4790
|
+
maxwatt: z.number(),
|
|
4791
|
+
createdat: z.string(),
|
|
4792
|
+
modifiedat: z.string(),
|
|
4793
|
+
bulbtype: z.string(),
|
|
4794
|
+
bulbincluded: z.string(),
|
|
4795
|
+
bulbsize: z.string(),
|
|
4796
|
+
replacementbulb: z.string(),
|
|
4797
|
+
threewaybulb: z.string()
|
|
4798
|
+
});
|
|
4799
|
+
|
|
4800
|
+
// lib/items/models/PackComponent.ts
|
|
4801
|
+
var packComponentSchema = z.object({
|
|
4802
|
+
itemInfoId: z.number().nullish(),
|
|
4803
|
+
attributes: z.record(z.string(), z.string().or(z.array(z.string()))),
|
|
4804
|
+
prices: z.array(itemPriceSchema)
|
|
4805
|
+
});
|
|
4806
|
+
|
|
4807
|
+
// lib/items/models/MediaItem.ts
|
|
4808
|
+
var mediaItemSchema = z.object({
|
|
4809
|
+
id: z.number(),
|
|
4810
|
+
iteminfoid: z.number(),
|
|
4811
|
+
medianame: z.string(),
|
|
4812
|
+
height: z.number().nullish(),
|
|
4813
|
+
filename: z.string(),
|
|
4814
|
+
mediafilename: z.string().nullish(),
|
|
4815
|
+
description: z.string().nullish(),
|
|
4816
|
+
filesize: z.number().nullish(),
|
|
4817
|
+
format: z.string().nullish(),
|
|
4818
|
+
orientation: z.string().nullish(),
|
|
4819
|
+
pixeldensity: z.string().nullish(),
|
|
4820
|
+
purpose: z.string().nullish(),
|
|
4821
|
+
width: z.number().nullish(),
|
|
4822
|
+
mediatype: z.string(),
|
|
4823
|
+
mediaviewtype: z.string().nullish(),
|
|
4824
|
+
compressionquality: z.string().nullish(),
|
|
4825
|
+
thumbnailflag: z.string().nullish()
|
|
4826
|
+
});
|
|
4827
|
+
|
|
4828
|
+
// lib/items/models/ItemDetail.ts
|
|
4829
|
+
var itemDetailSchema = z.object({
|
|
4830
|
+
attributes: z.record(z.string(), z.any()),
|
|
4831
|
+
clusters: z.record(
|
|
4832
|
+
z.string(),
|
|
4833
|
+
z.array(
|
|
4834
|
+
z.object({
|
|
4835
|
+
itemInfoAttributes: z.record(
|
|
4836
|
+
z.string(),
|
|
4837
|
+
z.string().or(z.number()).or(z.boolean())
|
|
4838
|
+
)
|
|
4839
|
+
})
|
|
4840
|
+
)
|
|
4841
|
+
),
|
|
4842
|
+
prices: z.array(itemPriceSchema),
|
|
4843
|
+
bulbs: z.array(bulbSchema),
|
|
4844
|
+
media: z.array(mediaItemSchema),
|
|
4845
|
+
packs: z.array(packComponentSchema)
|
|
4846
|
+
});
|
|
4847
|
+
|
|
4848
|
+
// lib/items/models/SpsItemIdResponse.ts
|
|
4849
|
+
var spsItemIdResponseSchema = z.object({
|
|
4850
|
+
id: z.string(),
|
|
4851
|
+
ref: z.string()
|
|
4852
|
+
});
|
|
4853
|
+
|
|
4854
|
+
// lib/items/models/ItemOrgStatus.ts
|
|
4855
|
+
var itemOrgStatusSchema = z.object({
|
|
4856
|
+
org: z.object({
|
|
4857
|
+
ref: z.string(),
|
|
4858
|
+
id: z.string(),
|
|
4859
|
+
name: z.string()
|
|
4860
|
+
}),
|
|
4861
|
+
lowestInvalidStage: phaseEnumSchema.nullable(),
|
|
4862
|
+
validForRelationship: z.boolean()
|
|
4863
|
+
});
|
|
4864
|
+
|
|
4865
|
+
// lib/items/models/ItemStatus.ts
|
|
4866
|
+
var itemStatusSchema = z.object({
|
|
4867
|
+
itemId: z.string(),
|
|
4868
|
+
itemOrgStatuses: z.array(itemOrgStatusSchema)
|
|
4869
|
+
});
|
|
4870
|
+
|
|
4871
|
+
// lib/items/models/ItemStatusResponse.ts
|
|
4872
|
+
var itemStatusResponseSchema = z.object({
|
|
4873
|
+
itemStatuses: z.array(itemStatusSchema)
|
|
4874
|
+
});
|
|
4875
|
+
|
|
4876
|
+
// lib/items/index.ts
|
|
4877
|
+
var BASE_URL12 = "items";
|
|
4878
|
+
function createItemsApi(client) {
|
|
4879
|
+
async function searchItems(params, signal) {
|
|
4880
|
+
const searchParams = params ? `limit=${params.limit}&offset=${params.offset}` + (params.url ? `&${params.url}` : "") : void 0;
|
|
4881
|
+
const data = await client.get(`${BASE_URL12}`, { searchParams, signal }).json();
|
|
4882
|
+
return itemSearchViewSchema.parse(data);
|
|
4883
|
+
}
|
|
4884
|
+
async function getItem(itemId, locale = "en-US", signal) {
|
|
4885
|
+
const data = await client.get(`${BASE_URL12}/${itemId}`, { searchParams: { locale }, signal }).json();
|
|
4886
|
+
return itemDetailViewSchema.parse(data);
|
|
4887
|
+
}
|
|
4888
|
+
async function updateItem(itemId, item) {
|
|
4889
|
+
await client.put(`${BASE_URL12}/details/${itemId}`, { json: { ...item } }).json();
|
|
4890
|
+
}
|
|
4891
|
+
async function deleteItem(itemId) {
|
|
4892
|
+
await client.delete(`${BASE_URL12}/${itemId}`);
|
|
4893
|
+
}
|
|
4894
|
+
async function deleteItems(itemIds) {
|
|
4895
|
+
const params = new URLSearchParams();
|
|
4896
|
+
itemIds.forEach((id) => {
|
|
4897
|
+
params.append("items", id);
|
|
4898
|
+
});
|
|
4899
|
+
await client.delete(`${BASE_URL12}`, { searchParams: params });
|
|
4900
|
+
}
|
|
4901
|
+
async function getItemInfoId(spsItemId, signal) {
|
|
4902
|
+
const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, { signal }).json();
|
|
4903
|
+
return z.number().parse(data);
|
|
4904
|
+
}
|
|
4905
|
+
async function getSpsItemId(itemInfoId, signal) {
|
|
4906
|
+
const data = await client.get(`${BASE_URL12}/${itemInfoId}/spsItemId`, { signal }).json();
|
|
4907
|
+
return spsItemIdResponseSchema.parse(data);
|
|
4908
|
+
}
|
|
4909
|
+
async function getItemStatus(itemIds) {
|
|
4910
|
+
const data = await client.post(`${BASE_URL12}/status`, { json: { itemIds } }).json();
|
|
4911
|
+
return itemStatusResponseSchema.parse(data);
|
|
4912
|
+
}
|
|
4913
|
+
return {
|
|
4914
|
+
searchItems,
|
|
4915
|
+
getItem,
|
|
4916
|
+
updateItem,
|
|
4917
|
+
deleteItem,
|
|
4918
|
+
deleteItems,
|
|
4919
|
+
getItemInfoId,
|
|
4920
|
+
getSpsItemId,
|
|
4921
|
+
getItemStatus
|
|
4922
|
+
};
|
|
4923
|
+
}
|
|
4924
|
+
|
|
4925
|
+
// lib/errors/index.ts
|
|
4926
|
+
var BASE_URL13 = "errors";
|
|
4927
|
+
function createErrorsApi(client) {
|
|
4928
|
+
async function getInvalidItemErrorDetails(itemInfoId, signal) {
|
|
4929
|
+
const data = await client.get(`${BASE_URL13}/items/${itemInfoId}`, {
|
|
4930
|
+
signal
|
|
4931
|
+
}).json();
|
|
4932
|
+
return itemErrorDetailsResultSchema.parse(data);
|
|
4933
|
+
}
|
|
4934
|
+
return {
|
|
4935
|
+
getInvalidItemErrorDetails
|
|
4936
|
+
};
|
|
4028
4937
|
}
|
|
4029
4938
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4030
4939
|
0 && (module.exports = {
|
|
4031
4940
|
AsstClient,
|
|
4032
4941
|
BASE_URLS,
|
|
4942
|
+
createAttributesApi,
|
|
4033
4943
|
createCategoriesApi,
|
|
4944
|
+
createCompanyFeaturesApi,
|
|
4945
|
+
createErrorsApi,
|
|
4034
4946
|
createExportsApi,
|
|
4947
|
+
createFeatureFlagsApi,
|
|
4035
4948
|
createImportsApi,
|
|
4949
|
+
createItemsApi,
|
|
4950
|
+
createLocaleApi,
|
|
4036
4951
|
createProductTypesApi,
|
|
4037
|
-
|
|
4952
|
+
createSpreadsheetTemplateApi,
|
|
4953
|
+
createTradingPartnerAccessApi,
|
|
4954
|
+
createWhoAmIApi
|
|
4038
4955
|
});
|