@wix/auto_sdk_stores_inventory 1.0.39 → 1.0.41

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 (37) hide show
  1. package/build/cjs/index.d.ts +22 -22
  2. package/build/cjs/index.js +171 -171
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +202 -202
  5. package/build/cjs/index.typings.js +154 -154
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +183 -183
  8. package/build/cjs/meta.js +140 -140
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +22 -22
  11. package/build/es/index.mjs +171 -171
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +202 -202
  14. package/build/es/index.typings.mjs +154 -154
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +183 -183
  17. package/build/es/meta.mjs +140 -140
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +22 -22
  20. package/build/internal/cjs/index.js +171 -171
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +235 -235
  23. package/build/internal/cjs/index.typings.js +154 -154
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +183 -183
  26. package/build/internal/cjs/meta.js +140 -140
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +22 -22
  29. package/build/internal/es/index.mjs +171 -171
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +235 -235
  32. package/build/internal/es/index.typings.mjs +154 -154
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +183 -183
  35. package/build/internal/es/meta.mjs +140 -140
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -17,67 +17,6 @@ import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transform
17
17
  import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
18
18
  import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
19
19
  import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
20
- function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
21
- const domainToMappings = {
22
- "api._api_base_domain_": [
23
- {
24
- srcPath: "/wix-ecommerce-catalog-reader-web",
25
- destPath: ""
26
- }
27
- ],
28
- "manage._base_domain_": [
29
- {
30
- srcPath: "/wix-ecommerce-catalog-reader-web",
31
- destPath: ""
32
- }
33
- ],
34
- "www.wixapis.com": [
35
- {
36
- srcPath: "/stores-reader/v2/collections",
37
- destPath: "/v2/collections"
38
- },
39
- {
40
- srcPath: "/stores-reader/v2/inventoryItems",
41
- destPath: "/v2/inventoryItems"
42
- }
43
- ],
44
- "www._base_domain_": [
45
- {
46
- srcPath: "/wix-ecommerce-catalog-reader-web",
47
- destPath: ""
48
- }
49
- ],
50
- "editor._base_domain_": [
51
- {
52
- srcPath: "/_api/wix-ecommerce-catalog-reader-web",
53
- destPath: ""
54
- }
55
- ],
56
- "blocks._base_domain_": [
57
- {
58
- srcPath: "/_api/wix-ecommerce-catalog-reader-web",
59
- destPath: ""
60
- }
61
- ],
62
- "create.editorx": [
63
- {
64
- srcPath: "/_api/wix-ecommerce-catalog-reader-web",
65
- destPath: ""
66
- }
67
- ],
68
- _: [
69
- {
70
- srcPath: "/stores-reader/v2/inventoryItems",
71
- destPath: "/v2/inventoryItems"
72
- },
73
- {
74
- srcPath: "/stores-reader/v2/collections",
75
- destPath: "/v2/collections"
76
- }
77
- ]
78
- };
79
- return resolveUrl(Object.assign(opts, { domainToMappings }));
80
- }
81
20
  function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
82
21
  const domainToMappings = {
83
22
  "api._api_base_domain_": [
@@ -161,7 +100,122 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
161
100
  };
162
101
  return resolveUrl(Object.assign(opts, { domainToMappings }));
163
102
  }
103
+ function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
104
+ const domainToMappings = {
105
+ "api._api_base_domain_": [
106
+ {
107
+ srcPath: "/wix-ecommerce-catalog-reader-web",
108
+ destPath: ""
109
+ }
110
+ ],
111
+ "manage._base_domain_": [
112
+ {
113
+ srcPath: "/wix-ecommerce-catalog-reader-web",
114
+ destPath: ""
115
+ }
116
+ ],
117
+ "www.wixapis.com": [
118
+ {
119
+ srcPath: "/stores-reader/v2/collections",
120
+ destPath: "/v2/collections"
121
+ },
122
+ {
123
+ srcPath: "/stores-reader/v2/inventoryItems",
124
+ destPath: "/v2/inventoryItems"
125
+ }
126
+ ],
127
+ "www._base_domain_": [
128
+ {
129
+ srcPath: "/wix-ecommerce-catalog-reader-web",
130
+ destPath: ""
131
+ }
132
+ ],
133
+ "editor._base_domain_": [
134
+ {
135
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
136
+ destPath: ""
137
+ }
138
+ ],
139
+ "blocks._base_domain_": [
140
+ {
141
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
142
+ destPath: ""
143
+ }
144
+ ],
145
+ "create.editorx": [
146
+ {
147
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
148
+ destPath: ""
149
+ }
150
+ ],
151
+ _: [
152
+ {
153
+ srcPath: "/stores-reader/v2/inventoryItems",
154
+ destPath: "/v2/inventoryItems"
155
+ },
156
+ {
157
+ srcPath: "/stores-reader/v2/collections",
158
+ destPath: "/v2/collections"
159
+ }
160
+ ]
161
+ };
162
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
163
+ }
164
164
  var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
