@spscommerce/asst-api 0.1.0 → 1.0.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/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { A as AsstClient, a as Import, b as ImportsStatus, V as VendorPartnerAttGroups, E as Export, l as AttrProdType, T as TradingPartnerAccessByCompanyId, c as ItemCategoriesSearch, h as AttributeMetaData, i as AttributesByCompany, j as AttributeDefinition, k as AttributeValidValues, L as Locale, S as SpreadsheetTemplate, U as UserAccount, f as ItemSearchView, g as ItemDetailView, e as ItemErrorDetailsResult } from './CompanyBriefByOrg-f1bfabb3.js';
2
- export { m as AsstClientOptions, n as AsstUrl, B as BASE_URLS, C as CompanyBriefByOrg, o as Env, I as ImportErrors } from './CompanyBriefByOrg-f1bfabb3.js';
3
- import { G as GenerateImportTemplateParams, D as DownLoadItemsParams, I as ItemHierarchyResponse, a as ItemDetail, S as SpsItemIdResponse } from './zod-ec1cdb27.js';
4
- export { i as AttrDatatypeNameEnum, t as AttributeDetail, j as AttributeGroup, A as AttributeSummary, K as Bulb, u as CategoryEnum, v as ComponentDetails, C as Connection, E as ExportDayOfWeek, e as ExportFrequency, f as ExportType, w as GroupedAttributeList, x as GroupedAttributes, y as GroupedItem, H as Hierarchy, z as HierarchyCategory, B as HierarchyDetails, m as IdentityServiceDatetimePreferences, n as IdentityServiceOrganization, l as IdentityServiceOrganizationMetadata, o as IdentityServicePreferences, p as IdentityServiceUser, b as ImportDetails, c as ImportError, d as ImportStatusEnum, g as ItemCategory, Q as ItemErrorDetails, q as ItemHeader, h as ItemHierarchy, r as ItemMap, F as ItemPrice, s as ItemTable, M as MediaItem, L as PackComponent, J as PackComponentDetails, O as PackComponentItemInfo, P as PhaseEnum, R as RegisteredService, N as RepeatableGroup, k as SpreadsheetTemplateCompany, T as TradingPartnerStage } from './zod-ec1cdb27.js';
5
- import { I as ItemStatusResponse } from './index-d94fdfef.js';
6
- export { c as createCompaniesApi } from './index-d94fdfef.js';
1
+ import { A as AsstClient, a as Import, b as ImportsStatus, V as VendorPartnerAttGroups, E as Export, m as AttrProdType, T as TradingPartnerAccessByCompanyId, e as CompanyRelationshipUpsertBody, c as ItemCategoriesSearch, i as AttributeMetaData, j as AttributesByCompany, k as AttributeDefinition, l as AttributeValidValues, L as Locale, S as SpreadsheetTemplate, U as UserAccount, g as ItemSearchView, h as ItemDetailView, f as ItemErrorDetailsResult } from './CompanyBriefByOrg-HsKxilwl.js';
2
+ export { o as AsstClientOptions, p as AsstUrl, B as BASE_URLS, C as CompanyBriefByOrg, q as Env, I as ImportErrors, n as envSchema } from './CompanyBriefByOrg-HsKxilwl.js';
3
+ import { G as GenerateImportTemplateParams, D as DownLoadItemsParams, I as ItemPartner, a as ItemHierarchyResponse, b as ItemDetail, S as SpsItemIdResponse } from './zod-9pZn6tpQ.js';
4
+ export { i as AttrDatatypeNameEnum, t as AttributeDetail, j as AttributeGroup, A as AttributeSummary, J as Bulb, u as CategoryEnum, v as ComponentDetails, C as Connection, E as ExportDayOfWeek, f as ExportFrequency, g as ExportType, w as GroupedAttributeList, x as GroupedAttributes, y as GroupedItem, H as HierarchyCategory, z as HierarchyDetails, m as IdentityServiceDatetimePreferences, n as IdentityServiceOrganization, l as IdentityServiceOrganizationMetadata, o as IdentityServicePreferences, p as IdentityServiceUser, c as ImportDetails, d as ImportError, e as ImportStatusEnum, h as ItemCategory, O as ItemErrorDetails, q as ItemHeader, r as ItemMap, B as ItemPrice, s as ItemTable, M as MediaItem, K as PackComponent, F as PackComponentDetails, N as PackComponentItemInfo, P as PhaseEnum, R as RegisteredService, L as RepeatableGroup, k as SpreadsheetTemplateCompany, T as TradingPartnerStage } from './zod-9pZn6tpQ.js';
5
+ import { R as RetailerTradingPartnerStages, I as ItemStatusResponse } from './index-wuCGfJSu.js';
6
+ export { c as createCompaniesApi } from './index-wuCGfJSu.js';
7
7
  import { z } from 'zod';
