@spscommerce/asst-api 0.0.1-beta.0 → 0.0.1-beta.10

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.
Files changed (65) hide show
  1. package/dist/ItemCategoriesSearch-44b87663.d.ts +318 -0
  2. package/dist/ItemCategoriesSearch-e0870a34.d.ts +318 -0
  3. package/dist/ItemCategoriesSearch-e3298650.d.ts +319 -0
  4. package/dist/ItemCategoriesSearch-ec43591f.d.ts +319 -0
  5. package/dist/ItemCategory-14816deb.d.ts +99 -0
  6. package/dist/ItemErrorDetails-0eed9761.d.ts +3200 -0
  7. package/dist/ItemErrorDetails-1614b511.d.ts +3137 -0
  8. package/dist/ItemErrorDetails-1bd2821e.d.ts +3137 -0
  9. package/dist/ItemErrorDetails-b2c79d10.d.ts +3197 -0
  10. package/dist/ItemErrorDetails-ba155b70.d.ts +3269 -0
  11. package/dist/ItemErrorDetails-bc465036.d.ts +3200 -0
  12. package/dist/ItemErrorDetails-e6e400aa.d.ts +3197 -0
  13. package/dist/ItemErrorDetailsResult-0b4a628c.d.ts +3032 -0
  14. package/dist/ItemErrorDetailsResult-8317ab6e.d.ts +3092 -0
  15. package/dist/ItemErrorDetailsResult-859368da.d.ts +3032 -0
  16. package/dist/ItemErrorDetailsResult-9ac97c24.d.ts +3032 -0
  17. package/dist/ItemErrorDetailsResult-ae90f329.d.ts +3097 -0
  18. package/dist/ItemErrorDetailsResult-c12c4eac.d.ts +3032 -0
  19. package/dist/ItemErrorDetailsResult-c62caeae.d.ts +3092 -0
  20. package/dist/ItemErrorDetailsResult-fbc33a43.d.ts +3097 -0
  21. package/dist/ItemStatusResponse-7f871d5a.d.ts +91 -0
  22. package/dist/TradingPartnerAccessByCompanyId-29866586.d.ts +97 -0
  23. package/dist/TradingPartnerAccessByCompanyId-43f83fb6.d.ts +130 -0
  24. package/dist/TradingPartnerAccessByCompanyId-53b868a8.d.ts +125 -0
  25. package/dist/TradingPartnerAccessByCompanyId-b227f0c5.d.ts +125 -0
  26. package/dist/TradingPartnerAccessByCompanyId-e7a1d443.d.ts +129 -0
  27. package/dist/chunk-3CJG5LDN.js +360 -0
  28. package/dist/chunk-3FMMM7IS.js +80 -0
  29. package/dist/chunk-3JRE7YYE.js +4576 -0
  30. package/dist/chunk-4HWZ3JEH.js +328 -0
  31. package/dist/chunk-4WER3ZLX.js +4576 -0
  32. package/dist/chunk-5YWAQNT6.js +4634 -0
  33. package/dist/chunk-6ZNFOWTV.js +78 -0
  34. package/dist/chunk-CB3PVPHS.js +344 -0
  35. package/dist/chunk-ETURPA7W.js +326 -0
  36. package/dist/chunk-F3KCLICG.js +77 -0
  37. package/dist/chunk-FS6LHGAR.js +87 -0
  38. package/dist/chunk-G36FM5OA.js +327 -0
  39. package/dist/chunk-GDFX3WTX.js +78 -0
  40. package/dist/chunk-GSUSBCHT.js +4576 -0
  41. package/dist/chunk-IHIEBLQV.js +4576 -0
  42. package/dist/chunk-ITWMRXLD.js +328 -0
  43. package/dist/chunk-J3A66IGS.js +389 -0
  44. package/dist/chunk-LYMGZWSR.js +80 -0
  45. package/dist/chunk-N2OYWNHF.js +80 -0
  46. package/dist/chunk-OA6PO3QG.js +78 -0
  47. package/dist/chunk-OBXZRDPY.js +77 -0
  48. package/dist/chunk-OI47EFQH.js +82 -0
  49. package/dist/chunk-OVOZIZA2.js +326 -0
  50. package/dist/chunk-RRGAJ4ZS.js +4576 -0
  51. package/dist/chunk-T3UCSW2B.js +81 -0
  52. package/dist/chunk-VNFU2PUV.js +4577 -0
  53. package/dist/chunk-WN2FPUF3.js +4577 -0
  54. package/dist/chunk-XMNYZGXF.js +84 -0
  55. package/dist/chunk-YCQUK6KV.js +85 -0
  56. package/dist/index.cjs +1001 -84
  57. package/dist/index.d.ts +197 -46
  58. package/dist/index.js +23 -56
  59. package/dist/msw.cjs +1056 -65
  60. package/dist/msw.d.ts +638 -76
  61. package/dist/msw.js +317 -54
  62. package/dist/zod.cjs +812 -17
  63. package/dist/zod.d.ts +4 -2
  64. package/dist/zod.js +112 -52
  65. package/package.json +8 -9
