@spscommerce/asst-api 0.0.1-beta.9 → 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.
- package/dist/{ItemErrorDetailsResult-c62caeae.d.ts → ItemErrorDetailsResult-317fbe3e.d.ts} +166 -156
- package/dist/ItemStatusResponse-7f871d5a.d.ts +91 -0
- package/dist/{chunk-IHIEBLQV.js → chunk-HEFVXX2V.js} +82 -23
- package/dist/{chunk-ITWMRXLD.js → chunk-HG7MCO42.js} +77 -16
- package/dist/index.cjs +148 -36
- package/dist/index.d.ts +119 -6
- package/dist/index.js +4 -2
- package/dist/msw.cjs +158 -29
- package/dist/msw.d.ts +110 -69
- package/dist/msw.js +82 -11
- package/dist/{ItemErrorDetails-e6e400aa.d.ts → zod-1c4396f8.d.ts} +179 -103
- package/dist/zod.cjs +84 -22
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +9 -1
- package/package.json +1 -1
- package/dist/ImportsStatus-52d26b01.d.ts +0 -134
- package/dist/ImportsStatusEnum-22c03a0b.d.ts +0 -51
- package/dist/ItemCategoriesSearch-1bb945de.d.ts +0 -275
- package/dist/ItemCategoriesSearch-44b87663.d.ts +0 -318
- package/dist/ItemCategoriesSearch-e0870a34.d.ts +0 -318
- package/dist/ItemCategoriesSearch-e3298650.d.ts +0 -319
- package/dist/ItemCategoriesSearch-ec43591f.d.ts +0 -319
- package/dist/ItemCategory-14816deb.d.ts +0 -99
- package/dist/ItemCategory-768179bd.d.ts +0 -99
- package/dist/ItemErrorDetails-1614b511.d.ts +0 -3137
- package/dist/ItemErrorDetails-1bd2821e.d.ts +0 -3137
- package/dist/ItemErrorDetailsResult-0b4a628c.d.ts +0 -3032
- package/dist/ItemErrorDetailsResult-859368da.d.ts +0 -3032
- package/dist/ItemErrorDetailsResult-9ac97c24.d.ts +0 -3032
- package/dist/ItemErrorDetailsResult-c12c4eac.d.ts +0 -3032
- package/dist/TradingPartnerAccessByCompanyId-29866586.d.ts +0 -97
- package/dist/TradingPartnerAccessByCompanyId-43f83fb6.d.ts +0 -130
- package/dist/TradingPartnerAccessByCompanyId-479e3e57.d.ts +0 -124
- package/dist/TradingPartnerAccessByCompanyId-53b868a8.d.ts +0 -125
- package/dist/TradingPartnerAccessByCompanyId-b227f0c5.d.ts +0 -125
- package/dist/TradingPartnerAccessByCompanyId-e7a1d443.d.ts +0 -129
- package/dist/asstClient-f6a1693a.d.ts +0 -29
- package/dist/chunk-3FMMM7IS.js +0 -80
- package/dist/chunk-3JRE7YYE.js +0 -4576
- package/dist/chunk-4WER3ZLX.js +0 -4576
- package/dist/chunk-6ZNFOWTV.js +0 -78
- package/dist/chunk-7HCJJATJ.js +0 -40
- package/dist/chunk-B7B2ACF4.js +0 -3794
- package/dist/chunk-D3ML6E4G.js +0 -3787
- package/dist/chunk-ETURPA7W.js +0 -326
- package/dist/chunk-F3KCLICG.js +0 -77
- package/dist/chunk-FS6LHGAR.js +0 -87
- package/dist/chunk-G36FM5OA.js +0 -327
- package/dist/chunk-GDFX3WTX.js +0 -78
- package/dist/chunk-LGP22FRF.js +0 -0
- package/dist/chunk-LYMGZWSR.js +0 -80
- package/dist/chunk-N2OYWNHF.js +0 -80
- package/dist/chunk-OA6PO3QG.js +0 -78
- package/dist/chunk-OBXZRDPY.js +0 -77
- package/dist/chunk-OI47EFQH.js +0 -82
- package/dist/chunk-OVOZIZA2.js +0 -326
- package/dist/chunk-RNUSCCKB.js +0 -183
- package/dist/chunk-RRGAJ4ZS.js +0 -4576
- package/dist/chunk-T3UCSW2B.js +0 -81
- package/dist/chunk-XMNYZGXF.js +0 -84
- package/dist/chunk-YCQUK6KV.js +0 -85
package/dist/chunk-G36FM5OA.js
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
attrProdTypeSchema,
|
|
3
|
-
attributeDefinitionSchema,
|
|
4
|
-
attributeMetaDataSchema,
|
|
5
|
-
attributeValidValuesSchema,
|
|
6
|
-
attributesByCompanySchema,
|
|
7
|
-
importErrorsSchema,
|
|
8
|
-
importSchema,
|
|
9
|
-
importsStatusSchema,
|
|
10
|
-
itemCategoriesSearchSchema,
|
|
11
|
-
itemDetailViewSchema,
|
|
12
|
-
itemErrorDetailsResultSchema,
|
|
13
|
-
itemSearchViewSchema,
|
|
14
|
-
localeSchema,
|
|
15
|
-
spreadsheetTemplateSchema,
|
|
16
|
-
tradingPartnerAccessByCompanyIdSchema,
|
|
17
|
-
userAccountSchema,
|
|
18
|
-
vendorPartnerAttGroupsSchema,
|
|
19
|
-
z
|
|
20
|
-
} from "./chunk-RRGAJ4ZS.js";
|
|
21
|
-
|
|
22
|
-
// lib/imports/index.ts
|
|
23
|
-
var BASE_URL = "imports";
|
|
24
|
-
function createImportsApi(client) {
|
|
25
|
-
async function getImportErrors(importId, params, signal) {
|
|
26
|
-
const data = await client.get(`${BASE_URL}/${importId}/errors`, { searchParams: params, signal }).json();
|
|
27
|
-
return importErrorsSchema.parse(data);
|
|
28
|
-
}
|
|
29
|
-
async function getImports(params, signal) {
|
|
30
|
-
const data = await client.get(`${BASE_URL}`, {
|
|
31
|
-
searchParams: params,
|
|
32
|
-
signal
|
|
33
|
-
}).json();
|
|
34
|
-
return importSchema.parse(data);
|
|
35
|
-
}
|
|
36
|
-
async function getImportsStatus(signal) {
|
|
37
|
-
const data = await client.get(`${BASE_URL}/status`, { signal }).json();
|
|
38
|
-
return z.array(importsStatusSchema).parse(data);
|
|
39
|
-
}
|
|
40
|
-
async function uploadImport(file) {
|
|
41
|
-
await client.post(`${BASE_URL}`, { body: file });
|
|
42
|
-
}
|
|
43
|
-
async function getVendorPartnerGroups(signal) {
|
|
44
|
-
const data = await client.get(`${BASE_URL}/template/vendor-partner-groups`, { signal }).json();
|
|
45
|
-
return z.array(vendorPartnerAttGroupsSchema).parse(data);
|
|
46
|
-
}
|
|
47
|
-
async function generateImportTemplate(params) {
|
|
48
|
-
const response = await client.get(`${BASE_URL}/template/generate`, {
|
|
49
|
-
searchParams: params,
|
|
50
|
-
headers: {
|
|
51
|
-
Accept: "application/octet-stream"
|
|
52
|
-
},
|
|
53
|
-
timeout: false
|
|
54
|
-
});
|
|
55
|
-
const disposition = response.headers.get("content-disposition") || "";
|
|
56
|
-
const filename = disposition.match(/filename="(.+)"/)?.[1];
|
|
57
|
-
const downloadUrl = window.URL.createObjectURL(
|
|
58
|
-
new Blob([await response.blob()])
|
|
59
|
-
);
|
|
60
|
-
const link = document.createElement("a");
|
|
61
|
-
link.href = downloadUrl;
|
|
62
|
-
if (filename) {
|
|
63
|
-
link.download = filename;
|
|
64
|
-
}
|
|
65
|
-
document.body.appendChild(link);
|
|
66
|
-
link.click();
|
|
67
|
-
link.remove();
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
getImportErrors,
|
|
71
|
-
getImports,
|
|
72
|
-
getImportsStatus,
|
|
73
|
-
uploadImport,
|
|
74
|
-
getVendorPartnerGroups,
|
|
75
|
-
generateImportTemplate
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// lib/exports/index.ts
|
|
80
|
-
var BASE_URL2 = "exports";
|
|
81
|
-
var BASE_URL_V2 = "v2/exports";
|
|
82
|
-
function createExportsApi(client) {
|
|
83
|
-
async function createExport(data) {
|
|
84
|
-
await client.post(`${BASE_URL_V2}/add`, { json: data });
|
|
85
|
-
}
|
|
86
|
-
async function downloadItems(params) {
|
|
87
|
-
const searchParams = { ...params, ids: params.ids.join(",") };
|
|
88
|
-
const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
|
|
89
|
-
searchParams,
|
|
90
|
-
headers: {
|
|
91
|
-
Accept: "application/octet-stream"
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const disposition = response.headers.get("content-disposition") || "";
|
|
95
|
-
const filename = disposition.match(/filename="(.+)"/)?.[1];
|
|
96
|
-
const downloadUrl = window.URL.createObjectURL(
|
|
97
|
-
new Blob([await response.blob()])
|
|
98
|
-
);
|
|
99
|
-
const link = document.createElement("a");
|
|
100
|
-
link.href = downloadUrl;
|
|
101
|
-
if (filename) {
|
|
102
|
-
link.download = filename;
|
|
103
|
-
}
|
|
104
|
-
document.body.appendChild(link);
|
|
105
|
-
link.click();
|
|
106
|
-
link.remove();
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
createExport,
|
|
110
|
-
downloadItems
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// lib/productTypes/index.ts
|
|
115
|
-
var BASE_URL3 = "product-types";
|
|
116
|
-
function createProductTypesApi(client) {
|
|
117
|
-
async function getProductTypes(params, signal) {
|
|
118
|
-
const searchParams = params ? { retailerIds: params.retailerIds.join(",") } : void 0;
|
|
119
|
-
const data = await client.get(`${BASE_URL3}/all`, {
|
|
120
|
-
searchParams,
|
|
121
|
-
signal
|
|
122
|
-
}).json();
|
|
123
|
-
return z.array(attrProdTypeSchema).parse(data.results);
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
getProductTypes
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// lib/tradingPartners/index.ts
|
|
131
|
-
var BASE_URL4 = "trading-partner-access";
|
|
132
|
-
function createTradingPartnerAccessApi(client) {
|
|
133
|
-
async function getAllTradingPartners(signal) {
|
|
134
|
-
const data = await client.get(`${BASE_URL4}/connections`, {
|
|
135
|
-
signal
|
|
136
|
-
}).json();
|
|
137
|
-
return tradingPartnerAccessByCompanyIdSchema.parse(data);
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
getAllTradingPartners
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// lib/categories/index.ts
|
|
145
|
-
var BASE_URL5 = "categories";
|
|
146
|
-
function createCategoriesApi(client) {
|
|
147
|
-
async function getCatalogs(params, signal) {
|
|
148
|
-
const data = await client.get(`${BASE_URL5}/search-category`, {
|
|
149
|
-
searchParams: { ...params, type: "CATALOG" },
|
|
150
|
-
signal
|
|
151
|
-
}).json();
|
|
152
|
-
return itemCategoriesSearchSchema.parse(data);
|
|
153
|
-
}
|
|
154
|
-
async function getProductCodes(params, signal) {
|
|
155
|
-
const data = await client.get(`${BASE_URL5}/search-category`, {
|
|
156
|
-
searchParams: { ...params, type: "PRODUCT_CODE" },
|
|
157
|
-
signal
|
|
158
|
-
}).json();
|
|
159
|
-
return itemCategoriesSearchSchema.parse(data);
|
|
160
|
-
}
|
|
161
|
-
async function getSelectionCodes(params, signal) {
|
|
162
|
-
const data = await client.get(`${BASE_URL5}/search-category`, {
|
|
163
|
-
searchParams: { ...params, type: "SELECTION_CODE" },
|
|
164
|
-
signal
|
|
165
|
-
}).json();
|
|
166
|
-
return itemCategoriesSearchSchema.parse(data);
|
|
167
|
-
}
|
|
168
|
-
return { getCatalogs, getProductCodes, getSelectionCodes };
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// lib/attributes/index.ts
|
|
172
|
-
var BASE_URL6 = "attributes";
|
|
173
|
-
function createAttributesApi(client) {
|
|
174
|
-
async function getAllAttributes(signal) {
|
|
175
|
-
const data = await client.get(`${BASE_URL6}`, { signal }).json();
|
|
176
|
-
return z.array(attributeMetaDataSchema).parse(data);
|
|
177
|
-
}
|
|
178
|
-
async function getAllAttributesByCompany(params, signal) {
|
|
179
|
-
const data = await client.get(`${BASE_URL6}/company`, {
|
|
180
|
-
searchParams: params,
|
|
181
|
-
signal
|
|
182
|
-
}).json();
|
|
183
|
-
return attributesByCompanySchema.parse(data);
|
|
184
|
-
}
|
|
185
|
-
async function getAttributesExtensiveInfo(signal) {
|
|
186
|
-
const data = await client.get(`${BASE_URL6}/registry/editui`, { signal }).json();
|
|
187
|
-
return z.array(attributeDefinitionSchema).parse(data);
|
|
188
|
-
}
|
|
189
|
-
async function getAttributeValidValues(attributeDbName, signal) {
|
|
190
|
-
const data = await client.get(`${BASE_URL6}/registry/attribute/${attributeDbName}/values`, {
|
|
191
|
-
signal
|
|
192
|
-
}).json();
|
|
193
|
-
return z.array(attributeValidValuesSchema).parse(data);
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
getAllAttributes,
|
|
197
|
-
getAllAttributesByCompany,
|
|
198
|
-
getAttributesExtensiveInfo,
|
|
199
|
-
getAttributeValidValues
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// lib/locale/index.ts
|
|
204
|
-
var BASE_URL7 = "locale";
|
|
205
|
-
function createLocaleApi(client) {
|
|
206
|
-
async function getLocale(signal) {
|
|
207
|
-
const data = await client.get(`${BASE_URL7}`, { signal }).json();
|
|
208
|
-
return z.array(localeSchema).parse(data);
|
|
209
|
-
}
|
|
210
|
-
return {
|
|
211
|
-
getLocale
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// lib/spreadsheetTemplate/index.ts
|
|
216
|
-
var BASE_URL8 = "templates";
|
|
217
|
-
function createSpreadsheetTemplateApi(client) {
|
|
218
|
-
async function getTemplates(signal) {
|
|
219
|
-
const data = await client.get(`${BASE_URL8}`, { signal }).json();
|
|
220
|
-
return z.array(spreadsheetTemplateSchema).parse(data);
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
getTemplates
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// lib/whoami/index.ts
|
|
228
|
-
var BASE_URL9 = "whoami";
|
|
229
|
-
function createWhoAmIApi(client) {
|
|
230
|
-
async function whoAmI(signal) {
|
|
231
|
-
const data = await client.get(`${BASE_URL9}`, { signal }).json();
|
|
232
|
-
return userAccountSchema.parse(data);
|
|
233
|
-
}
|
|
234
|
-
return {
|
|
235
|
-
whoAmI
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// lib/companyFeatures/index.ts
|
|
240
|
-
var BASE_URL10 = "feature";
|
|
241
|
-
function createCompanyFeaturesApi(client) {
|
|
242
|
-
async function checkIfStageItemSetupIsEnabled(signal) {
|
|
243
|
-
const data = await client.get(`${BASE_URL10}/isphaseditemsetupenabled`, {
|
|
244
|
-
signal
|
|
245
|
-
}).json();
|
|
246
|
-
return z.boolean().parse(data);
|
|
247
|
-
}
|
|
248
|
-
return {
|
|
249
|
-
checkIfStageItemSetupIsEnabled
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// lib/items/index.ts
|
|
254
|
-
var BASE_URL11 = "items";
|
|
255
|
-
function createItemsApi(client) {
|
|
256
|
-
async function searchItems(params, signal) {
|
|
257
|
-
const searchParams = params ? `limit=${params.limit}&offset=${params.offset}` + (params.url ? `&${params.url}` : "") : void 0;
|
|
258
|
-
const data = await client.get(`${BASE_URL11}`, { searchParams, signal }).json();
|
|
259
|
-
return itemSearchViewSchema.parse(data);
|
|
260
|
-
}
|
|
261
|
-
async function getItem(itemId, locale = "en-US", signal) {
|
|
262
|
-
const data = await client.get(`${BASE_URL11}/${itemId}`, { searchParams: { locale }, signal }).json();
|
|
263
|
-
return itemDetailViewSchema.parse(data);
|
|
264
|
-
}
|
|
265
|
-
async function updateItem(itemId, item) {
|
|
266
|
-
await client.put(`${BASE_URL11}/details/${itemId}`, { json: { ...item } }).json();
|
|
267
|
-
}
|
|
268
|
-
async function deleteItem(itemId) {
|
|
269
|
-
await client.delete(`${BASE_URL11}/${itemId}`);
|
|
270
|
-
}
|
|
271
|
-
async function deleteItems(itemIds) {
|
|
272
|
-
const params = new URLSearchParams();
|
|
273
|
-
itemIds.forEach((id) => {
|
|
274
|
-
params.append("items", id);
|
|
275
|
-
});
|
|
276
|
-
await client.delete(`${BASE_URL11}`, { searchParams: params });
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
searchItems,
|
|
280
|
-
getItem,
|
|
281
|
-
updateItem,
|
|
282
|
-
deleteItem,
|
|
283
|
-
deleteItems
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// lib/errors/index.ts
|
|
288
|
-
var BASE_URL12 = "errors";
|
|
289
|
-
function createErrorsApi(client) {
|
|
290
|
-
async function getInvalidItemErrorDetails(itemInfoId, signal) {
|
|
291
|
-
const data = await client.get(`${BASE_URL12}/items/${itemInfoId}`, {
|
|
292
|
-
signal
|
|
293
|
-
}).json();
|
|
294
|
-
return itemErrorDetailsResultSchema.parse(data);
|
|
295
|
-
}
|
|
296
|
-
return {
|
|
297
|
-
getInvalidItemErrorDetails
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export {
|
|
302
|
-
BASE_URL,
|
|
303
|
-
createImportsApi,
|
|
304
|
-
BASE_URL2,
|
|
305
|
-
BASE_URL_V2,
|
|
306
|
-
createExportsApi,
|
|
307
|
-
BASE_URL3,
|
|
308
|
-
createProductTypesApi,
|
|
309
|
-
BASE_URL4,
|
|
310
|
-
createTradingPartnerAccessApi,
|
|
311
|
-
BASE_URL5,
|
|
312
|
-
createCategoriesApi,
|
|
313
|
-
BASE_URL6,
|
|
314
|
-
createAttributesApi,
|
|
315
|
-
BASE_URL7,
|
|
316
|
-
createLocaleApi,
|
|
317
|
-
BASE_URL8,
|
|
318
|
-
createSpreadsheetTemplateApi,
|
|
319
|
-
BASE_URL9,
|
|
320
|
-
createWhoAmIApi,
|
|
321
|
-
BASE_URL10,
|
|
322
|
-
createCompanyFeaturesApi,
|
|
323
|
-
BASE_URL11,
|
|
324
|
-
createItemsApi,
|
|
325
|
-
BASE_URL12,
|
|
326
|
-
createErrorsApi
|
|
327
|
-
};
|
package/dist/chunk-GDFX3WTX.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
z
|
|
3
|
-
} from "./chunk-D3ML6E4G.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky-universal";
|
|
7
|
-
var baseUrlsSchema = z.object({
|
|
8
|
-
local: z.literal("https://localhost:8443"),
|
|
9
|
-
test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
|
|
10
|
-
prod: z.literal("https://api.spscommerce.com/assortment/gateway")
|
|
11
|
-
});
|
|
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 envSchema = baseUrlsSchema.keyof();
|
|
18
|
-
var AsstClient = class {
|
|
19
|
-
#client = ky.create({
|
|
20
|
-
prefixUrl: BASE_URLS["test"],
|
|
21
|
-
retry: 0
|
|
22
|
-
});
|
|
23
|
-
#baseUrl = BASE_URLS["test"];
|
|
24
|
-
#subscriptionCallback;
|
|
25
|
-
#currentConfig = {};
|
|
26
|
-
constructor(options) {
|
|
27
|
-
console.log(`AsstClient created! Config: ${JSON.stringify(options)}`);
|
|
28
|
-
this.updateConfig(options);
|
|
29
|
-
}
|
|
30
|
-
updateConfig(options) {
|
|
31
|
-
this.#client = this.#client.extend(options);
|
|
32
|
-
this.#currentConfig = options;
|
|
33
|
-
if (options.prefixUrl) {
|
|
34
|
-
this.#baseUrl = options.prefixUrl;
|
|
35
|
-
}
|
|
36
|
-
if (this.#subscriptionCallback) {
|
|
37
|
-
this.#subscriptionCallback(options);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
getBaseUrl() {
|
|
41
|
-
return this.#baseUrl;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
45
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
46
|
-
*/
|
|
47
|
-
subscribeToConfigChange(subscriptionCallback) {
|
|
48
|
-
this.#subscriptionCallback = subscriptionCallback;
|
|
49
|
-
subscriptionCallback(this.#currentConfig);
|
|
50
|
-
}
|
|
51
|
-
unsubscribeToConfigChange() {
|
|
52
|
-
this.#subscriptionCallback = void 0;
|
|
53
|
-
}
|
|
54
|
-
get(url, options) {
|
|
55
|
-
return this.#client.get(url, options);
|
|
56
|
-
}
|
|
57
|
-
post(url, options) {
|
|
58
|
-
return this.#client.post(url, options);
|
|
59
|
-
}
|
|
60
|
-
put(url, options) {
|
|
61
|
-
return this.#client.put(url, options);
|
|
62
|
-
}
|
|
63
|
-
patch(url, options) {
|
|
64
|
-
return this.#client.patch(url, options);
|
|
65
|
-
}
|
|
66
|
-
head(url, options) {
|
|
67
|
-
return this.#client.head(url, options);
|
|
68
|
-
}
|
|
69
|
-
delete(url, options) {
|
|
70
|
-
return this.#client.delete(url, options);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
BASE_URLS,
|
|
76
|
-
envSchema,
|
|
77
|
-
AsstClient
|
|
78
|
-
};
|
package/dist/chunk-LGP22FRF.js
DELETED
|
File without changes
|
package/dist/chunk-LYMGZWSR.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
z
|
|
3
|
-
} from "./chunk-D3ML6E4G.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky-universal";
|
|
7
|
-
var baseUrlsSchema = z.object({
|
|
8
|
-
local: z.literal("https://localhost:8443"),
|
|
9
|
-
test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
|
|
10
|
-
prod: z.literal("https://api.spscommerce.com/assortment/gateway")
|
|
11
|
-
});
|
|
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 envSchema = baseUrlsSchema.keyof();
|
|
18
|
-
var initialConfig = {
|
|
19
|
-
prefixUrl: BASE_URLS["test"],
|
|
20
|
-
retry: 0
|
|
21
|
-
};
|
|
22
|
-
var AsstClient = class {
|
|
23
|
-
#client = ky.create(initialConfig);
|
|
24
|
-
#baseUrl = BASE_URLS["test"];
|
|
25
|
-
#subscriptionCallback;
|
|
26
|
-
#currentConfig = initialConfig;
|
|
27
|
-
constructor(options) {
|
|
28
|
-
if (options) {
|
|
29
|
-
this.updateConfig(options);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
updateConfig(options) {
|
|
33
|
-
this.#client = this.#client.extend(options);
|
|
34
|
-
this.#currentConfig = options;
|
|
35
|
-
if (options.prefixUrl) {
|
|
36
|
-
this.#baseUrl = options.prefixUrl;
|
|
37
|
-
}
|
|
38
|
-
if (this.#subscriptionCallback) {
|
|
39
|
-
this.#subscriptionCallback(options);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
getBaseUrl() {
|
|
43
|
-
return this.#baseUrl;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
47
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
48
|
-
*/
|
|
49
|
-
subscribeToConfigChange(subscriptionCallback) {
|
|
50
|
-
this.#subscriptionCallback = subscriptionCallback;
|
|
51
|
-
subscriptionCallback(this.#currentConfig);
|
|
52
|
-
}
|
|
53
|
-
unsubscribeToConfigChange() {
|
|
54
|
-
this.#subscriptionCallback = void 0;
|
|
55
|
-
}
|
|
56
|
-
get(url, options) {
|
|
57
|
-
return this.#client.get(url, options);
|
|
58
|
-
}
|
|
59
|
-
post(url, options) {
|
|
60
|
-
return this.#client.post(url, options);
|
|
61
|
-
}
|
|
62
|
-
put(url, options) {
|
|
63
|
-
return this.#client.put(url, options);
|
|
64
|
-
}
|
|
65
|
-
patch(url, options) {
|
|
66
|
-
return this.#client.patch(url, options);
|
|
67
|
-
}
|
|
68
|
-
head(url, options) {
|
|
69
|
-
return this.#client.head(url, options);
|
|
70
|
-
}
|
|
71
|
-
delete(url, options) {
|
|
72
|
-
return this.#client.delete(url, options);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
BASE_URLS,
|
|
78
|
-
envSchema,
|
|
79
|
-
AsstClient
|
|
80
|
-
};
|
package/dist/chunk-N2OYWNHF.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
z
|
|
3
|
-
} from "./chunk-D3ML6E4G.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky-universal";
|
|
7
|
-
var baseUrlsSchema = z.object({
|
|
8
|
-
local: z.literal("https://localhost:8443"),
|
|
9
|
-
test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
|
|
10
|
-
prod: z.literal("https://api.spscommerce.com/assortment/gateway")
|
|
11
|
-
});
|
|
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 envSchema = baseUrlsSchema.keyof();
|
|
18
|
-
var AsstClient = class {
|
|
19
|
-
#client = ky.create({
|
|
20
|
-
prefixUrl: BASE_URLS["test"],
|
|
21
|
-
retry: 0
|
|
22
|
-
});
|
|
23
|
-
#baseUrl = BASE_URLS["test"];
|
|
24
|
-
#subscriptionCallback;
|
|
25
|
-
#currentConfig = {};
|
|
26
|
-
constructor(options) {
|
|
27
|
-
console.log(`AsstClient created! Config: ${options ? JSON.stringify(options) : "default"}`);
|
|
28
|
-
if (options) {
|
|
29
|
-
this.updateConfig(options);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
updateConfig(options) {
|
|
33
|
-
this.#client = this.#client.extend(options);
|
|
34
|
-
this.#currentConfig = options;
|
|
35
|
-
if (options.prefixUrl) {
|
|
36
|
-
this.#baseUrl = options.prefixUrl;
|
|
37
|
-
}
|
|
38
|
-
if (this.#subscriptionCallback) {
|
|
39
|
-
this.#subscriptionCallback(options);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
getBaseUrl() {
|
|
43
|
-
return this.#baseUrl;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
47
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
48
|
-
*/
|
|
49
|
-
subscribeToConfigChange(subscriptionCallback) {
|
|
50
|
-
this.#subscriptionCallback = subscriptionCallback;
|
|
51
|
-
subscriptionCallback(this.#currentConfig);
|
|
52
|
-
}
|
|
53
|
-
unsubscribeToConfigChange() {
|
|
54
|
-
this.#subscriptionCallback = void 0;
|
|
55
|
-
}
|
|
56
|
-
get(url, options) {
|
|
57
|
-
return this.#client.get(url, options);
|
|
58
|
-
}
|
|
59
|
-
post(url, options) {
|
|
60
|
-
return this.#client.post(url, options);
|
|
61
|
-
}
|
|
62
|
-
put(url, options) {
|
|
63
|
-
return this.#client.put(url, options);
|
|
64
|
-
}
|
|
65
|
-
patch(url, options) {
|
|
66
|
-
return this.#client.patch(url, options);
|
|
67
|
-
}
|
|
68
|
-
head(url, options) {
|
|
69
|
-
return this.#client.head(url, options);
|
|
70
|
-
}
|
|
71
|
-
delete(url, options) {
|
|
72
|
-
return this.#client.delete(url, options);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
BASE_URLS,
|
|
78
|
-
envSchema,
|
|
79
|
-
AsstClient
|
|
80
|
-
};
|
package/dist/chunk-OA6PO3QG.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
z
|
|
3
|
-
} from "./chunk-D3ML6E4G.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky-universal";
|
|
7
|
-
var baseUrlsSchema = z.object({
|
|
8
|
-
local: z.literal("https://localhost:8443"),
|
|
9
|
-
test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
|
|
10
|
-
prod: z.literal("https://api.spscommerce.com/assortment/gateway")
|
|
11
|
-
});
|
|
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 envSchema = baseUrlsSchema.keyof();
|
|
18
|
-
var AsstClient = class {
|
|
19
|
-
#client = ky.create({
|
|
20
|
-
prefixUrl: BASE_URLS["test"],
|
|
21
|
-
retry: 0
|
|
22
|
-
});
|
|
23
|
-
#baseUrl = BASE_URLS["test"];
|
|
24
|
-
#subscriptionCallback;
|
|
25
|
-
#currentConfig = {};
|
|
26
|
-
constructor(options) {
|
|
27
|
-
console.log(`AsstClient created`);
|
|
28
|
-
this.updateConfig(options);
|
|
29
|
-
}
|
|
30
|
-
updateConfig(options) {
|
|
31
|
-
this.#client = this.#client.extend(options);
|
|
32
|
-
this.#currentConfig = options;
|
|
33
|
-
if (options.prefixUrl) {
|
|
34
|
-
this.#baseUrl = options.prefixUrl;
|
|
35
|
-
}
|
|
36
|
-
if (this.#subscriptionCallback) {
|
|
37
|
-
this.#subscriptionCallback(options);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
getBaseUrl() {
|
|
41
|
-
return this.#baseUrl;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
45
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
46
|
-
*/
|
|
47
|
-
subscribeToConfigChange(subscriptionCallback) {
|
|
48
|
-
this.#subscriptionCallback = subscriptionCallback;
|
|
49
|
-
subscriptionCallback(this.#currentConfig);
|
|
50
|
-
}
|
|
51
|
-
unsubscribeToConfigChange() {
|
|
52
|
-
this.#subscriptionCallback = void 0;
|
|
53
|
-
}
|
|
54
|
-
get(url, options) {
|
|
55
|
-
return this.#client.get(url, options);
|
|
56
|
-
}
|
|
57
|
-
post(url, options) {
|
|
58
|
-
return this.#client.post(url, options);
|
|
59
|
-
}
|
|
60
|
-
put(url, options) {
|
|
61
|
-
return this.#client.put(url, options);
|
|
62
|
-
}
|
|
63
|
-
patch(url, options) {
|
|
64
|
-
return this.#client.patch(url, options);
|
|
65
|
-
}
|
|
66
|
-
head(url, options) {
|
|
67
|
-
return this.#client.head(url, options);
|
|
68
|
-
}
|
|
69
|
-
delete(url, options) {
|
|
70
|
-
return this.#client.delete(url, options);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
BASE_URLS,
|
|
76
|
-
envSchema,
|
|
77
|
-
AsstClient
|
|
78
|
-
};
|