@spscommerce/asst-api 4.3.0 → 4.5.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/dist/{SpsItemIdResponse-CI_Ao86P.d.cts → SpsItemIdResponse-gAHfCzwP.d.cts} +22 -14
- package/dist/{SpsItemIdResponse-CI_Ao86P.d.ts → SpsItemIdResponse-gAHfCzwP.d.ts} +22 -14
- package/dist/{chunk-LKUGPDIT.js → chunk-BMTYM2N6.js} +33 -4
- package/dist/{chunk-CI3ZSIT4.js → chunk-VS3QNXZF.js} +146 -37
- package/dist/{chunk-55ECRTUX.js → chunk-WX4LGXJV.js} +1 -1
- package/dist/index.cjs +174 -40
- package/dist/index.d.cts +141 -14
- package/dist/index.d.ts +141 -14
- package/dist/index.js +3 -3
- package/dist/msw.cjs +85 -7
- package/dist/msw.d.cts +43 -12
- package/dist/msw.d.ts +43 -12
- package/dist/msw.js +50 -4
- package/dist/{zod-C41Rts8D.d.cts → zod-C-emh7a3.d.cts} +10 -46
- package/dist/{zod-COyz02Lh.d.ts → zod-D3Xe9bw3.d.ts} +10 -46
- package/dist/zod.cjs +31 -4
- package/dist/zod.d.cts +2 -2
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +2 -3
- package/dist/SpsItemIdResponse-0VgfCmG_.d.cts +0 -84
- package/dist/SpsItemIdResponse-0VgfCmG_.d.ts +0 -84
- package/dist/SpsItemIdResponse-s0vCXepG.d.cts +0 -74
- package/dist/SpsItemIdResponse-s0vCXepG.d.ts +0 -74
- package/dist/chunk-355LPVI6.js +0 -126
- package/dist/chunk-63KIELUR.js +0 -128
- package/dist/chunk-DK2OMRWR.js +0 -134
- package/dist/chunk-FCUIJXCD.js +0 -544
- package/dist/chunk-L4AWOEED.js +0 -4892
- package/dist/chunk-NFZI7D22.js +0 -544
- package/dist/chunk-NUUQDRHD.js +0 -4899
- package/dist/chunk-RPGGEEFE.js +0 -79
- package/dist/zod-C3fOiO-H.d.cts +0 -5900
- package/dist/zod-CJ6AFTQr.d.ts +0 -5900
- package/dist/zod-CJmsC_DX.d.cts +0 -5900
- package/dist/zod-CzPw-bfk.d.cts +0 -5900
- package/dist/zod-vDuspd-x.d.ts +0 -5900
- package/dist/zod-xWM6u1LJ.d.ts +0 -5900
|
@@ -2,9 +2,6 @@ import * as ky from 'ky';
|
|
|
2
2
|
import { Options } from 'ky';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
declare const companyTypeEnumSchema: z.ZodEnum<["RETAILER", "SUPPLIER"]>;
|
|
6
|
-
type CompanyType = z.infer<typeof companyTypeEnumSchema>;
|
|
7
|
-
|
|
8
5
|
declare const baseUrlsSchema: z.ZodObject<{
|
|
9
6
|
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
10
7
|
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
@@ -31,16 +28,6 @@ type Listener = (config: AsstClientOptions) => void;
|
|
|
31
28
|
declare class AsstClient {
|
|
32
29
|
#private;
|
|
33
30
|
constructor(options?: AsstClientOptions);
|
|
34
|
-
/**
|
|
35
|
-
* Set company type that will be automatically added to all requests
|
|
36
|
-
* @param companyType Company type to add to all requests ('RETAILER' | 'SUPPLIER')
|
|
37
|
-
*/
|
|
38
|
-
setCompanyType(companyType: CompanyType | undefined): this;
|
|
39
|
-
/**
|
|
40
|
-
* Get the current company type
|
|
41
|
-
* @returns Current company type or undefined if not set
|
|
42
|
-
*/
|
|
43
|
-
getCompanyType(): CompanyType | undefined;
|
|
44
31
|
updateConfig(options: AsstClientOptions): void;
|
|
45
32
|
getBaseUrl(): AsstUrl;
|
|
46
33
|
/**
|
|
@@ -57,6 +44,27 @@ declare class AsstClient {
|
|
|
57
44
|
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
58
45
|
}
|
|
59
46
|
|
|
47
|
+
declare const companyBriefByOrgSchema: z.ZodObject<{
|
|
48
|
+
companyId: z.ZodNumber;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
orgId: z.ZodString;
|
|
51
|
+
companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
|
|
52
|
+
dc4Id: z.ZodNumber;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
name: string;
|
|
55
|
+
companyId: number;
|
|
56
|
+
orgId: string;
|
|
57
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
58
|
+
dc4Id: number;
|
|
59
|
+
}, {
|
|
60
|
+
name: string;
|
|
61
|
+
companyId: number;
|
|
62
|
+
orgId: string;
|
|
63
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
64
|
+
dc4Id: number;
|
|
65
|
+
}>;
|
|
66
|
+
type CompanyBriefByOrg = z.infer<typeof companyBriefByOrgSchema>;
|
|
67
|
+
|
|
60
68
|
type Hierarchy = {
|
|
61
69
|
id: string;
|
|
62
70
|
name?: string | null;
|
|
@@ -84,4 +92,4 @@ declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
|
84
92
|
}>;
|
|
85
93
|
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
86
94
|
|
|
87
|
-
export { AsstClient as A, BASE_URLS as B, type
|
|
95
|
+
export { AsstClient as A, BASE_URLS as B, type CompanyBriefByOrg as C, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, companyBriefByOrgSchema as c, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -2,9 +2,6 @@ import * as ky from 'ky';
|
|
|
2
2
|
import { Options } from 'ky';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
declare const companyTypeEnumSchema: z.ZodEnum<["RETAILER", "SUPPLIER"]>;
|
|
6
|
-
type CompanyType = z.infer<typeof companyTypeEnumSchema>;
|
|
7
|
-
|
|
8
5
|
declare const baseUrlsSchema: z.ZodObject<{
|
|
9
6
|
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
10
7
|
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
@@ -31,16 +28,6 @@ type Listener = (config: AsstClientOptions) => void;
|
|
|
31
28
|
declare class AsstClient {
|
|
32
29
|
#private;
|
|
33
30
|
constructor(options?: AsstClientOptions);
|
|
34
|
-
/**
|
|
35
|
-
* Set company type that will be automatically added to all requests
|
|
36
|
-
* @param companyType Company type to add to all requests ('RETAILER' | 'SUPPLIER')
|
|
37
|
-
*/
|
|
38
|
-
setCompanyType(companyType: CompanyType | undefined): this;
|
|
39
|
-
/**
|
|
40
|
-
* Get the current company type
|
|
41
|
-
* @returns Current company type or undefined if not set
|
|
42
|
-
*/
|
|
43
|
-
getCompanyType(): CompanyType | undefined;
|
|
44
31
|
updateConfig(options: AsstClientOptions): void;
|
|
45
32
|
getBaseUrl(): AsstUrl;
|
|
46
33
|
/**
|
|
@@ -57,6 +44,27 @@ declare class AsstClient {
|
|
|
57
44
|
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
58
45
|
}
|
|
59
46
|
|
|
47
|
+
declare const companyBriefByOrgSchema: z.ZodObject<{
|
|
48
|
+
companyId: z.ZodNumber;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
orgId: z.ZodString;
|
|
51
|
+
companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
|
|
52
|
+
dc4Id: z.ZodNumber;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
name: string;
|
|
55
|
+
companyId: number;
|
|
56
|
+
orgId: string;
|
|
57
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
58
|
+
dc4Id: number;
|
|
59
|
+
}, {
|
|
60
|
+
name: string;
|
|
61
|
+
companyId: number;
|
|
62
|
+
orgId: string;
|
|
63
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
64
|
+
dc4Id: number;
|
|
65
|
+
}>;
|
|
66
|
+
type CompanyBriefByOrg = z.infer<typeof companyBriefByOrgSchema>;
|
|
67
|
+
|
|
60
68
|
type Hierarchy = {
|
|
61
69
|
id: string;
|
|
62
70
|
name?: string | null;
|
|
@@ -84,4 +92,4 @@ declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
|
84
92
|
}>;
|
|
85
93
|
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
86
94
|
|
|
87
|
-
export { AsstClient as A, BASE_URLS as B, type
|
|
95
|
+
export { AsstClient as A, BASE_URLS as B, type CompanyBriefByOrg as C, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, companyBriefByOrgSchema as c, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -4227,6 +4227,33 @@ var itemHierarchyResponseSchema = external_exports.object({
|
|
|
4227
4227
|
)
|
|
4228
4228
|
});
|
|
4229
4229
|
|
|
4230
|
+
// lib/categories/models/CatalogManagement.ts
|
|
4231
|
+
var catalogCreateRequestSchema = external_exports.object({
|
|
4232
|
+
type: external_exports.string(),
|
|
4233
|
+
name: external_exports.string(),
|
|
4234
|
+
companyId: external_exports.number()
|
|
4235
|
+
});
|
|
4236
|
+
var catalogCreateResponseSchema = external_exports.object({
|
|
4237
|
+
categoryid: external_exports.number()
|
|
4238
|
+
});
|
|
4239
|
+
var catalogSearchParamsSchema = external_exports.object({
|
|
4240
|
+
ownerCompanyIds: external_exports.array(external_exports.number()).optional(),
|
|
4241
|
+
searchTerms: external_exports.string().optional(),
|
|
4242
|
+
categoryType: external_exports.literal("CATALOG")
|
|
4243
|
+
});
|
|
4244
|
+
var catalogBriefResponseSchema = external_exports.object({
|
|
4245
|
+
categoryId: external_exports.number(),
|
|
4246
|
+
categoryName: external_exports.string(),
|
|
4247
|
+
categoryDescription: external_exports.string(),
|
|
4248
|
+
categoryDescriptionExt: external_exports.string(),
|
|
4249
|
+
ownerCompanyId: external_exports.string(),
|
|
4250
|
+
categoryTypeId: external_exports.number(),
|
|
4251
|
+
createdAt: external_exports.string(),
|
|
4252
|
+
modifiedAt: external_exports.string(),
|
|
4253
|
+
createdBy: external_exports.string(),
|
|
4254
|
+
modifiedBy: external_exports.string()
|
|
4255
|
+
});
|
|
4256
|
+
|
|
4230
4257
|
// lib/locale/models/Locale.ts
|
|
4231
4258
|
var localeSchema = external_exports.object({
|
|
4232
4259
|
localeCode: external_exports.string(),
|
|
@@ -4815,15 +4842,15 @@ var itemErrorDetailsResultV2Schema = external_exports.object({
|
|
|
4815
4842
|
itemErrorDetails: external_exports.array(itemErrorDetailsV2Schema)
|
|
4816
4843
|
});
|
|
4817
4844
|
|
|
4845
|
+
// lib/companies/models/CompanyType.ts
|
|
4846
|
+
var companyTypeSchema = external_exports.enum(["SUPPLIER", "RETAILER"]);
|
|
4847
|
+
|
|
4818
4848
|
// lib/companies/models/CompanyBriefByOrg.ts
|
|
4819
4849
|
var companyBriefByOrgSchema = external_exports.object({
|
|
4820
4850
|
companyId: external_exports.number(),
|
|
4821
4851
|
name: external_exports.string(),
|
|
4822
4852
|
orgId: external_exports.string(),
|
|
4823
|
-
|
|
4824
|
-
type: external_exports.enum(["SUPPLIER", "RETAILER"]),
|
|
4825
|
-
display: external_exports.enum(["SUPPLIER", "RETAILER"])
|
|
4826
|
-
}),
|
|
4853
|
+
companyTypes: external_exports.array(companyTypeSchema),
|
|
4827
4854
|
dc4Id: external_exports.number()
|
|
4828
4855
|
});
|
|
4829
4856
|
|
|
@@ -4849,6 +4876,8 @@ export {
|
|
|
4849
4876
|
itemCategorySchema,
|
|
4850
4877
|
itemCategoriesSearchSchema,
|
|
4851
4878
|
itemHierarchyResponseSchema,
|
|
4879
|
+
catalogCreateResponseSchema,
|
|
4880
|
+
catalogBriefResponseSchema,
|
|
4852
4881
|
localeSchema,
|
|
4853
4882
|
spreadsheetTemplateCompanySchema,
|
|
4854
4883
|
spreadsheetTemplateSchema,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
attrProdTypeSchema,
|
|
3
|
+
catalogBriefResponseSchema,
|
|
4
|
+
catalogCreateResponseSchema,
|
|
3
5
|
companyBriefByOrgSchema,
|
|
4
6
|
external_exports,
|
|
5
7
|
importErrorsSchema,
|
|
@@ -20,11 +22,23 @@ import {
|
|
|
20
22
|
tradingPartnerAccessByCompanyIdSchema,
|
|
21
23
|
userAccountSchema,
|
|
22
24
|
vendorPartnerAttGroupsSchema
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-BMTYM2N6.js";
|
|
26
|
+
|
|
27
|
+
// lib/util.ts
|
|
28
|
+
function getCompanyTypeSearchParams({
|
|
29
|
+
params,
|
|
30
|
+
companyType
|
|
31
|
+
}) {
|
|
32
|
+
const merged = {
|
|
33
|
+
...params ?? {},
|
|
34
|
+
...companyType ? { companyType } : {}
|
|
35
|
+
};
|
|
36
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
37
|
+
}
|
|
24
38
|
|
|
25
39
|
// lib/imports/index.ts
|
|
26
40
|
var BASE_URL = "imports";
|
|
27
|
-
function createImportsApi(client) {
|
|
41
|
+
function createImportsApi(client, companyType) {
|
|
28
42
|
async function getImportErrors(importId, params, signal) {
|
|
29
43
|
const data = await client.get(`${BASE_URL}/${importId}/errors`, { searchParams: params, signal }).json();
|
|
30
44
|
return importErrorsSchema.parse(data);
|
|
@@ -37,22 +51,28 @@ function createImportsApi(client) {
|
|
|
37
51
|
return importSchema.parse(data);
|
|
38
52
|
}
|
|
39
53
|
async function getImportsStatus(signal) {
|
|
40
|
-
const data = await client.get(`${BASE_URL}/status`, {
|
|
54
|
+
const data = await client.get(`${BASE_URL}/status`, {
|
|
55
|
+
signal,
|
|
56
|
+
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
57
|
+
}).json();
|
|
41
58
|
return external_exports.array(importsStatusSchema).parse(data);
|
|
42
59
|
}
|
|
43
60
|
async function uploadImport(file) {
|
|
44
61
|
await client.post(`${BASE_URL}`, { body: file });
|
|
45
62
|
}
|
|
46
63
|
async function getVendorPartnerGroups(signal) {
|
|
47
|
-
const data = await client.get(`${BASE_URL}/template/vendor-partner-groups`, {
|
|
64
|
+
const data = await client.get(`${BASE_URL}/template/vendor-partner-groups`, {
|
|
65
|
+
signal,
|
|
66
|
+
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
67
|
+
}).json();
|
|
48
68
|
return external_exports.array(vendorPartnerAttGroupsSchema).parse(data);
|
|
49
69
|
}
|
|
50
70
|
async function generateImportTemplate(params) {
|
|
51
71
|
const response = await client.get(`${BASE_URL}/template/generate`, {
|
|
52
|
-
searchParams: params,
|
|
53
72
|
headers: {
|
|
54
73
|
Accept: "application/octet-stream"
|
|
55
74
|
},
|
|
75
|
+
searchParams: getCompanyTypeSearchParams({ params, companyType }),
|
|
56
76
|
timeout: false
|
|
57
77
|
});
|
|
58
78
|
const disposition = response.headers.get("content-disposition") || "";
|
|
@@ -82,7 +102,7 @@ function createImportsApi(client) {
|
|
|
82
102
|
// lib/exports/index.ts
|
|
83
103
|
var BASE_URL2 = "exports";
|
|
84
104
|
var BASE_URL_V2 = "v2/exports";
|
|
85
|
-
function createExportsApi(client) {
|
|
105
|
+
function createExportsApi(client, companyType) {
|
|
86
106
|
async function createExport(data, params) {
|
|
87
107
|
await client.post(`${BASE_URL_V2}/add`, {
|
|
88
108
|
json: data,
|
|
@@ -96,7 +116,7 @@ function createExportsApi(client) {
|
|
|
96
116
|
availableAttributes: params.availableAttributes?.join(",") ?? ""
|
|
97
117
|
};
|
|
98
118
|
const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
|
|
99
|
-
searchParams,
|
|
119
|
+
searchParams: getCompanyTypeSearchParams({ params: searchParams, companyType }),
|
|
100
120
|
headers: {
|
|
101
121
|
Accept: "application/octet-stream"
|
|
102
122
|
},
|
|
@@ -140,10 +160,10 @@ function createProductTypesApi(client) {
|
|
|
140
160
|
|
|
141
161
|
// lib/tradingPartners/index.ts
|
|
142
162
|
var BASE_URL4 = "trading-partner-access";
|
|
143
|
-
function createTradingPartnerAccessApi(client) {
|
|
163
|
+
function createTradingPartnerAccessApi(client, companyType) {
|
|
144
164
|
async function getAllTradingPartners(params, signal) {
|
|
145
165
|
const data = await client.get(`${BASE_URL4}/connections`, {
|
|
146
|
-
searchParams: params,
|
|
166
|
+
searchParams: getCompanyTypeSearchParams({ params, companyType }),
|
|
147
167
|
signal
|
|
148
168
|
}).json();
|
|
149
169
|
return tradingPartnerAccessByCompanyIdSchema.parse(data);
|
|
@@ -174,9 +194,10 @@ var retailerTradingPartnerStages = external_exports.array(
|
|
|
174
194
|
|
|
175
195
|
// lib/tradingPartnerSettings/index.ts
|
|
176
196
|
var BASE_URL5 = "trading-partner-settings";
|
|
177
|
-
function createTradingPartnerSettingsApi(client) {
|
|
197
|
+
function createTradingPartnerSettingsApi(client, companyType) {
|
|
178
198
|
async function getRetailerStages(signal) {
|
|
179
199
|
const data = await client.get(`${BASE_URL5}/stages/retailer-configured`, {
|
|
200
|
+
searchParams: getCompanyTypeSearchParams({ companyType }),
|
|
180
201
|
signal
|
|
181
202
|
}).json();
|
|
182
203
|
return retailerTradingPartnerStages.parse(data);
|
|
@@ -238,11 +259,41 @@ function createCategoriesApi(client) {
|
|
|
238
259
|
const data = await client.post(`${BASE_URL6}/item-hierarchy`, { json: { itemIds } }).json();
|
|
239
260
|
return itemHierarchyResponseSchema.parse(data);
|
|
240
261
|
}
|
|
262
|
+
async function createCatalog(params, signal) {
|
|
263
|
+
const data = await client.post(`${BASE_URL6}`, {
|
|
264
|
+
json: params,
|
|
265
|
+
signal
|
|
266
|
+
}).json();
|
|
267
|
+
return catalogCreateResponseSchema.parse(data);
|
|
268
|
+
}
|
|
269
|
+
async function searchCatalogsByCompany(params, signal) {
|
|
270
|
+
const url = "category/brief/CATALOG/search";
|
|
271
|
+
const searchParams = new URLSearchParams();
|
|
272
|
+
if (params.ownerCompanyIds?.length) {
|
|
273
|
+
for (const id of params.ownerCompanyIds) {
|
|
274
|
+
searchParams.append("ownerCompanyIds", id.toString());
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (params.searchTerms) {
|
|
278
|
+
searchParams.set("searchTerms", params.searchTerms);
|
|
279
|
+
}
|
|
280
|
+
const data = await client.get(url, {
|
|
281
|
+
searchParams,
|
|
282
|
+
signal
|
|
283
|
+
}).json();
|
|
284
|
+
return external_exports.array(catalogBriefResponseSchema).parse(data);
|
|
285
|
+
}
|
|
286
|
+
async function createCategoryHierarchy(searchParams) {
|
|
287
|
+
return await client.post(`${BASE_URL6}/hierarchy`, { searchParams }).json();
|
|
288
|
+
}
|
|
241
289
|
return {
|
|
242
290
|
getCatalogs,
|
|
243
291
|
getProductCodes,
|
|
244
292
|
getSelectionCodes,
|
|
245
|
-
getItemHierarchy
|
|
293
|
+
getItemHierarchy,
|
|
294
|
+
createCatalog,
|
|
295
|
+
searchCatalogsByCompany,
|
|
296
|
+
createCategoryHierarchy
|
|
246
297
|
};
|
|
247
298
|
}
|
|
248
299
|
|
|
@@ -284,15 +335,23 @@ function createWhoAmIApi(client) {
|
|
|
284
335
|
|
|
285
336
|
// lib/companyFeatures/index.ts
|
|
286
337
|
var BASE_URL10 = "feature";
|
|
287
|
-
function createCompanyFeaturesApi(client) {
|
|
338
|
+
function createCompanyFeaturesApi(client, companyType) {
|
|
339
|
+
function getSearchParams() {
|
|
340
|
+
return companyType && { companyType };
|
|
341
|
+
}
|
|
288
342
|
async function checkIfStageItemSetupIsEnabled(signal) {
|
|
289
343
|
const data = await client.get(`${BASE_URL10}/isphaseditemsetupenabled`, {
|
|
290
|
-
signal
|
|
344
|
+
signal,
|
|
345
|
+
searchParams: getSearchParams()
|
|
291
346
|
}).json();
|
|
292
347
|
return external_exports.boolean().parse(data);
|
|
293
348
|
}
|
|
349
|
+
async function enableFeatureForCompany(featureKey, companyId) {
|
|
350
|
+
await client.put(`${BASE_URL10}/${featureKey}/company/${companyId}/enable`);
|
|
351
|
+
}
|
|
294
352
|
return {
|
|
295
|
-
checkIfStageItemSetupIsEnabled
|
|
353
|
+
checkIfStageItemSetupIsEnabled,
|
|
354
|
+
enableFeatureForCompany
|
|
296
355
|
};
|
|
297
356
|
}
|
|
298
357
|
|
|
@@ -319,27 +378,35 @@ function createFeatureFlagsApi(client) {
|
|
|
319
378
|
}).json();
|
|
320
379
|
return external_exports.boolean().parse(data);
|
|
321
380
|
}
|
|
381
|
+
async function checkIfItemMatchEnabled(flagOptions = {}) {
|
|
382
|
+
const { companyId, signal } = flagOptions;
|
|
383
|
+
const path = companyId ? `${BASE_URL11}/enable-item-match-section/${companyId}/` : `${BASE_URL11}/enable-item-match-section/`;
|
|
384
|
+
const data = await client.get(path, {
|
|
385
|
+
signal
|
|
386
|
+
}).json();
|
|
387
|
+
return external_exports.boolean().parse(data);
|
|
388
|
+
}
|
|
322
389
|
return {
|
|
323
390
|
checkEnableItemsLevelMSIS,
|
|
324
391
|
checkIfEnabledForPackagingHierarchies,
|
|
325
|
-
checkIfEnabledForItemUomConversionRules
|
|
392
|
+
checkIfEnabledForItemUomConversionRules,
|
|
393
|
+
checkIfItemMatchEnabled
|
|
326
394
|
};
|
|
327
395
|
}
|
|
328
396
|
|
|
329
397
|
// lib/items/v1/index.ts
|
|
330
398
|
var BASE_URL12 = "items";
|
|
331
|
-
function createItemsApi(client) {
|
|
332
|
-
function
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
if (
|
|
337
|
-
if (
|
|
338
|
-
|
|
339
|
-
return url ? `${queryParameterString}&${url}` : queryParameterString;
|
|
399
|
+
function createItemsApi(client, companyType) {
|
|
400
|
+
function getCoalescedParams(params = {}) {
|
|
401
|
+
const queryParams = {};
|
|
402
|
+
if (params.limit !== void 0) queryParams.limit = params.limit.toString();
|
|
403
|
+
if (params.offset !== void 0) queryParams.offset = params.offset.toString();
|
|
404
|
+
if (params.applicationType) queryParams.application = params.applicationType;
|
|
405
|
+
if (params.url) queryParams.url = params.url;
|
|
406
|
+
return Object.keys(queryParams).length > 0 ? queryParams : void 0;
|
|
340
407
|
}
|
|
341
408
|
async function searchItems(params, signal) {
|
|
342
|
-
const searchParams =
|
|
409
|
+
const searchParams = getCompanyTypeSearchParams({ params: getCoalescedParams(params), companyType });
|
|
343
410
|
const data = await client.get(`${BASE_URL12}`, { searchParams, signal }).json();
|
|
344
411
|
return itemSearchViewSchema.parse(data);
|
|
345
412
|
}
|
|
@@ -350,6 +417,7 @@ function createItemsApi(client) {
|
|
|
350
417
|
async function updateItem(itemId, item) {
|
|
351
418
|
await client.put(`${BASE_URL12}/details/${itemId}`, {
|
|
352
419
|
json: { ...item },
|
|
420
|
+
searchParams: getCompanyTypeSearchParams({ companyType }),
|
|
353
421
|
timeout: 45e3
|
|
354
422
|
}).json();
|
|
355
423
|
}
|
|
@@ -364,7 +432,9 @@ function createItemsApi(client) {
|
|
|
364
432
|
await client.delete(`${BASE_URL12}`, { searchParams: params });
|
|
365
433
|
}
|
|
366
434
|
async function getItemInfoId(spsItemId, signal) {
|
|
367
|
-
const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, {
|
|
435
|
+
const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, { searchParams: getCompanyTypeSearchParams({
|
|
436
|
+
companyType
|
|
437
|
+
}), signal }).json();
|
|
368
438
|
return external_exports.number().parse(data);
|
|
369
439
|
}
|
|
370
440
|
async function getSpsItemId(itemInfoId, signal) {
|
|
@@ -372,7 +442,10 @@ function createItemsApi(client) {
|
|
|
372
442
|
return spsItemIdResponseSchema.parse(data);
|
|
373
443
|
}
|
|
374
444
|
async function getItemStatus(itemIds) {
|
|
375
|
-
const data = await client.post(`${BASE_URL12}/status`, {
|
|
445
|
+
const data = await client.post(`${BASE_URL12}/status`, {
|
|
446
|
+
json: { itemIds },
|
|
447
|
+
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
448
|
+
}).json();
|
|
376
449
|
return itemStatusResponseSchema.parse(data);
|
|
377
450
|
}
|
|
378
451
|
return {
|
|
@@ -389,9 +462,12 @@ function createItemsApi(client) {
|
|
|
389
462
|
|
|
390
463
|
// lib/items/v2/index.ts
|
|
391
464
|
var BASE_URL13 = "v2/items";
|
|
392
|
-
function createItemsApiV2(client) {
|
|
465
|
+
function createItemsApiV2(client, companyType) {
|
|
393
466
|
async function getItemStatus(itemIds) {
|
|
394
|
-
const data = await client.post(`${BASE_URL13}/status`, {
|
|
467
|
+
const data = await client.post(`${BASE_URL13}/status`, {
|
|
468
|
+
json: { itemIds },
|
|
469
|
+
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
470
|
+
}).json();
|
|
395
471
|
return itemStatusV2ResponseSchema.parse(data);
|
|
396
472
|
}
|
|
397
473
|
return {
|
|
@@ -401,9 +477,10 @@ function createItemsApiV2(client) {
|
|
|
401
477
|
|
|
402
478
|
// lib/errors/v1/index.ts
|
|
403
479
|
var BASE_URL14 = "errors";
|
|
404
|
-
function createErrorsApi(client) {
|
|
480
|
+
function createErrorsApi(client, companyType) {
|
|
405
481
|
async function getInvalidItemErrorDetails(itemInfoId, signal) {
|
|
406
482
|
const data = await client.get(`${BASE_URL14}/items/${itemInfoId}`, {
|
|
483
|
+
searchParams: getCompanyTypeSearchParams({ companyType }),
|
|
407
484
|
signal
|
|
408
485
|
}).json();
|
|
409
486
|
return itemErrorDetailsResultSchema.parse(data);
|
|
@@ -415,23 +492,31 @@ function createErrorsApi(client) {
|
|
|
415
492
|
|
|
416
493
|
// lib/errors/v2/index.ts
|
|
417
494
|
var BASE_URL15 = "errors/v2";
|
|
418
|
-
function createErrorsApiV2(client) {
|
|
495
|
+
function createErrorsApiV2(client, companyType) {
|
|
419
496
|
async function getItemErrorSummary(params, signal) {
|
|
420
497
|
const searchParams = new URLSearchParams();
|
|
421
|
-
if (params.searchField)
|
|
498
|
+
if (params.searchField)
|
|
499
|
+
searchParams.append("searchField", params.searchField);
|
|
422
500
|
if (params.searchText) searchParams.append("searchText", params.searchText);
|
|
423
501
|
if (params.tradingPartnerIds) {
|
|
424
|
-
params.tradingPartnerIds.forEach(
|
|
502
|
+
params.tradingPartnerIds.forEach(
|
|
503
|
+
(id) => searchParams.append("tradingPartnerIds", id.toString())
|
|
504
|
+
);
|
|
425
505
|
}
|
|
426
506
|
if (params.offset) searchParams.append("offset", params.offset.toString());
|
|
427
507
|
if (params.limit) searchParams.append("limit", params.limit.toString());
|
|
428
|
-
if (params.docInEventId)
|
|
508
|
+
if (params.docInEventId)
|
|
509
|
+
searchParams.append("docInEventId", params.docInEventId);
|
|
429
510
|
if (params.importId) searchParams.append("importId", params.importId);
|
|
511
|
+
if (companyType) searchParams.append("companyType", companyType);
|
|
430
512
|
const data = await client.get(`${BASE_URL15}/summary`, { signal, searchParams }).json();
|
|
431
513
|
return itemErrorSummaryResultV2Schema.parse(data);
|
|
432
514
|
}
|
|
433
515
|
async function getItemErrorDetails(itemInfoId, signal) {
|
|
434
|
-
const data = await client.get(`${BASE_URL15}/items/${itemInfoId}`, {
|
|
516
|
+
const data = await client.get(`${BASE_URL15}/items/${itemInfoId}`, {
|
|
517
|
+
searchParams: getCompanyTypeSearchParams({ companyType }),
|
|
518
|
+
signal
|
|
519
|
+
}).json();
|
|
435
520
|
return itemErrorDetailsResultV2Schema.parse(data);
|
|
436
521
|
}
|
|
437
522
|
return {
|
|
@@ -470,9 +555,20 @@ var FlattenedItemIdentifierKeysSchema = external_exports.enum(
|
|
|
470
555
|
FlattenedItemIdentifierKeys
|
|
471
556
|
);
|
|
472
557
|
|
|
558
|
+
// lib/uniqueCriteria/models/UniqueCriteriaOptionsSchema.ts
|
|
559
|
+
var uniqueCriteriaOptions = external_exports.object({
|
|
560
|
+
name: external_exports.string(),
|
|
561
|
+
value: external_exports.string()
|
|
562
|
+
});
|
|
563
|
+
var uniqueCriteriaOptionsSchema = external_exports.array(uniqueCriteriaOptions);
|
|
564
|
+
|
|
473
565
|
// lib/uniqueCriteria/index.ts
|
|
474
566
|
var BASE_URL16 = "uniquecriteria";
|
|
475
567
|
function createUniqueCriteriaApi(client) {
|
|
568
|
+
async function getUniqueCriteriaOptions() {
|
|
569
|
+
const data = await client.get(`${BASE_URL16}`).json();
|
|
570
|
+
return uniqueCriteriaOptionsSchema.parse(data);
|
|
571
|
+
}
|
|
476
572
|
async function getUniqueCriteriaByOrg(params, signal) {
|
|
477
573
|
const data = await client.get(`${BASE_URL16}/org`, {
|
|
478
574
|
searchParams: params,
|
|
@@ -487,11 +583,24 @@ function createUniqueCriteriaApi(client) {
|
|
|
487
583
|
}).json();
|
|
488
584
|
return external_exports.array(FlattenedItemIdentifierKeysSchema).parse(data);
|
|
489
585
|
}
|
|
490
|
-
|
|
586
|
+
async function updateMultipleUniqueCriteriaAttributes(uniqueAttributes, companyId) {
|
|
587
|
+
await client.put(`${BASE_URL16}/multiple/${companyId}`, {
|
|
588
|
+
json: uniqueAttributes,
|
|
589
|
+
headers: {
|
|
590
|
+
"Content-Type": "application/json"
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
return {
|
|
595
|
+
getUniqueCriteriaOptions,
|
|
596
|
+
getUniqueCriteriaByOrg,
|
|
597
|
+
getProductUniqueCriteriaByOrg,
|
|
598
|
+
updateMultipleUniqueCriteriaAttributes
|
|
599
|
+
};
|
|
491
600
|
}
|
|
492
601
|
|
|
493
602
|
// lib/companies/index.ts
|
|
494
|
-
var BASE_URL17 = "companys";
|
|
603
|
+
var BASE_URL17 = "v3/companys";
|
|
495
604
|
function createCompaniesApi(client) {
|
|
496
605
|
async function getCompanyBriefInfoByOrg(params, signal) {
|
|
497
606
|
const data = await client.get(`${BASE_URL17}/brief`, {
|