package/dist/index.d.ts CHANGED
@@ -1,33 +1,12 @@
1
- import { A as AsstClient, V as VendorPartnerAttGroups, a as AttrProdType, T as TradingPartnerAccessByCompanyId } from './TradingPartnerAccessByCompanyId-479e3e57.js';
2
- export { b as AsstClientOptions, c as AsstUrl, B as BASE_URLS, E as Env } from './TradingPartnerAccessByCompanyId-479e3e57.js';
3
- import { I as Import, a as ImportsStatus, E as Export, b as ItemCategoriesSearch } from './ItemCategoriesSearch-1bb945de.js';
4
- export { c as ImportErrors } from './ItemCategoriesSearch-1bb945de.js';
1
+ import { A as AsstClient, I as Import, a as ImportsStatus, V as VendorPartnerAttGroups, E as Export, b as AttrProdType, T as TradingPartnerAccessByCompanyId, c as ItemCategoriesSearch, d as AttributeMetaData, e as AttributesByCompany, f as AttributeDefinition, g as AttributeValidValues, L as Locale, S as SpreadsheetTemplate, U as UserAccount, h as ItemSearchView, i as ItemDetailView, j as ItemErrorDetailsResult } from './ItemErrorDetailsResult-fbc33a43.js';
2
+ export { k as AsstClientOptions, l as AsstUrl, B as BASE_URLS, m as Env, n as ImportErrors } from './ItemErrorDetailsResult-fbc33a43.js';
3
+ import { G as GenerateImportTemplateParams, D as DownLoadItemsParams, I as ItemHierarchyResponse, a as ItemDetail, S as SpsItemIdResponse } from './ItemErrorDetails-ba155b70.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 './ItemErrorDetails-ba155b70.js';
5
+ import { I as ItemStatusResponse } from './ItemStatusResponse-7f871d5a.js';
5
6
  import { z } from 'zod';
6
- export { E as ExportDayOfWeek, c as ExportFrequency, d as ExportType, I as ImportDetails, a as ImportError, b as ImportStatusEnum, e as ItemCategory } from './ItemCategory-768179bd.js';
7
7
  import 'ky-universal';
8
8
  import 'ky';
9
9
 
10
- declare const generateImportTemplateParamsSchema: z.ZodObject<{
11
- "multi-sheet": z.ZodBoolean;
12
- gids: z.ZodOptional<z.ZodString>;
13
- productTypeIds: z.ZodOptional<z.ZodString>;
14
- groupTypeId: z.ZodOptional<z.ZodNumber>;
15
- includeGuides: z.ZodOptional<z.ZodBoolean>;
16
- }, "strip", z.ZodTypeAny, {
17
- "multi-sheet": boolean;
18
- gids?: string | undefined;
19
- productTypeIds?: string | undefined;
20
- groupTypeId?: number | undefined;
21
- includeGuides?: boolean | undefined;
22
- }, {
23
- "multi-sheet": boolean;
24
- gids?: string | undefined;
25
- productTypeIds?: string | undefined;
26
- groupTypeId?: number | undefined;
27
- includeGuides?: boolean | undefined;
28
- }>;
29
- type GenerateImportTemplateParams = z.infer<typeof generateImportTemplateParamsSchema>;
30
-
31
10
  /**
32
11
  * Initialize Imports Api functions
33
12
  * @param client Assortment Client instance
@@ -41,10 +20,10 @@ declare function createImportsApi(client: AsstClient): {
41
20
  importId: number;
42
21
  count: number;
43
22
  errors: {
44
- attribute: string;
45
23
  description: string;
46
24
  importErrorId: number;
47
25
  row: number;
26
+ attribute?: string | null | undefined;
48
27
  }[];
49
28
  hasNext: boolean;
50
29
  totalCount: number;
@@ -65,6 +44,7 @@ declare function createImportsApi(client: AsstClient): {
65
44
  */
