@spscommerce/asst-api 4.7.0 → 4.8.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/CompanySearch-T6HJx4a6.d.cts +313 -0
- package/dist/CompanySearch-T6HJx4a6.d.ts +313 -0
- package/dist/{SpsItemIdResponse-gAHfCzwP.d.cts → SpsItemIdResponse-BEq6yqtR.d.cts} +28 -23
- package/dist/{SpsItemIdResponse-gAHfCzwP.d.ts → SpsItemIdResponse-BEq6yqtR.d.ts} +28 -23
- package/dist/{chunk-BMTYM2N6.js → chunk-52RZCPMT.js} +85 -1
- package/dist/{chunk-WX4LGXJV.js → chunk-VQDRXCML.js} +8 -1
- package/dist/{chunk-IZLZKWK7.js → chunk-ZAW3TKZQ.js} +95 -33
- package/dist/index.cjs +181 -32
- package/dist/index.d.cts +112 -25
- package/dist/index.d.ts +112 -25
- package/dist/index.js +3 -3
- package/dist/msw.cjs +102 -1
- package/dist/msw.d.cts +98 -28
- package/dist/msw.d.ts +98 -28
- package/dist/msw.js +24 -3
- package/dist/{zod-C-emh7a3.d.cts → zod-CEvcMeWn.d.ts} +159 -159
- package/dist/{zod-D3Xe9bw3.d.ts → zod-DscWtu4d.d.cts} +159 -159
- package/dist/zod.cjs +82 -0
- package/dist/zod.d.cts +3 -3
- package/dist/zod.d.ts +3 -3
- package/dist/zod.js +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import * as ky from 'ky';
|
|
2
3
|
import { Options } from 'ky';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
declare const companyBriefByOrgSchema: z.ZodObject<{
|
|
6
|
+
companyId: z.ZodNumber;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
orgId: z.ZodString;
|
|
9
|
+
companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
|
|
10
|
+
dc4Id: z.ZodNumber;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
companyId: number;
|
|
13
|
+
name: string;
|
|
14
|
+
orgId: string;
|
|
15
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
16
|
+
dc4Id: number;
|
|
17
|
+
}, {
|
|
18
|
+
companyId: number;
|
|
19
|
+
name: string;
|
|
20
|
+
orgId: string;
|
|
21
|
+
companyTypes: ("SUPPLIER" | "RETAILER")[];
|
|
22
|
+
dc4Id: number;
|
|
23
|
+
}>;
|
|
24
|
+
type CompanyBriefByOrg = z.infer<typeof companyBriefByOrgSchema>;
|
|
25
|
+
|
|
26
|
+
declare const companyTypeSchema: z.ZodEnum<["SUPPLIER", "RETAILER"]>;
|
|
27
|
+
type CompanyType = z.infer<typeof companyTypeSchema>;
|
|
4
28
|
|
|
5
29
|
declare const baseUrlsSchema: z.ZodObject<{
|
|
6
30
|
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
@@ -29,7 +53,9 @@ declare class AsstClient {
|
|
|
29
53
|
#private;
|
|
30
54
|
constructor(options?: AsstClientOptions);
|
|
31
55
|
updateConfig(options: AsstClientOptions): void;
|
|
56
|
+
updateCompanyType(companyType: CompanyType): void;
|
|
32
57
|
getBaseUrl(): AsstUrl;
|
|
58
|
+
getCompanyType(): CompanyType;
|
|
33
59
|
/**
|
|
34
60
|
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
35
61
|
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
@@ -44,27 +70,6 @@ declare class AsstClient {
|
|
|
44
70
|
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
45
71
|
}
|
|
46
72
|
|
|
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
|
-
|
|
68
73
|
type Hierarchy = {
|
|
69
74
|
id: string;
|
|
70
75
|
name?: string | null;
|
|
@@ -92,4 +97,4 @@ declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
|
92
97
|
}>;
|
|
93
98
|
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
94
99
|
|
|
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
|
|
100
|
+
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 CompanyType as a, type AsstClientOptions as b, type AsstUrl as c, companyBriefByOrgSchema as d, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -4854,6 +4854,88 @@ var companyBriefByOrgSchema = external_exports.object({
|
|
|
4854
4854
|
dc4Id: external_exports.number()
|
|
4855
4855
|
});
|
|
4856
4856
|
|
|
4857
|
+
// lib/companies/models/CompanyRelationship.ts
|
|
4858
|
+
var applicationSchema = external_exports.object({
|
|
4859
|
+
application: applicationTypeSchema,
|
|
4860
|
+
relationshipApplicationId: external_exports.number()
|
|
4861
|
+
});
|
|
4862
|
+
var catalogSchema = external_exports.object({
|
|
4863
|
+
active: external_exports.boolean(),
|
|
4864
|
+
catalogId: external_exports.number(),
|
|
4865
|
+
itemPartnerId: external_exports.number()
|
|
4866
|
+
});
|
|
4867
|
+
var relationshipCompanySchema = external_exports.object({
|
|
4868
|
+
companyId: external_exports.number(),
|
|
4869
|
+
companyTypes: external_exports.array(companyTypeSchema),
|
|
4870
|
+
dc4Id: external_exports.number().nullable(),
|
|
4871
|
+
name: external_exports.string(),
|
|
4872
|
+
orgId: external_exports.string()
|
|
4873
|
+
});
|
|
4874
|
+
var relationshipSchema = external_exports.object({
|
|
4875
|
+
active: external_exports.boolean(),
|
|
4876
|
+
application: external_exports.array(applicationSchema),
|
|
4877
|
+
catalog: external_exports.array(catalogSchema),
|
|
4878
|
+
company: relationshipCompanySchema,
|
|
4879
|
+
createdAt: external_exports.number(),
|
|
4880
|
+
modifiedAt: external_exports.number().nullable(),
|
|
4881
|
+
relationshipId: external_exports.number()
|
|
4882
|
+
});
|
|
4883
|
+
|
|
4884
|
+
// lib/companies/models/Company.ts
|
|
4885
|
+
var featureResponseSchema = external_exports.object({
|
|
4886
|
+
active: external_exports.boolean(),
|
|
4887
|
+
createdBy: external_exports.string().nullable(),
|
|
4888
|
+
createdDate: external_exports.number().nullable(),
|
|
4889
|
+
display: external_exports.string(),
|
|
4890
|
+
modifiedBy: external_exports.string().nullable(),
|
|
4891
|
+
modifiedDate: external_exports.number().nullable(),
|
|
4892
|
+
type: external_exports.string()
|
|
4893
|
+
});
|
|
4894
|
+
var identitySchema = external_exports.object({
|
|
4895
|
+
orgId: external_exports.string().nullable(),
|
|
4896
|
+
service: external_exports.object({
|
|
4897
|
+
name: external_exports.string()
|
|
4898
|
+
}).nullable()
|
|
4899
|
+
});
|
|
4900
|
+
var companySchema = external_exports.object({
|
|
4901
|
+
active: external_exports.boolean(),
|
|
4902
|
+
companyId: external_exports.number(),
|
|
4903
|
+
companyTypes: external_exports.array(companyTypeSchema),
|
|
4904
|
+
createdAt: external_exports.number().nullable(),
|
|
4905
|
+
features: external_exports.array(featureResponseSchema),
|
|
4906
|
+
identity: identitySchema,
|
|
4907
|
+
modifiedAt: external_exports.number().nullable(),
|
|
4908
|
+
name: external_exports.string(),
|
|
4909
|
+
relationships: external_exports.array(relationshipSchema),
|
|
4910
|
+
uniqueAttributes: external_exports.array(external_exports.string())
|
|
4911
|
+
});
|
|
4912
|
+
|
|
4913
|
+
// lib/companies/models/CompanySearch.ts
|
|
4914
|
+
var companySearchParamsSchema = external_exports.object({
|
|
4915
|
+
name: external_exports.string().min(2).max(100).optional(),
|
|
4916
|
+
companyIds: external_exports.string().min(2).optional(),
|
|
4917
|
+
orgId: external_exports.string().min(2).optional(),
|
|
4918
|
+
catalogName: external_exports.string().min(2).max(100).optional(),
|
|
4919
|
+
catalogIds: external_exports.string().min(2).optional(),
|
|
4920
|
+
type: companyTypeSchema.optional()
|
|
4921
|
+
});
|
|
4922
|
+
var companyCatalogSchema = external_exports.object({
|
|
4923
|
+
categoryId: external_exports.number(),
|
|
4924
|
+
categoryName: external_exports.string()
|
|
4925
|
+
});
|
|
4926
|
+
var companySearchSchema = external_exports.object({
|
|
4927
|
+
id: external_exports.string(),
|
|
4928
|
+
organizationName: external_exports.string(),
|
|
4929
|
+
description: external_exports.string(),
|
|
4930
|
+
orgId: external_exports.string().optional(),
|
|
4931
|
+
roles: external_exports.array(companyTypeSchema),
|
|
4932
|
+
connections: external_exports.number(),
|
|
4933
|
+
uniqueCriteria: external_exports.array(external_exports.string()).optional(),
|
|
4934
|
+
serviceName: external_exports.string(),
|
|
4935
|
+
catalogs: external_exports.array(companyCatalogSchema),
|
|
4936
|
+
application: external_exports.array(applicationTypeSchema).optional()
|
|
4937
|
+
});
|
|
4938
|
+
|
|
4857
4939
|
export {
|
|
4858
4940
|
external_exports,
|
|
4859
4941
|
importDetailSchema,
|
|
@@ -4921,5 +5003,7 @@ export {
|
|
|
4921
5003
|
itemErrorSummaryResultV2Schema,
|
|
4922
5004
|
itemErrorDetailsV2Schema,
|
|
4923
5005
|
itemErrorDetailsResultV2Schema,
|
|
4924
|
-
companyBriefByOrgSchema
|
|
5006
|
+
companyBriefByOrgSchema,
|
|
5007
|
+
companySchema,
|
|
5008
|
+
companySearchSchema
|
|
4925
5009
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
external_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-52RZCPMT.js";
|
|
4
4
|
|
|
5
5
|
// lib/asstClient.ts
|
|
6
6
|
import ky from "ky";
|
|
@@ -26,6 +26,7 @@ var AsstClient = class {
|
|
|
26
26
|
#baseUrl = BASE_URLS["test"];
|
|
27
27
|
#listeners = /* @__PURE__ */ new Set();
|
|
28
28
|
#currentConfig = initialConfig;
|
|
29
|
+
#companyType = "SUPPLIER";
|
|
29
30
|
constructor(options) {
|
|
30
31
|
if (options) {
|
|
31
32
|
this.updateConfig(options);
|
|
@@ -39,9 +40,15 @@ var AsstClient = class {
|
|
|
39
40
|
}
|
|
40
41
|
this.#listeners.forEach((listener) => listener(options));
|
|
41
42
|
}
|
|
43
|
+
updateCompanyType(companyType) {
|
|
44
|
+
this.#companyType = companyType;
|
|
45
|
+
}
|
|
42
46
|
getBaseUrl() {
|
|
43
47
|
return this.#baseUrl;
|
|
44
48
|
}
|
|
49
|
+
getCompanyType() {
|
|
50
|
+
return this.#companyType;
|
|
51
|
+
}
|
|
45
52
|
/**
|
|
46
53
|
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
47
54
|
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
catalogBriefResponseSchema,
|
|
4
4
|
catalogCreateResponseSchema,
|
|
5
5
|
companyBriefByOrgSchema,
|
|
6
|
+
companySchema,
|
|
7
|
+
companySearchSchema,
|
|
6
8
|
external_exports,
|
|
7
9
|
importErrorsSchema,
|
|
8
10
|
importSchema,
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
tradingPartnerAccessByCompanyIdSchema,
|
|
22
24
|
userAccountSchema,
|
|
23
25
|
vendorPartnerAttGroupsSchema
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-52RZCPMT.js";
|
|
25
27
|
|
|
26
28
|
// lib/util.ts
|
|
27
29
|
function getCompanyTypeSearchParams({
|
|
@@ -37,7 +39,7 @@ function getCompanyTypeSearchParams({
|
|
|
37
39
|
|
|
38
40
|
// lib/imports/index.ts
|
|
39
41
|
var BASE_URL = "imports";
|
|
40
|
-
function createImportsApi(client
|
|
42
|
+
function createImportsApi(client) {
|
|
41
43
|
async function getImportErrors(importId, params, signal) {
|
|
42
44
|
const data = await client.get(`${BASE_URL}/${importId}/errors`, { searchParams: params, signal }).json();
|
|
43
45
|
return importErrorsSchema.parse(data);
|
|
@@ -52,7 +54,7 @@ function createImportsApi(client, companyType) {
|
|
|
52
54
|
async function getImportsStatus(signal) {
|
|
53
55
|
const data = await client.get(`${BASE_URL}/status`, {
|
|
54
56
|
signal,
|
|
55
|
-
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
57
|
+
searchParams: getCompanyTypeSearchParams({ companyType: client.getCompanyType() })
|
|
56
58
|
}).json();
|
|
57
59
|
return external_exports.array(importsStatusSchema).parse(data);
|
|
58
60
|
}
|
|
@@ -62,7 +64,7 @@ function createImportsApi(client, companyType) {
|
|
|
62
64
|
async function getVendorPartnerGroups(signal) {
|
|
63
65
|
const data = await client.get(`${BASE_URL}/template/vendor-partner-groups`, {
|
|
64
66
|
signal,
|
|
65
|
-
searchParams: getCompanyTypeSearchParams({ companyType })
|
|
67
|
+
searchParams: getCompanyTypeSearchParams({ companyType: client.getCompanyType() })
|
|
66
68
|
}).json();
|
|
67
69
|
return external_exports.array(vendorPartnerAttGroupsSchema).parse(data);
|
|
68
70
|
}
|
|
@@ -71,7 +73,7 @@ function createImportsApi(client, companyType) {
|
|
|
71
73
|
headers: {
|
|
72
74
|
Accept: "application/octet-stream"
|
|
73
75
|
},
|
|
74
|
-
searchParams: getCompanyTypeSearchParams({ params, companyType }),
|
|
76
|
+
searchParams: getCompanyTypeSearchParams({ params, companyType: client.getCompanyType() }),
|
|
75
77
|
timeout: false
|
|
76
78
|
});
|
|
77
79
|
const disposition = response.headers.get("content-disposition") || "";
|
|
@@ -101,7 +103,7 @@ function createImportsApi(client, companyType) {
|
|
|
101
103
|
// lib/exports/index.ts
|
|
102
104
|
var BASE_URL2 = "exports";
|
|
103
105
|
var BASE_URL_V2 = "v2/exports";
|
|
104
|
-
function createExportsApi(client
|
|
106
|
+
function createExportsApi(client) {
|
|
105
107
|
async function createExport(data, params) {
|
|
106
108
|
await client.post(`${BASE_URL_V2}/add`, {
|
|
107
109
|
json: data,
|
|
@@ -115,7 +117,10 @@ function createExportsApi(client, companyType) {
|
|
|
115
117
|
availableAttributes: params.availableAttributes?.join(",") ?? ""
|
|
116
118
|
};
|
|
117
119
|
const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
|
|
118
|
-
searchParams: getCompanyTypeSearchParams({
|
|
120
|
+
searchParams: getCompanyTypeSearchParams({
|
|
121
|
+
params: searchParams,
|
|
122
|
+
companyType: client.getCompanyType()
|
|
123
|
+
}),
|
|
119
124
|
headers: {
|
|
120
125
|
Accept: "application/octet-stream"
|
|
121
126
|
},
|
|
@@ -159,10 +164,13 @@ function createProductTypesApi(client) {
|
|
|
159
164
|
|
|
160
165
|
// lib/tradingPartners/index.ts
|
|
161
166
|
var BASE_URL4 = "trading-partner-access";
|
|
162
|
-
function createTradingPartnerAccessApi(client
|
|
167
|
+
function createTradingPartnerAccessApi(client) {
|
|
163
168
|
async function getAllTradingPartners(params, signal) {
|
|
164
169
|
const data = await client.get(`${BASE_URL4}/connections`, {
|
|
165
|
-
searchParams: getCompanyTypeSearchParams({
|
|
170
|
+
searchParams: getCompanyTypeSearchParams({
|
|
171
|
+
params,
|
|
172
|
+
companyType: client.getCompanyType()
|
|
173
|
+
}),
|
|
166
174
|
signal
|
|
167
175
|
}).json();
|
|
168
176
|
return tradingPartnerAccessByCompanyIdSchema.parse(data);
|
|
@@ -193,10 +201,10 @@ var retailerTradingPartnerStages = external_exports.array(
|
|
|
193
201
|
|
|
194
202
|
// lib/tradingPartnerSettings/index.ts
|
|
195
203
|
var BASE_URL5 = "trading-partner-settings";
|
|
196
|
-
function createTradingPartnerSettingsApi(client
|
|
204
|
+
function createTradingPartnerSettingsApi(client) {
|
|
197
205
|
async function getRetailerStages(signal) {
|
|
198
206
|
const data = await client.get(`${BASE_URL5}/stages/retailer-configured`, {
|
|
199
|
-
searchParams: getCompanyTypeSearchParams({ companyType }),
|
|
207
|
+
searchParams: getCompanyTypeSearchParams({ companyType: client.getCompanyType() }),
|
|
200
208
|
signal
|
|
201
209
|
}).json();
|
|
202
210
|
return retailerTradingPartnerStages.parse(data);
|
|
@@ -211,13 +219,20 @@ var BASE_URL6 = "categories";
|
|
|
211
219
|
function createCategoriesApi(client) {
|
|
212
220
|
async function getCatalogs(params, signal) {
|
|
213
221
|
const data = await client.get(`${BASE_URL6}/search-category`, {
|
|
214
|
-
searchParams: {
|
|
222
|
+
searchParams: {
|
|
223
|
+
...params,
|
|
224
|
+
type: "CATALOG",
|
|
225
|
+
companyType: client.getCompanyType()
|
|
226
|
+
},
|
|
215
227
|
signal
|
|
216
228
|
}).json();
|
|
217
229
|
return itemCategoriesSearchSchema.parse(data);
|
|
218
230
|
}
|
|
219
231
|
async function getProductCodes(params, signal) {
|
|
220
|
-
const searchParams = {
|
|
232
|
+
const searchParams = {
|
|
233
|
+
type: "PRODUCT_CODE",
|
|
234
|
+
companyType: client.getCompanyType()
|
|
235
|
+
};
|
|
221
236
|
if (params?.categoryName) {
|
|
222
237
|
searchParams.categoryName = params.categoryName;
|
|
223
238
|
}
|
|
@@ -238,7 +253,10 @@ function createCategoriesApi(client) {
|
|
|
238
253
|
return itemCategoriesSearchSchema.parse(data);
|
|
239
254
|
}
|
|
240
255
|
async function getSelectionCodes(params, signal) {
|
|
241
|
-
const searchParams = {
|
|
256
|
+
const searchParams = {
|
|
257
|
+
type: "SELECTION_CODE",
|
|
258
|
+
companyType: client.getCompanyType()
|
|
259
|
+
};
|
|
242
260
|
if (params?.categoryName) {
|
|
243
261
|
searchParams.categoryName = params.categoryName;
|
|
244
262
|
}
|
|
@@ -283,7 +301,12 @@ function createCategoriesApi(client) {
|
|
|
283
301
|
return external_exports.array(catalogBriefResponseSchema).parse(data);
|
|
284
302
|
}
|
|
285
303
|
async function createCategoryHierarchy(searchParams) {
|
|
286
|
-
return await client.post(`${BASE_URL6}/hierarchy`, {
|
|
304
|
+
return await client.post(`${BASE_URL6}/hierarchy`, {
|
|
305
|
+
searchParams: getCompanyTypeSearchParams({
|
|
306
|
+
params: searchParams,
|
|
307
|
+
companyType: client.getCompanyType()
|
|
308
|
+
})
|
|
309
|
+
}).json();
|
|
287
310
|
}
|
|
288
311
|
return {
|
|
289
312
|
getCatalogs,
|
|
@@ -395,28 +418,41 @@ function createFeatureFlagsApi(client) {
|
|
|
395
418
|
|
|
396
419
|
// lib/items/v1/index.ts
|
|
397
420
|
var BASE_URL12 = "items";
|
|
398
|
-
function createItemsApi(client
|
|
421
|
+
function createItemsApi(client) {
|
|
399
422
|
function getCoalescedParams(params = {}) {
|
|
400
423
|
const queryParams = {};
|
|
401
424
|
if (params.limit !== void 0) queryParams.limit = params.limit.toString();
|
|
402
|
-
if (params.offset !== void 0)
|
|
403
|
-
|
|
425
|
+
if (params.offset !== void 0)
|
|
426
|
+
queryParams.offset = params.offset.toString();
|
|
427
|
+
if (params.applicationType)
|
|
428
|
+
queryParams.application = params.applicationType;
|
|
404
429
|
if (params.url) queryParams.url = params.url;
|
|
405
430
|
return Object.keys(queryParams).length > 0 ? queryParams : void 0;
|
|
406
431
|
}
|
|
407
432
|
async function searchItems(params, signal) {
|
|
408
|
-
const searchParams = getCompanyTypeSearchParams({
|
|
433
|
+
const searchParams = getCompanyTypeSearchParams({
|
|
434
|
+
params: getCoalescedParams(params),
|
|
435
|
+
companyType: client.getCompanyType()
|
|
436
|
+
});
|
|
409
437
|
const data = await client.get(`${BASE_URL12}`, { searchParams, signal }).json();
|
|
410
438
|
return itemSearchViewSchema.parse(data);
|
|
411
439
|
}
|
|
412
440
|
async function getItem(itemId, locale = "en-US", signal) {
|
|
413
|
-
const data = await client.get(`${BASE_URL12}/${itemId}`, {
|
|
441
|
+
const data = await client.get(`${BASE_URL12}/${itemId}`, {
|
|
442
|
+
searchParams: getCompanyTypeSearchParams({
|
|
443
|
+
params: { locale },
|
|
444
|
+
companyType: client.getCompanyType()
|
|
445
|
+
}),
|
|
446
|
+
signal
|
|
447
|
+
}).json();
|
|
414
448
|
return itemDetailViewSchema.parse(data);
|
|
415
449
|
}
|
|
416
450
|
async function updateItem(itemId, item) {
|
|
417
451
|
await client.put(`${BASE_URL12}/details/${itemId}`, {
|
|
418
452
|
json: { ...item },
|
|
419
|
-
searchParams: getCompanyTypeSearchParams({
|
|
453
|
+
searchParams: getCompanyTypeSearchParams({
|
|
454
|
+
companyType: client.getCompanyType()
|
|
455
|
+
}),
|
|
420
456
|
timeout: 45e3
|
|
421
457
|
}).json();
|
|
422
458
|
}
|
|
@@ -431,9 +467,12 @@ function createItemsApi(client, companyType) {
|
|
|
431
467
|
await client.delete(`${BASE_URL12}`, { searchParams: params });
|
|
432
468
|
}
|
|
433
469
|
async function getItemInfoId(spsItemId, signal) {
|
|
434
|
-
const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, {
|
|
435
|
-
|
|
436
|
-
|
|
470
|
+
const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, {
|
|
471
|
+
searchParams: getCompanyTypeSearchParams({
|
|
472
|
+
companyType: client.getCompanyType()
|
|
473
|
+
}),
|
|
474
|
+
signal
|
|
475
|
+
}).json();
|
|
437
476
|
return external_exports.number().parse(data);
|
|
438
477
|
}
|
|
439
478
|
async function getSpsItemId(itemInfoId, signal) {
|
|
@@ -454,10 +493,12 @@ function createItemsApi(client, companyType) {
|
|
|
454
493
|
// lib/items/v2/index.ts
|
|
455
494
|
var BASE_URL13 = "v2/items";
|
|
456
495
|
function createItemsApiV2(client) {
|
|
457
|
-
async function getItemStatus(
|
|
496
|
+
async function getItemStatus(itemIds) {
|
|
458
497
|
const data = await client.post(`${BASE_URL13}/status`, {
|
|
459
498
|
json: { itemIds },
|
|
460
|
-
searchParams: getCompanyTypeSearchParams({
|
|
499
|
+
searchParams: getCompanyTypeSearchParams({
|
|
500
|
+
companyType: client.getCompanyType()
|
|
501
|
+
})
|
|
461
502
|
}).json();
|
|
462
503
|
return itemStatusV2ResponseSchema.parse(data);
|
|
463
504
|
}
|
|
@@ -468,10 +509,12 @@ function createItemsApiV2(client) {
|
|
|
468
509
|
|
|
469
510
|
// lib/errors/v1/index.ts
|
|
470
511
|
var BASE_URL14 = "errors";
|
|
471
|
-
function createErrorsApi(client
|
|
512
|
+
function createErrorsApi(client) {
|
|
472
513
|
async function getInvalidItemErrorDetails(itemInfoId, signal) {
|
|
473
514
|
const data = await client.get(`${BASE_URL14}/items/${itemInfoId}`, {
|
|
474
|
-
searchParams: getCompanyTypeSearchParams({
|
|
515
|
+
searchParams: getCompanyTypeSearchParams({
|
|
516
|
+
companyType: client.getCompanyType()
|
|
517
|
+
}),
|
|
475
518
|
signal
|
|
476
519
|
}).json();
|
|
477
520
|
return itemErrorDetailsResultSchema.parse(data);
|
|
@@ -483,7 +526,7 @@ function createErrorsApi(client, companyType) {
|
|
|
483
526
|
|
|
484
527
|
// lib/errors/v2/index.ts
|
|
485
528
|
var BASE_URL15 = "errors/v2";
|
|
486
|
-
function createErrorsApiV2(client
|
|
529
|
+
function createErrorsApiV2(client) {
|
|
487
530
|
async function getItemErrorSummary(params, signal) {
|
|
488
531
|
const searchParams = new URLSearchParams();
|
|
489
532
|
if (params.searchField)
|
|
@@ -499,13 +542,19 @@ function createErrorsApiV2(client, companyType) {
|
|
|
499
542
|
if (params.docInEventId)
|
|
500
543
|
searchParams.append("docInEventId", params.docInEventId);
|
|
501
544
|
if (params.importId) searchParams.append("importId", params.importId);
|
|
502
|
-
if (
|
|
503
|
-
|
|
545
|
+
if (client.getCompanyType())
|
|
546
|
+
searchParams.append("companyType", client.getCompanyType());
|
|
547
|
+
const data = await client.get(`${BASE_URL15}/summary`, {
|
|
548
|
+
signal,
|
|
549
|
+
searchParams
|
|
550
|
+
}).json();
|
|
504
551
|
return itemErrorSummaryResultV2Schema.parse(data);
|
|
505
552
|
}
|
|
506
553
|
async function getItemErrorDetails(itemInfoId, signal) {
|
|
507
554
|
const data = await client.get(`${BASE_URL15}/items/${itemInfoId}`, {
|
|
508
|
-
searchParams: getCompanyTypeSearchParams({
|
|
555
|
+
searchParams: getCompanyTypeSearchParams({
|
|
556
|
+
companyType: client.getCompanyType()
|
|
557
|
+
}),
|
|
509
558
|
signal
|
|
510
559
|
}).json();
|
|
511
560
|
return itemErrorDetailsResultV2Schema.parse(data);
|
|
@@ -600,7 +649,20 @@ function createCompaniesApi(client) {
|
|
|
600
649
|
}).json();
|
|
601
650
|
return companyBriefByOrgSchema.parse(data);
|
|
602
651
|
}
|
|
603
|
-
|
|
652
|
+
async function companySearch(params, signal) {
|
|
653
|
+
const data = await client.get(`${BASE_URL17}/search`, {
|
|
654
|
+
searchParams: params,
|
|
655
|
+
signal
|
|
656
|
+
}).json();
|
|
657
|
+
return external_exports.array(companySearchSchema).parse(data);
|
|
658
|
+
}
|
|
659
|
+
async function getCompanyById(companyId, signal) {
|
|
660
|
+
const data = await client.get(`${BASE_URL17}/${companyId}`, {
|
|
661
|
+
signal
|
|
662
|
+
}).json();
|
|
663
|
+
return companySchema.parse(data);
|
|
664
|
+
}
|
|
665
|
+
return { getCompanyBriefInfoByOrg, companySearch, getCompanyById };
|
|
604
666
|
}
|
|
605
667
|
|
|
606
668
|
// lib/rulesManagement/index.ts
|