@spscommerce/asst-api 0.0.1-beta.8 → 0.0.1

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.
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const itemStatusResponseSchema: z.ZodObject<{
4
+ itemStatuses: z.ZodArray<z.ZodObject<{
5
+ itemId: z.ZodString;
6
+ itemOrgStatuses: z.ZodArray<z.ZodObject<{
7
+ org: z.ZodObject<{
8
+ ref: z.ZodString;
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ name: string;
13
+ id: string;
14
+ ref: string;
15
+ }, {
16
+ name: string;
17
+ id: string;
18
+ ref: string;
19
+ }>;
20
+ lowestInvalidStage: z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED", "STANDARD_REQUIREMENTS"]>>;
21
+ validForRelationship: z.ZodBoolean;
22
+ }, "strip", z.ZodTypeAny, {
23
+ org: {
24
+ name: string;
25
+ id: string;
26
+ ref: string;
27
+ };
28
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
29
+ validForRelationship: boolean;
30
+ }, {
31
+ org: {
32
+ name: string;
33
+ id: string;
34
+ ref: string;
35
+ };
36
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
37
+ validForRelationship: boolean;
38
+ }>, "many">;
39
+ }, "strip", z.ZodTypeAny, {
40
+ itemId: string;
41
+ itemOrgStatuses: {
42
+ org: {
43
+ name: string;
44
+ id: string;
45
+ ref: string;
46
+ };
47
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
48
+ validForRelationship: boolean;
49
+ }[];
50
+ }, {
51
+ itemId: string;
52
+ itemOrgStatuses: {
53
+ org: {
54
+ name: string;
55
+ id: string;
56
+ ref: string;
57
+ };
58
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
59
+ validForRelationship: boolean;
60
+ }[];
61
+ }>, "many">;
62
+ }, "strip", z.ZodTypeAny, {
63
+ itemStatuses: {
64
+ itemId: string;
65
+ itemOrgStatuses: {
66
+ org: {
67
+ name: string;
68
+ id: string;
69
+ ref: string;
70
+ };
71
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
72
+ validForRelationship: boolean;
73
+ }[];
74
+ }[];
75
+ }, {
76
+ itemStatuses: {
77
+ itemId: string;
78
+ itemOrgStatuses: {
79
+ org: {
80
+ name: string;
81
+ id: string;
82
+ ref: string;
83
+ };
84
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
85
+ validForRelationship: boolean;
86
+ }[];
87
+ }[];
88
+ }>;
89
+ type ItemStatusResponse = z.infer<typeof itemStatusResponseSchema>;
90
+
91
+ export { ItemStatusResponse as I };
@@ -3879,6 +3879,7 @@ var downLoadItemsParamsSchema = z.object({
3879
3879
  // lib/categories/models/ItemCategory.ts
3880
3880
  var itemCategorySchema = z.object({
3881
3881
  categoryid: z.number(),
3882
+ encodedCategoryId: z.string(),
3882
3883
  companyId: z.number(),
3883
3884
  name: z.string(),
3884
3885
  isActive: z.number(),
@@ -3897,6 +3898,30 @@ var itemCategoriesSearchSchema = z.object({
3897
3898
  data: z.array(itemCategorySchema)
3898
3899
  });
3899
3900
 
3901
+ // lib/categories/models/Hierarchy.ts
3902
+ var baseHierarchySchema = z.object({
3903
+ id: z.string(),
3904
+ name: z.string().nullish(),
3905
+ description: z.string().nullish(),
3906
+ type: z.string().nullish()
3907
+ });
3908
+ var hierarchySchema = baseHierarchySchema.extend(
3909
+ {
3910
+ child: z.lazy(() => hierarchySchema).nullable()
3911
+ }
3912
+ );
3913
+
3914
+ // lib/categories/models/ItemHierarchy.ts
3915
+ var itemHierarchySchema = z.object({
3916
+ itemId: z.string(),
3917
+ hierarchies: z.array(hierarchySchema)
3918
+ });
3919
+
3920
+ // lib/categories/models/ItemHierarchyResponse.ts
3921
+ var itemHierarchyResponseSchema = z.object({
3922
+ itemHierarchies: z.array(itemHierarchySchema)
3923
+ });
3924
+
3900
3925
  // lib/attributes/models/AttributeMetaData.ts
3901
3926
  var attributeMetaDataSchema = z.object({
3902
3927
  dbName: z.string(),
@@ -4102,10 +4127,10 @@ var itemMapSchema = z.object({
4102
4127
  consumeravailabledatestring: z.string().nullish(),
4103
4128
  status: z.string().nullish(),
4104
4129
  nrfcolorcode: z.array(z.string()).nullish(),
4105
- nrfsizecode: z.string().nullish(),
4130
+ nrfsizecode: z.array(z.string()).nullish(),
4106
4131
  productcolordescription: z.array(z.string()).nullish(),
4107
4132
  productsizedescription: z.array(z.string()).nullish()
4108
- });
4133
+ }).passthrough();
4109
4134
 
4110
4135
  // lib/items/models/ItemTable.ts
4111
4136
  var itemTableSchema = z.object({
@@ -4324,6 +4349,34 @@ var itemDetailSchema = z.object({
4324
4349
  packs: z.array(packComponentSchema)
4325
4350
  });
4326
4351
 
4352
+ // lib/items/models/SpsItemIdResponse.ts
4353
+ var spsItemIdResponseSchema = z.object({
4354
+ id: z.string(),
4355
+ ref: z.string()
4356
+ });
4357
+
4358
+ // lib/items/models/ItemOrgStatus.ts
4359
+ var itemOrgStatusSchema = z.object({
4360
+ org: z.object({
4361
+ ref: z.string(),
4362
+ id: z.string(),
4363
+ name: z.string()
4364
+ }),
4365
+ lowestInvalidStage: phaseEnumSchema.nullable(),
4366
+ validForRelationship: z.boolean()
4367
+ });
4368
+
4369
+ // lib/items/models/ItemStatus.ts
4370
+ var itemStatusSchema = z.object({
4371
+ itemId: z.string(),
4372
+ itemOrgStatuses: z.array(itemOrgStatusSchema)
4373
+ });
4374
+
4375
+ // lib/items/models/ItemStatusResponse.ts
4376
+ var itemStatusResponseSchema = z.object({
4377
+ itemStatuses: z.array(itemStatusSchema)
4378
+ });
4379
+
4327
4380
  // lib/locale/models/Locale.ts
4328
4381
  var localeSchema = z.object({
4329
4382
  localeCode: z.string(),
@@ -4376,9 +4429,10 @@ var spreadsheetTemplateSchema = z.object({
4376
4429
  // lib/tradingPartners/models/Connection.ts
4377
4430
  var connectionSchema = z.object({
4378
4431
  catalog_id: z.number(),
4379
- catalog_name: z.string(),
4432
+ catalog_name: z.string().nullable(),
4380
4433
  partner_company_name: z.string(),
4381
- partner_company_id: z.number()
4434
+ partner_company_id: z.number(),
4435
+ partner_org_id: z.string()
4382
4436
  });
4383
4437
 
4384
4438
  // lib/tradingPartners/models/TradingPartnerAccessByCompanyId.ts
@@ -4410,9 +4464,9 @@ var identityServiceOrganizationMetadataSchema = z.object({
4410
4464
 
4411
4465
  // lib/whoami/models/IdentityServiceOrganization.ts
4412
4466
  var identityServiceOrganizationSchema = z.object({
4413
- organization_name: z.string(),
4414
- organization_site: z.string(),
4415
- namespace: z.string(),
4467
+ organization_name: z.string().optional(),
4468
+ organization_site: z.string().optional(),
4469
+ namespace: z.string().optional(),
4416
4470
  id: z.string(),
4417
4471
  permissions: z.array(z.string()).optional(),
4418
4472
  metadata: identityServiceOrganizationMetadataSchema.optional()
@@ -4430,26 +4484,26 @@ var identityServicePreferencesSchema = z.object({
4430
4484
  // lib/whoami/models/IdentityServiceUser.ts
4431
4485
  var identityServiceUserSchema = z.object({
4432
4486
  id: z.string(),
4433
- email: z.string(),
4434
- first_name: z.string(),
4435
- last_name: z.string(),
4436
- job_title: z.string(),
4437
- externally_managed: z.boolean(),
4438
- city: z.string(),
4487
+ email: z.string().optional(),
4488
+ first_name: z.string().optional(),
4489
+ last_name: z.string().optional(),
4490
+ job_title: z.string().optional(),
4491
+ externally_managed: z.boolean().optional(),
4492
+ city: z.string().optional(),
4439
4493
  name: z.string(),
4440
- state: z.string(),
4441
- country: z.string(),
4442
- user_type: z.string(),
4443
- token_type: z.string(),
4444
- avatar_image_id: z.string(),
4445
- avatar_image_url: z.string(),
4446
- origin_avatar_image_id: z.string(),
4447
- bio: z.string(),
4448
- phone_number: z.string(),
4449
- twitter_handle: z.string(),
4450
- linkedin_url: z.string(),
4494
+ state: z.string().optional(),
4495
+ country: z.string().optional(),
4496
+ user_type: z.string().optional(),
4497
+ token_type: z.string().optional(),
4498
+ avatar_image_id: z.string().optional(),
4499
+ avatar_image_url: z.string().optional(),
4500
+ origin_avatar_image_id: z.string().optional(),
4501
+ bio: z.string().optional(),
4502
+ phone_number: z.string().optional(),
4503
+ twitter_handle: z.string().optional(),
4504
+ linkedin_url: z.string().optional(),
4451
4505
  description: z.string().optional(),
4452
- preferences: identityServicePreferencesSchema,
4506
+ preferences: identityServicePreferencesSchema.optional(),
4453
4507
  roles: z.array(z.string()),
4454
4508
  organization: identityServiceOrganizationSchema,
4455
4509
  password: z.string(),
@@ -4487,7 +4541,7 @@ var userAccountSchema = z.object({
4487
4541
  // lib/errors/models/ItemErrorDetails.ts
4488
4542
  var itemErrorDetailsSchema = z.object({
4489
4543
  errorMessage: z.string(),
4490
- attributeName: z.string(),
4544
+ attributeName: z.string().nullable(),
4491
4545
  tradingPartnerNames: z.array(z.string()),
4492
4546
  phases: z.array(phaseEnumSchema),
4493
4547
  attributeDbNames: z.array(z.string()),
@@ -4526,6 +4580,9 @@ export {
4526
4580
  tradingPartnerAccessByCompanyIdSchema,
4527
4581
  itemCategorySchema,
4528
4582
  itemCategoriesSearchSchema,
4583
+ hierarchySchema,
4584
+ itemHierarchySchema,
4585
+ itemHierarchyResponseSchema,
4529
4586
  attributeMetaDataSchema,
4530
4587
  attributeSummarySchema,
4531
4588
  attributesByCompanySchema,
@@ -4572,5 +4629,7 @@ export {
4572
4629
  bulbSchema,
4573
4630
  packComponentSchema,
4574
4631
  mediaItemSchema,
4575
- itemDetailSchema
4632
+ itemDetailSchema,
4633
+ spsItemIdResponseSchema,
4634
+ itemStatusResponseSchema
4576
4635
  };
@@ -10,14 +10,17 @@ import {
10
10
  itemCategoriesSearchSchema,
11
11
  itemDetailViewSchema,
12
12
  itemErrorDetailsResultSchema,
13
+ itemHierarchyResponseSchema,
13
14
  itemSearchViewSchema,
15
+ itemStatusResponseSchema,
14
16
  localeSchema,
15
17
  spreadsheetTemplateSchema,
18
+ spsItemIdResponseSchema,
16
19
  tradingPartnerAccessByCompanyIdSchema,
17
20
  userAccountSchema,
18
21
  vendorPartnerAttGroupsSchema,
19
22
  z
20
- } from "./chunk-3JRE7YYE.js";
23
+ } from "./chunk-HEFVXX2V.js";
21
24
 
22
25
  // lib/imports/index.ts
23
26
  var BASE_URL = "imports";
@@ -49,7 +52,8 @@ function createImportsApi(client) {
49
52
  searchParams: params,
50
53
  headers: {
51
54
  Accept: "application/octet-stream"
52
- }
55
+ },
56
+ timeout: false
53
57
  });
54
58
  const disposition = response.headers.get("content-disposition") || "";
55
59
  const filename = disposition.match(/filename="(.+)"/)?.[1];
@@ -88,7 +92,8 @@ function createExportsApi(client) {
88
92
  searchParams,
89
93
  headers: {
90
94
  Accept: "application/octet-stream"
91
- }
95
+ },
96
+ timeout: false
92
97
  });
93
98
  const disposition = response.headers.get("content-disposition") || "";
94
99
  const filename = disposition.match(/filename="(.+)"/)?.[1];
@@ -151,20 +156,42 @@ function createCategoriesApi(client) {
151
156
  return itemCategoriesSearchSchema.parse(data);
152
157
  }
153
158
  async function getProductCodes(params, signal) {
159
+ const searchParams = { type: "PRODUCT_CODE" };
160
+ if (params?.categoryName) {
161
+ searchParams.categoryName = params.categoryName;
162
+ }
163
+ if (params?.catalogId) {
164
+ searchParams.catalogId = params.catalogId;
165
+ }
166
+ if (params?.selectionCodeId) {
167
+ searchParams.selectionCodeId = params.selectionCodeId;
168
+ }
154
169
  const data = await client.get(`${BASE_URL5}/search-category`, {
155
- searchParams: { ...params, type: "PRODUCT_CODE" },
156
- signal
170
+ searchParams,
171
+ signal,
172
+ timeout: false
157
173
  }).json();
158
174
  return itemCategoriesSearchSchema.parse(data);
159
175
  }
160
176
  async function getSelectionCodes(params, signal) {
177
+ const searchParams = { type: "SELECTION_CODE" };
178
+ if (params?.categoryName) {
179
+ searchParams.categoryName = params.categoryName;
180
+ }
181
+ if (params?.catalogId) {
182
+ searchParams.catalogId = params.catalogId;
183
+ }
161
184
  const data = await client.get(`${BASE_URL5}/search-category`, {
162
- searchParams: { ...params, type: "SELECTION_CODE" },
185
+ searchParams,
163
186
  signal
164
187
  }).json();
165
188
  return itemCategoriesSearchSchema.parse(data);
166
189
  }
167
- return { getCatalogs, getProductCodes, getSelectionCodes };
190
+ async function getItemHierarchy(itemIds) {
191
+ const data = await client.post(`${BASE_URL5}/item-hierarchy`, { json: { itemIds } }).json();
192
+ return itemHierarchyResponseSchema.parse(data);
193
+ }
194
+ return { getCatalogs, getProductCodes, getSelectionCodes, getItemHierarchy };
168
195
  }
169
196
 
170
197
  // lib/attributes/index.ts
@@ -191,11 +218,16 @@ function createAttributesApi(client) {
191
218
  }).json();
192
219
  return z.array(attributeValidValuesSchema).parse(data);
193
220
  }
221
+ async function getCompanyInterestedAttributes(signal) {
222
+ const data = await client.get(`${BASE_URL6}/company/interested-attributes`, { signal }).json();
223
+ return z.array(z.string()).parse(data);
224
+ }
194
225
  return {
195
226
  getAllAttributes,
196
227
  getAllAttributesByCompany,
197
228
  getAttributesExtensiveInfo,
198
- getAttributeValidValues
229
+ getAttributeValidValues,
230
+ getCompanyInterestedAttributes
199
231
  };
200
232
  }
201
233
 
@@ -249,45 +281,74 @@ function createCompanyFeaturesApi(client) {
249
281
  };
250
282
  }
251
283
 
284
+ // lib/featureFlags/index.ts
285
+ var BASE_URL11 = "feature-flag";
286
+ function createFeatureFlagsApi(client) {
287
+ async function checkEnableItemsApiEndpointsForImports(signal) {
288
+ const data = await client.get(`${BASE_URL11}/enable-items-api-endpoints-for-imports/`, {
289
+ signal
290
+ }).json();
291
+ return z.boolean().parse(data);
292
+ }
293
+ return {
294
+ checkEnableItemsApiEndpointsForImports
295
+ };
296
+ }
297
+
252
298
  // lib/items/index.ts
253
- var BASE_URL11 = "items";
299
+ var BASE_URL12 = "items";
254
300
  function createItemsApi(client) {
255
301
  async function searchItems(params, signal) {
256
302
  const searchParams = params ? `limit=${params.limit}&offset=${params.offset}` + (params.url ? `&${params.url}` : "") : void 0;
257
- const data = await client.get(`${BASE_URL11}`, { searchParams, signal }).json();
303
+ const data = await client.get(`${BASE_URL12}`, { searchParams, signal }).json();
258
304
  return itemSearchViewSchema.parse(data);
259
305
  }
260
306
  async function getItem(itemId, locale = "en-US", signal) {
261
- const data = await client.get(`${BASE_URL11}/${itemId}`, { searchParams: { locale }, signal }).json();
307
+ const data = await client.get(`${BASE_URL12}/${itemId}`, { searchParams: { locale }, signal }).json();
262
308
  return itemDetailViewSchema.parse(data);
263
309
  }
264
310
  async function updateItem(itemId, item) {
265
- client.put(`${BASE_URL11}/details/${itemId}`, { json: { item } }).json();
311
+ await client.put(`${BASE_URL12}/details/${itemId}`, { json: { ...item } }).json();
266
312
  }
267
313
  async function deleteItem(itemId) {
268
- await client.delete(`${BASE_URL11}/${itemId}`);
314
+ await client.delete(`${BASE_URL12}/${itemId}`);
269
315
  }
270
316
  async function deleteItems(itemIds) {
271
317
  const params = new URLSearchParams();
272
318
  itemIds.forEach((id) => {
273
319
  params.append("items", id);
274
320
  });
275
- await client.delete(`${BASE_URL11}/items`, { searchParams: params });
321
+ await client.delete(`${BASE_URL12}`, { searchParams: params });
322
+ }
323
+ async function getItemInfoId(spsItemId, signal) {
324
+ const data = await client.get(`${BASE_URL12}/${spsItemId}/itemInfoId`, { signal }).json();
325
+ return z.number().parse(data);
326
+ }
327
+ async function getSpsItemId(itemInfoId, signal) {
328
+ const data = await client.get(`${BASE_URL12}/${itemInfoId}/spsItemId`, { signal }).json();
329
+ return spsItemIdResponseSchema.parse(data);
330
+ }
331
+ async function getItemStatus(itemIds) {
332
+ const data = await client.post(`${BASE_URL12}/status`, { json: { itemIds } }).json();
333
+ return itemStatusResponseSchema.parse(data);
276
334
  }
277
335
  return {
278
336
  searchItems,
279
337
  getItem,
280
338
  updateItem,
281
339
  deleteItem,
282
- deleteItems
340
+ deleteItems,
341
+ getItemInfoId,
342
+ getSpsItemId,
343
+ getItemStatus
283
344
  };
284
345
  }
285
346
 
286
347
  // lib/errors/index.ts
287
- var BASE_URL12 = "errors";
348
+ var BASE_URL13 = "errors";
288
349
  function createErrorsApi(client) {
289
350
  async function getInvalidItemErrorDetails(itemInfoId, signal) {
290
- const data = await client.get(`${BASE_URL12}/items/${itemInfoId}`, {
351
+ const data = await client.get(`${BASE_URL13}/items/${itemInfoId}`, {
291
352
  signal
292
353
  }).json();
293
354
  return itemErrorDetailsResultSchema.parse(data);
@@ -320,7 +381,9 @@ export {
320
381
  BASE_URL10,
321
382
  createCompanyFeaturesApi,
322
383
  BASE_URL11,
323
- createItemsApi,
384
+ createFeatureFlagsApi,
324
385
  BASE_URL12,
386
+ createItemsApi,
387
+ BASE_URL13,
325
388
  createErrorsApi
326
389
  };