66
45
  declare function createExportsApi(client: AsstClient): {
67
46
  createExport: (data: Export) => Promise<void>;
47
+ downloadItems: (params: DownLoadItemsParams) => Promise<void>;
68
48
  };
69
49
 
70
50
  /**
@@ -78,24 +58,6 @@ declare function createProductTypesApi(client: AsstClient): {
78
58
  }, signal?: AbortSignal) => Promise<AttrProdType[]>;
79
59
  };
80
60
 
81
- declare const connectionSchema: z.ZodObject<{
82
- catalog_id: z.ZodNumber;
83
- catalog_name: z.ZodString;
84
- partner_company_name: z.ZodString;
85
- partner_company_id: z.ZodNumber;
86
- }, "strip", z.ZodTypeAny, {
87
- catalog_id: number;
88
- catalog_name: string;
89
- partner_company_name: string;
90
- partner_company_id: number;
91
- }, {
92
- catalog_id: number;
93
- catalog_name: string;
94
- partner_company_name: string;
95
- partner_company_id: number;
96
- }>;
97
- type Connection = z.infer<typeof connectionSchema>;
98
-
99
61
  /**
100
62
  * Initialize Trading Partner Access Api functions
101
63
  * @param client Assortment Client instance
@@ -116,10 +78,199 @@ declare function createCategoriesApi(client: AsstClient): {
116
78
  }, signal?: AbortSignal) => Promise<ItemCategoriesSearch>;
117
79
  getProductCodes: (params?: {
118
80
  categoryName?: string;
81
+ catalogId?: string;
82
+ selectionCodeId?: string;
119
83
  }, signal?: AbortSignal) => Promise<ItemCategoriesSearch>;
120
84
  getSelectionCodes: (params?: {
121
85
  categoryName?: string;
86
+ catalogId?: string;
122
87
  }, signal?: AbortSignal) => Promise<ItemCategoriesSearch>;
88
+ getItemHierarchy: (itemIds: string[]) => Promise<ItemHierarchyResponse>;
89
+ };
90
+
91
+ /**
92
+ * Initialize Attributes Api functions
93
+ * @param client Assortment Client instance
94
+ * @returns An object containing Attributes API functions
95
+ */
96
+ declare function createAttributesApi(client: AsstClient): {
97
+ getAllAttributes: (signal?: AbortSignal) => Promise<AttributeMetaData[]>;
98
+ getAllAttributesByCompany: (params?: {
99
+ offset?: number;
100
+ limit?: number;
101
+ }, signal?: AbortSignal) => Promise<AttributesByCompany>;
102
+ getAttributesExtensiveInfo: (signal?: AbortSignal) => Promise<AttributeDefinition[]>;
103
+ getAttributeValidValues: (attributeDbName: string, signal?: AbortSignal) => Promise<AttributeValidValues[]>;
104
+ getCompanyInterestedAttributes: (signal?: AbortSignal) => Promise<string[]>;
105
+ };
106
+
107
+ /**
108
+ * Initialize Locale Api functions
109
+ * @param client Assortment Client instance
110
+ * @returns An object containing Locale API functions
111
+ */
112
+ declare function createLocaleApi(client: AsstClient): {
113
+ getLocale: (signal?: AbortSignal) => Promise<Locale[]>;
114
+ };
115
+
116
+ /**
117
+ * Initialize Spreadsheet Template Api functions
118
+ * @param client Assortment Client instance
119
+ * @returns An object containing Spreadsheet Template API functions
120
+ */
121
+ declare function createSpreadsheetTemplateApi(client: AsstClient): {
122
+ getTemplates: (signal?: AbortSignal) => Promise<SpreadsheetTemplate[]>;
123
+ };
124
+
125
+ /**
126
+ * Initialize WhoAmI Api functions
127
+ * @param client Assortment Client instance
128
+ * @returns An object containing WhoAmI API functions
129
+ */
130
+ declare function createWhoAmIApi(client: AsstClient): {
131
+ whoAmI: (signal?: AbortSignal) => Promise<UserAccount>;
132
+ };
133
+
134
+ /**
135
+ * Initialize Company Features Api functions
136
+ * @param client Assortment Client instance
137
+ * @returns An object containing Company Features API functions
138
+ */
139
+ declare function createCompanyFeaturesApi(client: AsstClient): {
140
+ checkIfStageItemSetupIsEnabled: (signal?: AbortSignal) => Promise<boolean>;
141
+ };
142
+
143
+ /**
144
+ * Initialize Feature Flags Api functions
145
+ * @param client Assortment Client instance
146
+ * @returns An object containing feature flags utility functions
147
+ */
148
+ declare function createFeatureFlagsApi(client: AsstClient): {
149
+ checkEnableItemsApiEndpointsForImports: (signal?: AbortSignal) => Promise<boolean>;
150
+ };
151
+
152
+ declare const itemStatusSchema: z.ZodObject<{
153
+ itemId: z.ZodString;
154
+ itemOrgStatuses: z.ZodArray<z.ZodObject<{
155
+ org: z.ZodObject<{
156
+ ref: z.ZodString;
157
+ id: z.ZodString;
158
+ name: z.ZodString;
159
+ }, "strip", z.ZodTypeAny, {
160
+ name: string;
161
+ id: string;
162
+ ref: string;
163
+ }, {
164
+ name: string;
165
+ id: string;
166
+ ref: string;
167
+ }>;
168
+ lowestInvalidStage: z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED", "STANDARD_REQUIREMENTS"]>>;
169
+ validForRelationship: z.ZodBoolean;
170
+ }, "strip", z.ZodTypeAny, {
171
+ org: {
172
+ name: string;
173
+ id: string;
174
+ ref: string;
175
+ };
176
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
177
+ validForRelationship: boolean;
178
+ }, {
179
+ org: {
180
+ name: string;
181
+ id: string;
182
+ ref: string;
183
+ };
184
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
185
+ validForRelationship: boolean;
186
+ }>, "many">;
187
+ }, "strip", z.ZodTypeAny, {
188
+ itemId: string;
189
+ itemOrgStatuses: {
190
+ org: {
191
+ name: string;
192
+ id: string;
193
+ ref: string;
194
+ };
195
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
196
+ validForRelationship: boolean;
197
+ }[];
198
+ }, {
199
+ itemId: string;
200
+ itemOrgStatuses: {
201
+ org: {
202
+ name: string;
203
+ id: string;
204
+ ref: string;
205
+ };
206
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
207
+ validForRelationship: boolean;
208
+ }[];
209
+ }>;
210
+ type ItemStatus = z.infer<typeof itemStatusSchema>;
211
+
212
+ declare const itemOrgStatusSchema: z.ZodObject<{
213
+ org: z.ZodObject<{
214
+ ref: z.ZodString;
215
+ id: z.ZodString;
216
+ name: z.ZodString;
217
+ }, "strip", z.ZodTypeAny, {
218
+ name: string;
219
+ id: string;
220
+ ref: string;
221
+ }, {
222
+ name: string;
223
+ id: string;
224
+ ref: string;
225
+ }>;
226
+ lowestInvalidStage: z.ZodNullable<z.ZodEnum<["CORE", "CORE_PLUS", "CORE_ADVANCED", "ENRICHED", "STANDARD_REQUIREMENTS"]>>;
227
+ validForRelationship: z.ZodBoolean;
228
+ }, "strip", z.ZodTypeAny, {
229
+ org: {
230
+ name: string;
231
+ id: string;
232
+ ref: string;
233
+ };
234
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
235
+ validForRelationship: boolean;
236
+ }, {
237
+ org: {
238
+ name: string;
239
+ id: string;
240
+ ref: string;
241
+ };
242
+ lowestInvalidStage: "CORE" | "CORE_PLUS" | "CORE_ADVANCED" | "ENRICHED" | "STANDARD_REQUIREMENTS" | null;
243
+ validForRelationship: boolean;
244
+ }>;
245
+ type ItemOrgStatus = z.infer<typeof itemOrgStatusSchema>;
246
+
247
+ /**
248
+ * Initialize Items Api functions
249
+ * @param client Assortment Client instance
250
+ * @returns An object containing Items API functions
251
+ */
252
+ declare function createItemsApi(client: AsstClient): {
253
+ searchItems: (params?: {
254
+ url: string;
255
+ limit?: number;
256
+ offset?: number;
257
+ }, signal?: AbortSignal) => Promise<ItemSearchView>;
258
+ getItem: (itemId: string, locale?: string, signal?: AbortSignal) => Promise<ItemDetailView>;
259
+ updateItem: (itemId: string, item: ItemDetail) => Promise<void>;
260
+ deleteItem: (itemId: number) => Promise<void>;
261
+ deleteItems: (itemIds: string[]) => Promise<void>;
262
+ getItemInfoId: (spsItemId: string, signal?: AbortSignal) => Promise<number>;
263
+ getSpsItemId: (itemInfoId: string, signal?: AbortSignal) => Promise<SpsItemIdResponse>;
264
+ getItemStatus: (itemIds: string[]) => Promise<ItemStatusResponse>;
265
+ };
266
+
267
+ /**
268
+ * Initialize Errors Api functions
269
+ * @param client Assortment Client instance
270
+ * @returns An object containing Errors API functions
271
+ */
272
+ declare function createErrorsApi(client: AsstClient): {
273
+ getInvalidItemErrorDetails: (itemInfoId: string, signal?: AbortSignal) => Promise<ItemErrorDetailsResult>;
123
274
  };