165
+ function getInventoryVariants(payload) {
166
+ function __getInventoryVariants({ host }) {
167
+ const metadata = {
168
+ entityFqdn: "wix.stores.v2.inventory",
169
+ method: "POST",
170
+ methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
171
+ packageName: PACKAGE_NAME,
172
+ migrationOptions: {
173
+ optInTransformResponse: true
174
+ },
175
+ url: resolveWixInventoryApiV1InventoryReadApiUrl({
176
+ protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
177
+ data: payload,
178
+ host
179
+ }),
180
+ data: payload,
181
+ transformResponse: (payload2) => transformPaths(payload2, [
182
+ {
183
+ transformFn: transformRESTTimestampToSDKTimestamp,
184
+ paths: [{ path: "inventoryItem.lastUpdated" }]
185
+ }
186
+ ])
187
+ };
188
+ return metadata;
189
+ }
190
+ return __getInventoryVariants;
191
+ }
192
+ function queryInventory(payload) {
193
+ function __queryInventory({ host }) {
194
+ const metadata = {
195
+ entityFqdn: "wix.stores.v2.inventory",
196
+ method: "POST",
197
+ methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
198
+ packageName: PACKAGE_NAME,
199
+ migrationOptions: {
200
+ optInTransformResponse: true
201
+ },
202
+ url: resolveWixInventoryApiV1InventoryReadApiUrl({
203
+ protoPath: "/v2/inventoryItems/query",
204
+ data: payload,
205
+ host
206
+ }),
207
+ data: payload,
208
+ transformResponse: (payload2) => transformPaths(payload2, [
209
+ {
210
+ transformFn: transformRESTTimestampToSDKTimestamp,
211
+ paths: [{ path: "inventoryItems.lastUpdated" }]
212
+ }
213
+ ])
214
+ };
215
+ return metadata;
216
+ }
217
+ return __queryInventory;
218
+ }
165
219
  function updateInventoryVariants(payload) {
166
220
  function __updateInventoryVariants({ host }) {
167
221
  const serializedData = transformPaths(payload, [
@@ -231,60 +285,6 @@ function incrementInventory(payload) {
231
285
  }
232
286
  return __incrementInventory;
233
287
  }
234
- function getInventoryVariants(payload) {
235
- function __getInventoryVariants({ host }) {
236
- const metadata = {
237
- entityFqdn: "wix.stores.v2.inventory",
238
- method: "POST",
239
- methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
240
- packageName: PACKAGE_NAME,
241
- migrationOptions: {
242
- optInTransformResponse: true
243
- },
244
- url: resolveWixInventoryApiV1InventoryReadApiUrl({
245
- protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
246
- data: payload,
247
- host
248
- }),
249
- data: payload,
250
- transformResponse: (payload2) => transformPaths(payload2, [
251
- {
252
- transformFn: transformRESTTimestampToSDKTimestamp,
253
- paths: [{ path: "inventoryItem.lastUpdated" }]
254
- }
255
- ])
256
- };
257
- return metadata;
258
- }
259
- return __getInventoryVariants;
260
- }
261
- function queryInventory(payload) {
262
- function __queryInventory({ host }) {
263
- const metadata = {
264
- entityFqdn: "wix.stores.v2.inventory",
265
- method: "POST",
266
- methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
267
- packageName: PACKAGE_NAME,
268
- migrationOptions: {
269
- optInTransformResponse: true
270
- },
271
- url: resolveWixInventoryApiV1InventoryReadApiUrl({
272
- protoPath: "/v2/inventoryItems/query",
273
- data: payload,
274
- host
275
- }),
276
- data: payload,
277
- transformResponse: (payload2) => transformPaths(payload2, [
278
- {
279
- transformFn: transformRESTTimestampToSDKTimestamp,
280
- paths: [{ path: "inventoryItems.lastUpdated" }]
281
- }
282
- ])
283
- };
284
- return metadata;
285
- }
286
- return __queryInventory;
287
- }
288
288
 
289
289
  // src/stores-v2-inventory-inventory.universal.ts
290
290
  var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
@@ -302,60 +302,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
302
302
  WebhookIdentityType2["APP"] = "APP";
303
303
  return WebhookIdentityType2;
304
304
  })(WebhookIdentityType || {});
305
- async function updateInventoryVariants2(productId, inventoryItem) {
305
+ async function getInventoryVariants2(inventoryId, options) {
306
306
  const { httpClient, sideEffects } = arguments[2];
307
307
  const payload = renameKeysFromSDKRequestToRESTRequest({
308
- inventoryItem: { ...inventoryItem, productId }
308
+ inventoryId,
309
+ externalId: options?.externalId,
310
+ productId: options?.productId,
311
+ variantIds: options?.variantIds
309
312
  });
310
- const reqOpts = updateInventoryVariants(payload);
313
+ const reqOpts = getInventoryVariants(payload);
311
314
  sideEffects?.onSiteCall?.();
312
315
  try {
313
316
  const result = await httpClient.request(reqOpts);
314
317
  sideEffects?.onSuccess?.(result);
318
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
315
319
  } catch (err) {
316
320
  const transformedError = sdkTransformError(
317
321
  err,
318
322
  {
319
- spreadPathsToArguments: { inventoryItem: "$[1]" },
320
- explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
323
+ spreadPathsToArguments: {},
324
+ explicitPathsToArguments: {
325
+ inventoryId: "$[0]",
326
+ externalId: "$[1].externalId",
327
+ productId: "$[1].productId",
328
+ variantIds: "$[1].variantIds"
329
+ },
321
330
  singleArgumentUnchanged: false
322
331
  },
323
- ["productId", "inventoryItem"]
332
+ ["inventoryId", "options"]
324
333
  );
325
334
  sideEffects?.onError?.(err);
326
335
  throw transformedError;
327
336
  }
328
337
  }
329
- async function decrementInventory2(decrementData) {
338
+ async function queryInventory2(options) {
330
339
  const { httpClient, sideEffects } = arguments[1];
331
340
  const payload = renameKeysFromSDKRequestToRESTRequest({
332
- decrementData
341
+ query: options?.query
333
342
  });
334
- const reqOpts = decrementInventory(payload);
343
+ const reqOpts = queryInventory(payload);
335
344
  sideEffects?.onSiteCall?.();
336
345
  try {
337
346
  const result = await httpClient.request(reqOpts);
338
347
  sideEffects?.onSuccess?.(result);
348
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
339
349
  } catch (err) {
340
350
  const transformedError = sdkTransformError(
341
351
  err,
342
352
  {
343
353
  spreadPathsToArguments: {},
344
- explicitPathsToArguments: { decrementData: "$[0]" },
354
+ explicitPathsToArguments: { query: "$[0].query" },
345
355
  singleArgumentUnchanged: false
346
356
  },
347
- ["decrementData"]
357
+ ["options"]
348
358
  );
349
359
  sideEffects?.onError?.(err);
350
360
  throw transformedError;
351
361
  }
352
362
  }
353
- async function incrementInventory2(incrementData) {
354
- const { httpClient, sideEffects } = arguments[1];
363
+ async function updateInventoryVariants2(productId, inventoryItem) {
364
+ const { httpClient, sideEffects } = arguments[2];
355
365
  const payload = renameKeysFromSDKRequestToRESTRequest({
356
- incrementData
366
+ inventoryItem: { ...inventoryItem, productId }
357
367
  });
358
- const reqOpts = incrementInventory(payload);
368
+ const reqOpts = updateInventoryVariants(payload);
359
369
  sideEffects?.onSiteCall?.();
360
370
  try {
361
371
  const result = await httpClient.request(reqOpts);
@@ -364,69 +374,59 @@ async function incrementInventory2(incrementData) {
364
374
  const transformedError = sdkTransformError(
365
375
  err,
366
376
  {
367
- spreadPathsToArguments: {},
368
- explicitPathsToArguments: { incrementData: "$[0]" },
377
+ spreadPathsToArguments: { inventoryItem: "$[1]" },
378
+ explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
369
379
  singleArgumentUnchanged: false
370
380
  },
371
- ["incrementData"]
381
+ ["productId", "inventoryItem"]
372
382
  );
373
383
  sideEffects?.onError?.(err);
374
384
  throw transformedError;
375
385
  }
376
386
  }
377
- async function getInventoryVariants2(inventoryId, options) {
378
- const { httpClient, sideEffects } = arguments[2];
387
+ async function decrementInventory2(decrementData) {
388
+ const { httpClient, sideEffects } = arguments[1];
379
389
  const payload = renameKeysFromSDKRequestToRESTRequest({
380
- inventoryId,
381
- externalId: options?.externalId,
382
- productId: options?.productId,
383
- variantIds: options?.variantIds
390
+ decrementData
384
391
  });
385
- const reqOpts = getInventoryVariants(payload);
392
+ const reqOpts = decrementInventory(payload);
386
393
  sideEffects?.onSiteCall?.();
387
394
  try {
388
395
  const result = await httpClient.request(reqOpts);
389
396
  sideEffects?.onSuccess?.(result);
390
- return renameKeysFromRESTResponseToSDKResponse(result.data);
391
397
  } catch (err) {
392
398
  const transformedError = sdkTransformError(
393
399
  err,
394
400
  {
395
401
  spreadPathsToArguments: {},
396
- explicitPathsToArguments: {
397
- inventoryId: "$[0]",
398
- externalId: "$[1].externalId",
399
- productId: "$[1].productId",
400
- variantIds: "$[1].variantIds"
401
- },
402
+ explicitPathsToArguments: { decrementData: "$[0]" },
402
403
  singleArgumentUnchanged: false
403
404
  },
404
- ["inventoryId", "options"]
405
+ ["decrementData"]
405
406
  );
406
407
  sideEffects?.onError?.(err);
407
408
  throw transformedError;
408
409
  }
409
410
  }
410
- async function queryInventory2(options) {
411
+ async function incrementInventory2(incrementData) {
411
412
  const { httpClient, sideEffects } = arguments[1];
412
413
  const payload = renameKeysFromSDKRequestToRESTRequest({
413
- query: options?.query
414
+ incrementData
414
415
  });
415
- const reqOpts = queryInventory(payload);
416
+ const reqOpts = incrementInventory(payload);
416
417
  sideEffects?.onSiteCall?.();
417
418
  try {
418
419
  const result = await httpClient.request(reqOpts);
419
420
  sideEffects?.onSuccess?.(result);
420
- return renameKeysFromRESTResponseToSDKResponse(result.data);
421
421
  } catch (err) {
422
422
  const transformedError = sdkTransformError(
423
423
  err,
424
424
  {
425
425
  spreadPathsToArguments: {},
426
- explicitPathsToArguments: { query: "$[0].query" },
426
+ explicitPathsToArguments: { incrementData: "$[0]" },
427
427
  singleArgumentUnchanged: false
428
428
  },
429
- ["options"]
429
+ ["incrementData"]
430
430
  );
431
431
  sideEffects?.onError?.(err);
432
432
  throw transformedError;
@@ -434,6 +434,21 @@ async function queryInventory2(options) {
434
434
  }
435
435
 
436
436
  // src/stores-v2-inventory-inventory.public.ts
437
+ function getInventoryVariants3(httpClient) {
438
+ return (inventoryId, options) => getInventoryVariants2(
439
+ inventoryId,
440
+ options,
441
+ // @ts-ignore
442
+ { httpClient }
443
+ );
444
+ }
445
+ function queryInventory3(httpClient) {
446
+ return (options) => queryInventory2(
447
+ options,
448
+ // @ts-ignore
449
+ { httpClient }
450
+ );
451
+ }
437
452
  function updateInventoryVariants3(httpClient) {
438
453
  return (productId, inventoryItem) => updateInventoryVariants2(
439
454
  productId,
@@ -456,21 +471,6 @@ function incrementInventory3(httpClient) {
456
471
  { httpClient }
457
472
  );
458
473
  }
459
- function getInventoryVariants3(httpClient) {
460
- return (inventoryId, options) => getInventoryVariants2(
461
- inventoryId,
462
- options,
463
- // @ts-ignore
464
- { httpClient }
465
- );
466
- }
467
- function queryInventory3(httpClient) {
468
- return (options) => queryInventory2(
469
- options,
470
- // @ts-ignore
471
- { httpClient }
472
- );
473
- }
474
474
  var onInventoryItemChanged = EventDefinition(
475
475
  "com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
476
476
  false,
@@ -503,11 +503,11 @@ var onInventoryVariantsChanged = EventDefinition(
503
503
  // src/stores-v2-inventory-inventory.context.ts
504
504
  import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
505
505
  import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
506
+ var getInventoryVariants4 = /* @__PURE__ */ createRESTModule(getInventoryVariants3);
507
+ var queryInventory4 = /* @__PURE__ */ createRESTModule(queryInventory3);
506
508
  var updateInventoryVariants4 = /* @__PURE__ */ createRESTModule(updateInventoryVariants3);
507
509
  var decrementInventory4 = /* @__PURE__ */ createRESTModule(decrementInventory3);
508
510
  var incrementInventory4 = /* @__PURE__ */ createRESTModule(incrementInventory3);
509
- var getInventoryVariants4 = /* @__PURE__ */ createRESTModule(getInventoryVariants3);
510
- var queryInventory4 = /* @__PURE__ */ createRESTModule(queryInventory3);
511
511
  var onInventoryItemChanged2 = createEventModule(
512
512
  onInventoryItemChanged
513
513
  );