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