124
275
 
125
- export { AsstClient, AttrProdType, Connection, Export, GenerateImportTemplateParams, Import, ImportsStatus, ItemCategoriesSearch, TradingPartnerAccessByCompanyId, VendorPartnerAttGroups, createCategoriesApi, createExportsApi, createImportsApi, createProductTypesApi, createTradingPartnerAccessApi };
276
+ 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, createWhoAmIApi };
package/dist/index.js CHANGED
@@ -1,69 +1,36 @@
1
1
  import {
2
+ createAttributesApi,
2
3
  createCategoriesApi,
4
+ createCompanyFeaturesApi,
5
+ createErrorsApi,
3
6
  createExportsApi,
7
+ createFeatureFlagsApi,
4
8
  createImportsApi,
9
+ createItemsApi,
10
+ createLocaleApi,
5
11
  createProductTypesApi,
6
- createTradingPartnerAccessApi
7
- } from "./chunk-RNUSCCKB.js";
8
- import "./chunk-D3ML6E4G.js";
9
-
10
- // lib/asstClient.ts
11
- import ky from "ky-universal";
12
- var BASE_URLS = {
13
- local: "https://localhost:8443",
14
- test: "https://integration.api.spscommerce.com/assortment/gateway",
15
- prod: "https://api.spscommerce.com/assortment/gateway"
16
- };
17
- var AsstClient = class {
18
- #client = ky.create({
19
- prefixUrl: BASE_URLS["test"],
20
- retry: 0
21
- });
22
- #baseUrl = BASE_URLS["test"];
23
- #subscriptionCallback;
24
- constructor(options) {
25
- this.updateConfig(options);
26
- }
27
- updateConfig(options) {
28
- this.#client = this.#client.extend(options);
29
- if (options.prefixUrl) {
30
- this.#baseUrl = options.prefixUrl;
31
- }
32
- if (this.#subscriptionCallback) {
33
- this.#subscriptionCallback(options);
34
- }
35
- }
36
- getBaseUrl() {
37
- return this.#baseUrl;
38
- }
39
- subscribeToConfigChange(subscriptionCallback) {
40
- this.#subscriptionCallback = subscriptionCallback;
41
- }
42
- get(url, options) {
43
- return this.#client.get(url, options);
44
- }
45
- post(url, options) {
46
- return this.#client.post(url, options);
47
- }
48
- put(url, options) {
49
- return this.#client.put(url, options);
50
- }
51
- patch(url, options) {
52
- return this.#client.patch(url, options);
53
- }
54
- head(url, options) {
55
- return this.#client.head(url, options);
56
- }
57
- delete(url, options) {
58
- return this.#client.delete(url, options);
59
- }
60
- };
12
+ createSpreadsheetTemplateApi,
13
+ createTradingPartnerAccessApi,
14
+ createWhoAmIApi
15
+ } from "./chunk-J3A66IGS.js";
16
+ import {
17
+ AsstClient,
18
+ BASE_URLS
19
+ } from "./chunk-5YWAQNT6.js";
61
20
  export {
62
21
  AsstClient,
63
22
  BASE_URLS,
23
+ createAttributesApi,
64
24
  createCategoriesApi,
25
+ createCompanyFeaturesApi,
26
+ createErrorsApi,
65
27
  createExportsApi,
28
+ createFeatureFlagsApi,
66
29
  createImportsApi,
30
+ createItemsApi,
31
+ createLocaleApi,
67
32
  createProductTypesApi,
68
- createTradingPartnerAccessApi
33
+ createSpreadsheetTemplateApi,
34
+ createTradingPartnerAccessApi,
35
+ createWhoAmIApi
69
36
  };