@spscommerce/asst-api 5.3.0 → 5.3.3
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/{CompanySearch-7_L0_02Y.d.cts → CompanySearch-BbVFcsAx.d.ts} +1 -1
- package/dist/{SpsItemIdResponse-CSZKx_Tz.d.cts → SpsItemIdResponse-CorAaMf-.d.ts} +6 -6
- package/dist/chunk-ATHXI7QZ.js +1049 -0
- package/dist/{chunk-35CHQUKC.js → chunk-FECWD4HI.js} +101 -42
- package/dist/{chunk-XSWAONLH.js → chunk-JOTJ2YCI.js} +5 -8
- package/dist/index.cjs +1553 -4590
- package/dist/index.d.ts +8 -7
- package/dist/index.js +3 -3
- package/dist/msw.cjs +765 -4642
- package/dist/msw.d.ts +3 -2
- package/dist/msw.js +41 -25
- package/dist/{zod-CFHO1Ktc.d.cts → zod-BTAcqNX0.d.ts} +21 -4
- package/dist/zod.cjs +736 -4654
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +49 -36
- package/package.json +17 -11
- package/dist/CompanySearch-7_L0_02Y.d.ts +0 -313
- package/dist/SpsItemIdResponse-CSZKx_Tz.d.ts +0 -102
- package/dist/chunk-3H53DOKQ.js +0 -5009
- package/dist/index.d.cts +0 -994
- package/dist/msw.d.cts +0 -808
- package/dist/zod-DOSs4Eg9.d.ts +0 -5876
- package/dist/zod.d.cts +0 -4
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
companyBriefByOrgSchema,
|
|
6
6
|
companySchema,
|
|
7
7
|
companySearchSchema,
|
|
8
|
-
external_exports,
|
|
9
8
|
importErrorsSchema,
|
|
10
9
|
importSchema,
|
|
11
10
|
importsStatusSchema,
|
|
@@ -23,7 +22,10 @@ import {
|
|
|
23
22
|
tradingPartnerAccessByCompanyIdSchema,
|
|
24
23
|
userAccountSchema,
|
|
25
24
|
vendorPartnerAttGroupsSchema
|
|
26
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ATHXI7QZ.js";
|
|
26
|
+
|
|
27
|
+
// lib/imports/index.ts
|
|
28
|
+
import { z } from "zod";
|
|
27
29
|
|
|
28
30
|
// lib/util.ts
|
|
29
31
|
function getCompanyTypeSearchParams({
|
|
@@ -56,7 +58,7 @@ function createImportsApi(client) {
|
|
|
56
58
|
signal,
|
|
57
59
|
searchParams: getCompanyTypeSearchParams({ companyType: client.getCompanyType() })
|
|
58
60
|
}).json();
|
|
59
|
-
return
|
|
61
|
+
return z.array(importsStatusSchema).parse(data);
|
|
60
62
|
}
|
|
61
63
|
async function uploadImport(file) {
|
|
62
64
|
await client.post(`${BASE_URL}`, { body: file });
|
|
@@ -66,7 +68,7 @@ function createImportsApi(client) {
|
|
|
66
68
|
signal,
|
|
67
69
|
searchParams: getCompanyTypeSearchParams({ companyType: client.getCompanyType() })
|
|
68
70
|
}).json();
|
|
69
|
-
return
|
|
71
|
+
return z.array(vendorPartnerAttGroupsSchema).parse(data);
|
|
70
72
|
}
|
|
71
73
|
async function generateImportTemplate(params) {
|
|
72
74
|
const response = await client.get(`${BASE_URL}/template/generate`, {
|
|
@@ -103,6 +105,7 @@ function createImportsApi(client) {
|
|
|
103
105
|
// lib/exports/index.ts
|
|
104
106
|
var BASE_URL2 = "exports";
|
|
105
107
|
var BASE_URL_V2 = "v2/exports";
|
|
108
|
+
var BASE_URL_XREF = "xref/spreadsheet-export";
|
|
106
109
|
function createExportsApi(client) {
|
|
107
110
|
async function createExport(data, params) {
|
|
108
111
|
await client.post(`${BASE_URL_V2}/add`, {
|
|
@@ -111,16 +114,21 @@ function createExportsApi(client) {
|
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
116
|
async function downloadItems(params) {
|
|
114
|
-
const searchParams =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
const searchParams = new URLSearchParams();
|
|
118
|
+
searchParams.append("multi-sheet", String(params["multi-sheet"]));
|
|
119
|
+
params.ids.forEach((id) => searchParams.append("ids", id));
|
|
120
|
+
params.availableAttributes?.forEach(
|
|
121
|
+
(attr) => searchParams.append("availableAttributes", attr)
|
|
122
|
+
);
|
|
123
|
+
if (params.ownerOrgId) {
|
|
124
|
+
searchParams.append("ownerOrgId", params.ownerOrgId);
|
|
125
|
+
}
|
|
126
|
+
const companyType = client.getCompanyType();
|
|
127
|
+
if (companyType) {
|
|
128
|
+
searchParams.append("companyType", companyType);
|
|
129
|
+
}
|
|
130
|
+
const response = await client.get(`${BASE_URL_XREF}/by-item`, {
|
|
131
|
+
searchParams,
|
|
124
132
|
headers: {
|
|
125
133
|
Accept: "application/octet-stream"
|
|
126
134
|
},
|
|
@@ -140,13 +148,50 @@ function createExportsApi(client) {
|
|
|
140
148
|
link.click();
|
|
141
149
|
link.remove();
|
|
142
150
|
}
|
|
151
|
+
async function downloadCatalogedItems(params) {
|
|
152
|
+
const searchParams = new URLSearchParams();
|
|
153
|
+
searchParams.append("multi-sheet", String(params["multi-sheet"]));
|
|
154
|
+
searchParams.append("ids", params.ids.join(","));
|
|
155
|
+
if (params.availableAttributes?.length) {
|
|
156
|
+
searchParams.append("availableAttributes", params.availableAttributes.join(","));
|
|
157
|
+
}
|
|
158
|
+
if (params.orgId) {
|
|
159
|
+
searchParams.append("orgId", params.orgId);
|
|
160
|
+
}
|
|
161
|
+
const companyType = client.getCompanyType();
|
|
162
|
+
if (companyType) {
|
|
163
|
+
searchParams.append("companyType", companyType);
|
|
164
|
+
}
|
|
165
|
+
const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
|
|
166
|
+
searchParams,
|
|
167
|
+
headers: {
|
|
168
|
+
Accept: "application/octet-stream"
|
|
169
|
+
},
|
|
170
|
+
timeout: false
|
|
171
|
+
});
|
|
172
|
+
const disposition = response.headers.get("content-disposition") || "";
|
|
173
|
+
const filename = disposition.match(/filename="(.+)"/)?.[1];
|
|
174
|
+
const downloadUrl = window.URL.createObjectURL(
|
|
175
|
+
await response.blob()
|
|
176
|
+
);
|
|
177
|
+
const link = document.createElement("a");
|
|
178
|
+
link.href = downloadUrl;
|
|
179
|
+
if (filename) {
|
|
180
|
+
link.download = filename;
|
|
181
|
+
}
|
|
182
|
+
document.body.appendChild(link);
|
|
183
|
+
link.click();
|
|
184
|
+
link.remove();
|
|
185
|
+
}
|
|
143
186
|
return {
|
|
144
187
|
createExport,
|
|
145
|
-
downloadItems
|
|
188
|
+
downloadItems,
|
|
189
|
+
downloadCatalogedItems
|
|
146
190
|
};
|
|
147
191
|
}
|
|
148
192
|
|
|
149
193
|
// lib/productTypes/index.ts
|
|
194
|
+
import { z as z2 } from "zod";
|
|
150
195
|
var BASE_URL3 = "product-types";
|
|
151
196
|
function createProductTypesApi(client) {
|
|
152
197
|
async function getProductTypes(params, signal) {
|
|
@@ -155,7 +200,7 @@ function createProductTypesApi(client) {
|
|
|
155
200
|
searchParams,
|
|
156
201
|
signal
|
|
157
202
|
}).json();
|
|
158
|
-
return
|
|
203
|
+
return z2.array(attrProdTypeSchema).parse(data.results);
|
|
159
204
|
}
|
|
160
205
|
return {
|
|
161
206
|
getProductTypes
|
|
@@ -189,8 +234,9 @@ function createTradingPartnerAccessApi(client) {
|
|
|
189
234
|
}
|
|
190
235
|
|
|
191
236
|
// lib/tradingPartnerSettings/models/RetailerTradingPartnerStages.ts
|
|
192
|
-
|
|
193
|
-
|
|
237
|
+
import { z as z3 } from "zod";
|
|
238
|
+
var retailerTradingPartnerStages = z3.array(
|
|
239
|
+
z3.enum([
|
|
194
240
|
"Core",
|
|
195
241
|
"Core Plus",
|
|
196
242
|
"Core Advanced",
|
|
@@ -215,6 +261,7 @@ function createTradingPartnerSettingsApi(client) {
|
|
|
215
261
|
}
|
|
216
262
|
|
|
217
263
|
// lib/categories/index.ts
|
|
264
|
+
import { z as z4 } from "zod";
|
|
218
265
|
var BASE_URL6 = "categories";
|
|
219
266
|
function createCategoriesApi(client) {
|
|
220
267
|
async function getCatalogs(params, signal) {
|
|
@@ -298,7 +345,7 @@ function createCategoriesApi(client) {
|
|
|
298
345
|
searchParams,
|
|
299
346
|
signal
|
|
300
347
|
}).json();
|
|
301
|
-
return
|
|
348
|
+
return z4.array(catalogBriefResponseSchema).parse(data);
|
|
302
349
|
}
|
|
303
350
|
async function createCategoryHierarchy(searchParams) {
|
|
304
351
|
return await client.post(`${BASE_URL6}/hierarchy`, {
|
|
@@ -320,11 +367,12 @@ function createCategoriesApi(client) {
|
|
|
320
367
|
}
|
|
321
368
|
|
|
322
369
|
// lib/locale/index.ts
|
|
370
|
+
import { z as z5 } from "zod";
|
|
323
371
|
var BASE_URL7 = "locale";
|
|
324
372
|
function createLocaleApi(client) {
|
|
325
373
|
async function getLocale(signal) {
|
|
326
374
|
const data = await client.get(`${BASE_URL7}`, { signal }).json();
|
|
327
|
-
return
|
|
375
|
+
return z5.array(localeSchema).parse(data);
|
|
328
376
|
}
|
|
329
377
|
return {
|
|
330
378
|
getLocale
|
|
@@ -332,11 +380,12 @@ function createLocaleApi(client) {
|
|
|
332
380
|
}
|
|
333
381
|
|
|
334
382
|
// lib/spreadsheetTemplate/index.ts
|
|
383
|
+
import { z as z6 } from "zod";
|
|
335
384
|
var BASE_URL8 = "templates";
|
|
336
385
|
function createSpreadsheetTemplateApi(client) {
|
|
337
386
|
async function getTemplates(params, signal) {
|
|
338
387
|
const data = await client.get(`${BASE_URL8}`, { searchParams: params, signal }).json();
|
|
339
|
-
return
|
|
388
|
+
return z6.array(spreadsheetTemplateSchema).parse(data);
|
|
340
389
|
}
|
|
341
390
|
return {
|
|
342
391
|
getTemplates
|
|
@@ -356,19 +405,20 @@ function createWhoAmIApi(client) {
|
|
|
356
405
|
}
|
|
357
406
|
|
|
358
407
|
// lib/companyFeatures/index.ts
|
|
408
|
+
import { z as z7 } from "zod";
|
|
359
409
|
var BASE_URL10 = "feature";
|
|
360
|
-
var companyFeatureSchema =
|
|
410
|
+
var companyFeatureSchema = z7.object({
|
|
361
411
|
/**
|
|
362
412
|
* Validated as a string at runtime so that unknown feature types returned by the
|
|
363
413
|
* backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
|
|
364
414
|
* type is narrowed to `FeatureType` so callers still get compile-time checking when
|
|
365
415
|
* comparing against known values.
|
|
366
416
|
*/
|
|
367
|
-
type:
|
|
368
|
-
display:
|
|
369
|
-
active:
|
|
370
|
-
assortmentSystemInstanceId:
|
|
371
|
-
defaultCatalogId:
|
|
417
|
+
type: z7.string(),
|
|
418
|
+
display: z7.string(),
|
|
419
|
+
active: z7.boolean(),
|
|
420
|
+
assortmentSystemInstanceId: z7.string().nullish(),
|
|
421
|
+
defaultCatalogId: z7.number().nullish()
|
|
372
422
|
});
|
|
373
423
|
function createCompanyFeaturesApi(client, companyType) {
|
|
374
424
|
function getSearchParams() {
|
|
@@ -379,11 +429,11 @@ function createCompanyFeaturesApi(client, companyType) {
|
|
|
379
429
|
signal,
|
|
380
430
|
searchParams: getSearchParams()
|
|
381
431
|
}).json();
|
|
382
|
-
return
|
|
432
|
+
return z7.boolean().parse(data);
|
|
383
433
|
}
|
|
384
434
|
async function getFeaturesForCompany(companyId, signal) {
|
|
385
435
|
const data = await client.get(`${BASE_URL10}/company/${companyId}`, { signal }).json();
|
|
386
|
-
return
|
|
436
|
+
return z7.array(companyFeatureSchema).parse(data);
|
|
387
437
|
}
|
|
388
438
|
async function enableFeatureForCompany(featureKey, companyId) {
|
|
389
439
|
await client.put(`${BASE_URL10}/${featureKey}/company/${companyId}/enable`);
|
|
@@ -396,19 +446,20 @@ function createCompanyFeaturesApi(client, companyType) {
|
|
|
396
446
|
}
|
|
397
447
|
|
|
398
448
|
// lib/featureFlags/index.ts
|
|
449
|
+
import { z as z8 } from "zod";
|
|
399
450
|
var BASE_URL11 = "feature-flag";
|
|
400
451
|
function createFeatureFlagsApi(client) {
|
|
401
452
|
async function checkEnableItemsLevelMSIS(signal) {
|
|
402
453
|
const data = await client.get(`${BASE_URL11}/enable-item-level-msis/`, {
|
|
403
454
|
signal
|
|
404
455
|
}).json();
|
|
405
|
-
return
|
|
456
|
+
return z8.boolean().parse(data);
|
|
406
457
|
}
|
|
407
458
|
async function checkIfEnabledForPackagingHierarchies(signal) {
|
|
408
459
|
const data = await client.get(`${BASE_URL11}/server-allow-import-and-export-of-packsizes-170720/`, {
|
|
409
460
|
signal
|
|
410
461
|
}).json();
|
|
411
|
-
return
|
|
462
|
+
return z8.boolean().parse(data);
|
|
412
463
|
}
|
|
413
464
|
async function checkIfEnabledForItemUomConversionRules(flagOptions = {}) {
|
|
414
465
|
const { companyId, signal } = flagOptions;
|
|
@@ -416,7 +467,7 @@ function createFeatureFlagsApi(client) {
|
|
|
416
467
|
const data = await client.get(path, {
|
|
417
468
|
signal
|
|
418
469
|
}).json();
|
|
419
|
-
return
|
|
470
|
+
return z8.boolean().parse(data);
|
|
420
471
|
}
|
|
421
472
|
async function checkIfItemMatchEnabled(flagOptions = {}) {
|
|
422
473
|
const { companyId, signal } = flagOptions;
|
|
@@ -424,7 +475,7 @@ function createFeatureFlagsApi(client) {
|
|
|
424
475
|
const data = await client.get(path, {
|
|
425
476
|
signal
|
|
426
477
|
}).json();
|
|
427
|
-
return
|
|
478
|
+
return z8.boolean().parse(data);
|
|
428
479
|
}
|
|
429
480
|
return {
|
|
430
481
|
checkEnableItemsLevelMSIS,
|
|
@@ -435,6 +486,7 @@ function createFeatureFlagsApi(client) {
|
|
|
435
486
|
}
|
|
436
487
|
|
|
437
488
|
// lib/items/v1/index.ts
|
|
489
|
+
import { z as z9 } from "zod";
|
|
438
490
|
var BASE_URL12 = "items";
|
|
439
491
|
function createItemsApi(client) {
|
|
440
492
|
function getCoalescedParams(params = {}) {
|
|
@@ -491,7 +543,7 @@ function createItemsApi(client) {
|
|
|
491
543
|
}),
|
|
492
544
|
signal
|
|
493
545
|
}).json();
|
|
494
|
-
return
|
|
546
|
+
return z9.number().parse(data);
|
|
495
547
|
}
|
|
496
548
|
async function getSpsItemId(itemInfoId, signal) {
|
|
497
549
|
const data = await client.get(`${BASE_URL12}/${itemInfoId}/spsItemId`, { signal }).json();
|
|
@@ -583,7 +635,11 @@ function createErrorsApiV2(client) {
|
|
|
583
635
|
};
|
|
584
636
|
}
|
|
585
637
|
|
|
638
|
+
// lib/uniqueCriteria/index.ts
|
|
639
|
+
import { z as z12 } from "zod";
|
|
640
|
+
|
|
586
641
|
// lib/uniqueCriteria/models/FlattenedItemIdentifierKeysSchema.ts
|
|
642
|
+
import { z as z10 } from "zod";
|
|
587
643
|
var FlattenedItemIdentifierKeys = [
|
|
588
644
|
//Nested gtin keys
|
|
589
645
|
"eaneight",
|
|
@@ -609,16 +665,17 @@ var FlattenedItemIdentifierKeys = [
|
|
|
609
665
|
"erpId",
|
|
610
666
|
"componentId"
|
|
611
667
|
];
|
|
612
|
-
var FlattenedItemIdentifierKeysSchema =
|
|
668
|
+
var FlattenedItemIdentifierKeysSchema = z10.enum(
|
|
613
669
|
FlattenedItemIdentifierKeys
|
|
614
670
|
);
|
|
615
671
|
|
|
616
672
|
// lib/uniqueCriteria/models/UniqueCriteriaOptionsSchema.ts
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
673
|
+
import { z as z11 } from "zod";
|
|
674
|
+
var uniqueCriteriaOptions = z11.object({
|
|
675
|
+
name: z11.string(),
|
|
676
|
+
value: z11.string()
|
|
620
677
|
});
|
|
621
|
-
var uniqueCriteriaOptionsSchema =
|
|
678
|
+
var uniqueCriteriaOptionsSchema = z11.array(uniqueCriteriaOptions);
|
|
622
679
|
|
|
623
680
|
// lib/uniqueCriteria/index.ts
|
|
624
681
|
var BASE_URL16 = "uniquecriteria";
|
|
@@ -632,14 +689,14 @@ function createUniqueCriteriaApi(client) {
|
|
|
632
689
|
searchParams: params,
|
|
633
690
|
signal
|
|
634
691
|
}).json();
|
|
635
|
-
return
|
|
692
|
+
return z12.array(z12.string()).parse(data);
|
|
636
693
|
}
|
|
637
694
|
async function getProductUniqueCriteriaByOrg(params, signal) {
|
|
638
695
|
const data = await client.get(`${BASE_URL16}/product/org`, {
|
|
639
696
|
searchParams: params,
|
|
640
697
|
signal
|
|
641
698
|
}).json();
|
|
642
|
-
return
|
|
699
|
+
return z12.array(FlattenedItemIdentifierKeysSchema).parse(data);
|
|
643
700
|
}
|
|
644
701
|
async function updateMultipleUniqueCriteriaAttributes(uniqueAttributes, companyId) {
|
|
645
702
|
await client.put(`${BASE_URL16}/multiple/${companyId}`, {
|
|
@@ -658,6 +715,7 @@ function createUniqueCriteriaApi(client) {
|
|
|
658
715
|
}
|
|
659
716
|
|
|
660
717
|
// lib/companies/index.ts
|
|
718
|
+
import { z as z13 } from "zod";
|
|
661
719
|
var BASE_URL17 = "v3/companys";
|
|
662
720
|
function createCompaniesApi(client) {
|
|
663
721
|
async function getCompanyBriefInfoByOrg(params, signal) {
|
|
@@ -672,7 +730,7 @@ function createCompaniesApi(client) {
|
|
|
672
730
|
searchParams: params,
|
|
673
731
|
signal
|
|
674
732
|
}).json();
|
|
675
|
-
return
|
|
733
|
+
return z13.array(companySearchSchema).parse(data);
|
|
676
734
|
}
|
|
677
735
|
async function getCompanyById(companyId, signal) {
|
|
678
736
|
const data = await client.get(`${BASE_URL17}/${companyId}`, {
|
|
@@ -702,6 +760,7 @@ export {
|
|
|
702
760
|
createImportsApi,
|
|
703
761
|
BASE_URL2,
|
|
704
762
|
BASE_URL_V2,
|
|
763
|
+
BASE_URL_XREF,
|
|
705
764
|
createExportsApi,
|
|
706
765
|
BASE_URL3,
|
|
707
766
|
createProductTypesApi,
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
external_exports
|
|
3
|
-
} from "./chunk-3H53DOKQ.js";
|
|
4
|
-
|
|
5
1
|
// lib/asstClient.ts
|
|
6
2
|
import ky from "ky";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
var baseUrlsSchema = z.object({
|
|
5
|
+
local: z.literal("https://localhost:8443/"),
|
|
6
|
+
test: z.literal(
|
|
10
7
|
"https://integration.api.spscommerce.com/assortment/gateway/"
|
|
11
8
|
),
|
|
12
|
-
prod:
|
|
9
|
+
prod: z.literal("https://api.spscommerce.com/assortment/gateway/")
|
|
13
10
|
});
|
|
14
11
|
var BASE_URLS = {
|
|
15
12
|
local: "https://localhost:8443/",
|