8
8
  import 'ky-universal';
9
9
  import 'ky';
@@ -70,14 +70,20 @@ declare function createTradingPartnerAccessApi(client: AsstClient): {
70
70
  getAllTradingPartners: (params?: {
71
71
  orgId?: string;
72
72
  }, signal?: AbortSignal) => Promise<TradingPartnerAccessByCompanyId>;
73
+ upsertRelationship: (data: CompanyRelationshipUpsertBody) => Promise<ItemPartner>;
74
+ upsertHierarchy: (data: CompanyRelationshipUpsertBody) => Promise<void>;
73
75
  };
74
76
 
75
77
  /**
76
- * Initialize Categories Api functions
78
+ * Initialize Trading Partner Settings Api functions
77
79
  * @param client Assortment Client instance
78
- * @returns An object containing Categories API functions
80
+ * @returns An object containing Trading Partner Settings API functions
79
81
  */
80
- declare function createCategoriesApi(client: AsstClient): {
82
+ declare function createTradingPartnerSettingsApi(client: AsstClient): {
83
+ getRetailerStages: (signal?: AbortSignal) => Promise<RetailerTradingPartnerStages>;
84
+ };
85
+
86
+ type CategoriesApi = {
81
87
  getCatalogs: (params?: {
82
88
  categoryName?: string;
83
89
  orgId?: string;
@@ -95,6 +101,12 @@ declare function createCategoriesApi(client: AsstClient): {
95
101
  }, signal?: AbortSignal) => Promise<ItemCategoriesSearch>;
96
102
  getItemHierarchy: (itemIds: string[]) => Promise<ItemHierarchyResponse>;
97
103
  };
104
+ /**
105
+ * Initialize Categories Api functions
106
+ * @param client Assortment Client instance
107
+ * @returns An object containing Categories API functions
108
+ */
109
+ declare function createCategoriesApi(client: AsstClient): CategoriesApi;
98
110
 
99
111
  /**
100
112
  * Initialize Attributes Api functions
@@ -143,6 +155,8 @@ declare function createWhoAmIApi(client: AsstClient): {
143
155
  whoAmI: (signal?: AbortSignal) => Promise<UserAccount>;
144
156
  };
145
157
 
158
+ type ApplicationType = "ASSORTMENT" | "ITEM-XREF";
159
+
146
160
  /**
147
161
  * Initialize Company Features Api functions
148
162
  * @param client Assortment Client instance
@@ -267,6 +281,7 @@ declare function createItemsApi(client: AsstClient): {
267
281
  url: string;
268
282
  limit?: number;
269
283
  offset?: number;
284
+ applicationType?: ApplicationType;
270
285
  }, signal?: AbortSignal) => Promise<ItemSearchView>;
271
286
  getItem: (itemId: string, locale?: string, signal?: AbortSignal) => Promise<ItemDetailView>;
272
287
  updateItem: (itemId: string, item: ItemDetail) => Promise<void>;
@@ -277,6 +292,308 @@ declare function createItemsApi(client: AsstClient): {
277
292
  getItemStatus: (itemIds: string[]) => Promise<ItemStatusResponse>;
278
293
  };
279
294
 
295
+ declare const itemOrgStageDetailsSchema: z.ZodObject<{
296
+ /**
297
+ * When called as retailer, the vendor, else when vendor, the retailer.
298
+ * */
299
+ orgSummary: z.ZodObject<{
300
+ ref: z.ZodString;
301
+ id: z.ZodString;
302
+ name: z.ZodString;
303
+ }, "strip", z.ZodTypeAny, {
304
+ name: string;
305
+ id: string;
306
+ ref: string;
307
+ }, {
308
+ name: string;
309
+ id: string;
310
+ ref: string;
311
+ }>;
312
+ /**
313
+ * The company id of the retailer or vendor used for matching ItemOrgStageDetails to TradingPartnerStage for ErrorService
314
+ */
315
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
316
+ /**
317
+ * "Standard Requirements" (null) UNLESS the retailer of the item is MSIS Enabled
318
+ * OTHERWISE the retailer default Stage UNLESS there's a currently active vendor-specific Stage defined
319
+ * OTHERWISE the trading partnership Stage UNLESS there's a currently active Item Level override defined
320
+ * OTHERWISE the item level override */
321
+ stage: z.ZodOptional<z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>>>;
322
+ /**
323
+ * If the item is valid for the active stage. Note that for "Standard Requirements" or
324
+ * "Enriched" this cam come directly from the item_doc table, but anything else requires validation
325
+ */
326
+ isValid: z.ZodBoolean;
327
+ /**
328
+ * Not null if there's an item level policy override for this trading partnership
329
+ */
330
+ itemPolicyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
331
+ /**
332
+ * Start date for the Item level Stage if applicable
333
+ */
334
+ startDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
335
+ /**
336
+ * End date for the Item level Stage if applicable
337
+ */
338
+ endDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
339
+ }, "strip", z.ZodTypeAny, {
340
+ isValid: boolean;
341
+ orgSummary: {
342
+ name: string;
343
+ id: string;
344
+ ref: string;
345
+ };
346
+ companyId?: number | null | undefined;
347
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
348
+ itemPolicyId?: string | null | undefined;
349
+ startDate?: Date | null | undefined;
350
+ endDate?: Date | null | undefined;
351
+ }, {
352
+ isValid: boolean;
353
+ orgSummary: {
354
+ name: string;
355
+ id: string;
356
+ ref: string;
357
+ };
358
+ companyId?: number | null | undefined;
359
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
360
+ itemPolicyId?: string | null | undefined;
361
+ startDate?: number | null | undefined;
362
+ endDate?: number | null | undefined;
363
+ }>;
364
+ type ItemOrgStageDetails = z.infer<typeof itemOrgStageDetailsSchema>;
365
+
366
+ declare const itemStatusV2Schema: z.ZodObject<{
367
+ itemId: z.ZodString;
368
+ mostRestrictiveRetailerStage: z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>>;
369
+ itemOrgStageDetails: z.ZodArray<z.ZodObject<{
370
+ orgSummary: z.ZodObject<{
371
+ ref: z.ZodString;
372
+ id: z.ZodString;
373
+ name: z.ZodString;
374
+ }, "strip", z.ZodTypeAny, {
375
+ name: string;
376
+ id: string;
377
+ ref: string;
378
+ }, {
379
+ name: string;
380
+ id: string;
381
+ ref: string;
382
+ }>;
383
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
384
+ stage: z.ZodOptional<z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>>>;
385
+ isValid: z.ZodBoolean;
386
+ itemPolicyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
387
+ startDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
388
+ endDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ isValid: boolean;
391
+ orgSummary: {
392
+ name: string;
393
+ id: string;
394
+ ref: string;
395
+ };
396
+ companyId?: number | null | undefined;
397
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
398
+ itemPolicyId?: string | null | undefined;
399
+ startDate?: Date | null | undefined;
400
+ endDate?: Date | null | undefined;
401
+ }, {
402
+ isValid: boolean;
403
+ orgSummary: {
404
+ name: string;
405
+ id: string;
406
+ ref: string;
407
+ };
408
+ companyId?: number | null | undefined;
409
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
410
+ itemPolicyId?: string | null | undefined;
411
+ startDate?: number | null | undefined;
412
+ endDate?: number | null | undefined;
413
+ }>, "many">;
414
+ }, "strip", z.ZodTypeAny, {
415
+ itemId: string;
416
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
417
+ itemOrgStageDetails: {
418
+ isValid: boolean;
419
+ orgSummary: {
420
+ name: string;
421
+ id: string;
422
+ ref: string;
423
+ };
424
+ companyId?: number | null | undefined;
425
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
426
+ itemPolicyId?: string | null | undefined;
427
+ startDate?: Date | null | undefined;
428
+ endDate?: Date | null | undefined;
429
+ }[];
430
+ }, {
431
+ itemId: string;
432
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
433
+ itemOrgStageDetails: {
434
+ isValid: boolean;
435
+ orgSummary: {
436
+ name: string;
437
+ id: string;
438
+ ref: string;
439
+ };
440
+ companyId?: number | null | undefined;
441
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
442
+ itemPolicyId?: string | null | undefined;
443
+ startDate?: number | null | undefined;
444
+ endDate?: number | null | undefined;
445
+ }[];
446
+ }>;
447
+ type ItemStatusV2 = z.infer<typeof itemStatusV2Schema>;
448
+
449
+ declare const itemStatusV2ResponseSchema: z.ZodObject<{
450
+ itemStatuses: z.ZodArray<z.ZodObject<{
451
+ itemId: z.ZodString;
452
+ mostRestrictiveRetailerStage: z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>>;
453
+ itemOrgStageDetails: z.ZodArray<z.ZodObject<{
454
+ orgSummary: z.ZodObject<{
455
+ ref: z.ZodString;
456
+ id: z.ZodString;
457
+ name: z.ZodString;
458
+ }, "strip", z.ZodTypeAny, {
459
+ name: string;
460
+ id: string;
461
+ ref: string;
462
+ }, {
463
+ name: string;
464
+ id: string;
465
+ ref: string;
466
+ }>;
467
+ companyId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
468
+ stage: z.ZodOptional<z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>>>;
469
+ isValid: z.ZodBoolean;
470
+ itemPolicyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
471
+ startDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
472
+ endDate: z.ZodOptional<z.ZodNullable<z.ZodPipeline<z.ZodNumber, z.ZodDate>>>;
473
+ }, "strip", z.ZodTypeAny, {
474
+ isValid: boolean;
475
+ orgSummary: {
476
+ name: string;
477
+ id: string;
478
+ ref: string;
479
+ };
480
+ companyId?: number | null | undefined;
481
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
482
+ itemPolicyId?: string | null | undefined;
483
+ startDate?: Date | null | undefined;
484
+ endDate?: Date | null | undefined;
485
+ }, {
486
+ isValid: boolean;
487
+ orgSummary: {
488
+ name: string;
489
+ id: string;
490
+ ref: string;
491
+ };
492
+ companyId?: number | null | undefined;
493
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
494
+ itemPolicyId?: string | null | undefined;
495
+ startDate?: number | null | undefined;
496
+ endDate?: number | null | undefined;
497
+ }>, "many">;
498
+ }, "strip", z.ZodTypeAny, {
499
+ itemId: string;
500
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
501
+ itemOrgStageDetails: {
502
+ isValid: boolean;
503
+ orgSummary: {
504
+ name: string;
505
+ id: string;
506
+ ref: string;
507
+ };
508
+ companyId?: number | null | undefined;
509
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
510
+ itemPolicyId?: string | null | undefined;
511
+ startDate?: Date | null | undefined;
512
+ endDate?: Date | null | undefined;
513
+ }[];
514
+ }, {
515
+ itemId: string;
516
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
517
+ itemOrgStageDetails: {
518
+ isValid: boolean;
519
+ orgSummary: {
520
+ name: string;
521
+ id: string;
522
+ ref: string;
523
+ };
524
+ companyId?: number | null | undefined;
525
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
526
+ itemPolicyId?: string | null | undefined;
527
+ startDate?: number | null | undefined;
528
+ endDate?: number | null | undefined;
529
+ }[];
530
+ }>, "many">;
531
+ }, "strip", z.ZodTypeAny, {
532
+ itemStatuses: {
533
+ itemId: string;
534
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
535
+ itemOrgStageDetails: {
536
+ isValid: boolean;
537
+ orgSummary: {
538
+ name: string;
539
+ id: string;
540
+ ref: string;
541
+ };
542
+ companyId?: number | null | undefined;
543
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
544
+ itemPolicyId?: string | null | undefined;
545
+ startDate?: Date | null | undefined;
546
+ endDate?: Date | null | undefined;
547
+ }[];
548
+ }[];
549
+ }, {
550
+ itemStatuses: {
551
+ itemId: string;
552
+ mostRestrictiveRetailerStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null;
553
+ itemOrgStageDetails: {
554
+ isValid: boolean;
555
+ orgSummary: {
556
+ name: string;
557
+ id: string;
558
+ ref: string;
559
+ };
560
+ companyId?: number | null | undefined;
561
+ stage?: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | null | undefined;
562
+ itemPolicyId?: string | null | undefined;
563
+ startDate?: number | null | undefined;
564
+ endDate?: number | null | undefined;
565
+ }[];
566
+ }[];
567
+ }>;
568
+ type ItemStatusV2Response = z.infer<typeof itemStatusV2ResponseSchema>;
569
+
570
+ declare const orgSummarySchema: z.ZodObject<{
571
+ ref: z.ZodString;
572
+ id: z.ZodString;
573
+ name: z.ZodString;
574
+ }, "strip", z.ZodTypeAny, {
575
+ name: string;
576
+ id: string;
577
+ ref: string;
578
+ }, {
579
+ name: string;
580
+ id: string;
581
+ ref: string;
582
+ }>;
583
+ type OrgSummary = z.infer<typeof orgSummarySchema>;
584
+
585
+ declare const stageSchema: z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED"]>;
586
+ type Stage = z.infer<typeof stageSchema>;
587
+
588
+ /**
589
+ * Initialize Items Api functions
590
+ * @param client Assortment Client instance
591
+ * @returns An object containing Items API functions
592
+ */
593
+ declare function createItemsApiV2(client: AsstClient): {
594
+ getItemStatus: (itemIds: string[]) => Promise<ItemStatusV2Response>;
595
+ };
596
+
280
597
  /**
281
598
  * Initialize Errors Api functions
282
599
  * @param client Assortment Client instance
@@ -297,4 +614,4 @@ declare function createUniqueCriteriaApi(client: AsstClient): {
297
614
  }, signal?: AbortSignal) => Promise<string[]>;
298
615
  };
299
616
 
300
- export { AsstClient, AttrProdType, AttributeDefinition, AttributeMetaData, AttributeValidValues, AttributesByCompany, DownLoadItemsParams, Export, GenerateImportTemplateParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemHierarchyResponse, ItemOrgStatus, ItemSearchView, ItemStatus, ItemStatusResponse, Locale, SpreadsheetTemplate, SpsItemIdResponse, TradingPartnerAccessByCompanyId, UserAccount, VendorPartnerAttGroups, createAttributesApi, createCategoriesApi, createCompanyFeaturesApi, createErrorsApi, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createLocaleApi, createProductTypesApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createUniqueCriteriaApi, createWhoAmIApi };
617
+ export { type ApplicationType, AsstClient, AttrProdType, AttributeDefinition, AttributeMetaData, AttributeValidValues, AttributesByCompany, type CategoriesApi, CompanyRelationshipUpsertBody, DownLoadItemsParams, Export, GenerateImportTemplateParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemHierarchyResponse, type ItemOrgStageDetails, type ItemOrgStatus, ItemPartner, ItemSearchView, type ItemStatus, ItemStatusResponse, type ItemStatusV2, type ItemStatusV2Response, Locale, type OrgSummary, RetailerTradingPartnerStages, SpreadsheetTemplate, SpsItemIdResponse, type Stage, TradingPartnerAccessByCompanyId, UserAccount, VendorPartnerAttGroups, createAttributesApi, createCategoriesApi, createCompanyFeaturesApi, createErrorsApi, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createItemsApiV2, createLocaleApi, createProductTypesApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createTradingPartnerSettingsApi, createUniqueCriteriaApi, createWhoAmIApi };
package/dist/index.js CHANGED
@@ -12,13 +12,90 @@ import {
12
12
  createProductTypesApi,
13
13
  createSpreadsheetTemplateApi,
14
14
  createTradingPartnerAccessApi,
15
+ createTradingPartnerSettingsApi,
15
16
  createUniqueCriteriaApi,
16
17
  createWhoAmIApi
17
- } from "./chunk-FDGLFR7X.js";
18
+ } from "./chunk-C2N5RQWG.js";
18
19
  import {
19
20
  AsstClient,
20
- BASE_URLS
21
- } from "./chunk-PUQDOFRT.js";
21
+ BASE_URLS,
22
+ envSchema,
23
+ z
24
+ } from "./chunk-6FFDMMN5.js";
25
+
26
+ // lib/items/v2/models/Stage.ts
27
+ var stageSchema = z.enum([
28
+ "CORE",
29
+ "CORE_PLUS",
30
+ "CORE_ADVANCED",
31
+ "ENRICHED"
32
+ ]);
33
+
34
+ // lib/items/v2/models/OrgSummary.ts
35
+ var orgSummarySchema = z.object({
36
+ ref: z.string(),
37
+ id: z.string(),
38
+ name: z.string()
39
+ });
40
+
41
+ // lib/items/v2/models/ItemOrgStageDetails.ts
42
+ var itemOrgStageDetailsSchema = z.object({
43
+ /**
44
+ * When called as retailer, the vendor, else when vendor, the retailer.
45
+ * */
46
+ orgSummary: orgSummarySchema,
47
+ /**
48
+ * The company id of the retailer or vendor used for matching ItemOrgStageDetails to TradingPartnerStage for ErrorService
49
+ */
50
+ companyId: z.number().nullish(),
51
+ /**
52
+ * "Standard Requirements" (null) UNLESS the retailer of the item is MSIS Enabled
53
+ * OTHERWISE the retailer default Stage UNLESS there's a currently active vendor-specific Stage defined
54
+ * OTHERWISE the trading partnership Stage UNLESS there's a currently active Item Level override defined
55
+ * OTHERWISE the item level override */
56
+ stage: stageSchema.nullish(),
57
+ /**
58
+ * If the item is valid for the active stage. Note that for "Standard Requirements" or
59
+ * "Enriched" this cam come directly from the item_doc table, but anything else requires validation
60
+ */
61
+ isValid: z.boolean(),
62
+ /**
63
+ * Not null if there's an item level policy override for this trading partnership
64
+ */
65
+ itemPolicyId: z.string().nullish(),
66
+ /**
67
+ * Start date for the Item level Stage if applicable
68
+ */
69
+ startDate: z.number().pipe(z.coerce.date()).nullish(),
70
+ /**
71
+ * End date for the Item level Stage if applicable
72
+ */
73
+ endDate: z.number().pipe(z.coerce.date()).nullish()
74
+ });
75
+
76
+ // lib/items/v2/models/ItemStatusV2.ts
77
+ var itemStatusV2Schema = z.object({
78
+ itemId: z.string(),
79
+ mostRestrictiveRetailerStage: stageSchema.nullable(),
80
+ itemOrgStageDetails: z.array(itemOrgStageDetailsSchema)
81
+ });
82
+
83
+ // lib/items/v2/models/ItemStatusV2Response.ts
84
+ var itemStatusV2ResponseSchema = z.object({
85
+ itemStatuses: z.array(itemStatusV2Schema)
86
+ });
87
+
88
+ // lib/items/v2/index.ts
89
+ var BASE_URL = "v2/items";
90
+ function createItemsApiV2(client) {
91
+ async function getItemStatus(itemIds) {
92
+ const data = await client.post(`${BASE_URL}/status`, { json: { itemIds } }).json();
93
+ return itemStatusV2ResponseSchema.parse(data);
94
+ }
95
+ return {
96
+ getItemStatus
97
+ };
98
+ }
22
99
  export {
23
100
  AsstClient,
24
101
  BASE_URLS,
@@ -31,10 +108,13 @@ export {
31
108
  createFeatureFlagsApi,
32
109
  createImportsApi,
33
110
  createItemsApi,
111
+ createItemsApiV2,
34
112
  createLocaleApi,
35
113
  createProductTypesApi,
36
114
  createSpreadsheetTemplateApi,
37
115
  createTradingPartnerAccessApi,
116
+ createTradingPartnerSettingsApi,
38
117
  createUniqueCriteriaApi,
39
- createWhoAmIApi
118
+ createWhoAmIApi,
119
+ envSchema
40
120
  };