@wix/auto_sdk_stores_inventory 1.0.37 → 1.0.39

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 +206 -189
  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 +187 -170
  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 +206 -189
  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 +187 -170
  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 +239 -222
  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 +187 -170
  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 +239 -222
  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 +187 -170
  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,6 +17,67 @@ 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
+ }
20
81
  function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
21
82
  const domainToMappings = {
22
83
  "api._api_base_domain_": [
@@ -100,122 +161,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
100
161
  };
101
162
  return resolveUrl(Object.assign(opts, { domainToMappings }));
102
163
  }
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
- }
219
165
  function updateInventoryVariants(payload) {
220
166
  function __updateInventoryVariants({ host }) {
221
167
  const serializedData = transformPaths(payload, [
@@ -285,6 +231,60 @@ function incrementInventory(payload) {
285
231
  }
286
232
  return __incrementInventory;
287
233
  }
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,70 +302,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
302
302
  WebhookIdentityType2["APP"] = "APP";
303
303
  return WebhookIdentityType2;
304
304
  })(WebhookIdentityType || {});
305
- async function getInventoryVariants2(inventoryId, options) {
305
+ async function updateInventoryVariants2(productId, inventoryItem) {
306
306
  const { httpClient, sideEffects } = arguments[2];
307
307
  const payload = renameKeysFromSDKRequestToRESTRequest({
308
- inventoryId,
309
- externalId: options?.externalId,
310
- productId: options?.productId,
311
- variantIds: options?.variantIds
308
+ inventoryItem: { ...inventoryItem, productId }
312
309
  });
313
- const reqOpts = getInventoryVariants(payload);
310
+ const reqOpts = updateInventoryVariants(payload);
314
311
  sideEffects?.onSiteCall?.();
315
312
  try {
316
313
  const result = await httpClient.request(reqOpts);
317
314
  sideEffects?.onSuccess?.(result);
318
- return renameKeysFromRESTResponseToSDKResponse(result.data);
319
315
  } catch (err) {
320
316
  const transformedError = sdkTransformError(
321
317
  err,
322
318
  {
323
- spreadPathsToArguments: {},
324
- explicitPathsToArguments: {
325
- inventoryId: "$[0]",
326
- externalId: "$[1].externalId",
327
- productId: "$[1].productId",
328
- variantIds: "$[1].variantIds"
329
- },
319
+ spreadPathsToArguments: { inventoryItem: "$[1]" },
320
+ explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
330
321
  singleArgumentUnchanged: false
331
322
  },
332
- ["inventoryId", "options"]
323
+ ["productId", "inventoryItem"]
333
324
  );
334
325
  sideEffects?.onError?.(err);
335
326
  throw transformedError;
336
327
  }
337
328
  }
338
- async function queryInventory2(options) {
329
+ async function decrementInventory2(decrementData) {
339
330
  const { httpClient, sideEffects } = arguments[1];
340
331
  const payload = renameKeysFromSDKRequestToRESTRequest({
341
- query: options?.query
332
+ decrementData
342
333
  });
343
- const reqOpts = queryInventory(payload);
334
+ const reqOpts = decrementInventory(payload);
344
335
  sideEffects?.onSiteCall?.();
345
336
  try {
346
337
  const result = await httpClient.request(reqOpts);
347
338
  sideEffects?.onSuccess?.(result);
348
- return renameKeysFromRESTResponseToSDKResponse(result.data);
349
339
  } catch (err) {
350
340
  const transformedError = sdkTransformError(
351
341
  err,
352
342
  {
353
343
  spreadPathsToArguments: {},
354
- explicitPathsToArguments: { query: "$[0].query" },
344
+ explicitPathsToArguments: { decrementData: "$[0]" },
355
345
  singleArgumentUnchanged: false
356
346
  },
357
- ["options"]
347
+ ["decrementData"]
358
348
  );
359
349
  sideEffects?.onError?.(err);
360
350
  throw transformedError;
361
351
  }
362
352
  }
363
- async function updateInventoryVariants2(productId, inventoryItem) {
364
- const { httpClient, sideEffects } = arguments[2];
353
+ async function incrementInventory2(incrementData) {
354
+ const { httpClient, sideEffects } = arguments[1];
365
355
  const payload = renameKeysFromSDKRequestToRESTRequest({
366
- inventoryItem: { ...inventoryItem, productId }
356
+ incrementData
367
357
  });
368
- const reqOpts = updateInventoryVariants(payload);
358
+ const reqOpts = incrementInventory(payload);
369
359
  sideEffects?.onSiteCall?.();
370
360
  try {
371
361
  const result = await httpClient.request(reqOpts);
@@ -374,59 +364,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
374
364
  const transformedError = sdkTransformError(
375
365
  err,
376
366
  {
377
- spreadPathsToArguments: { inventoryItem: "$[1]" },
378
- explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
367
+ spreadPathsToArguments: {},
368
+ explicitPathsToArguments: { incrementData: "$[0]" },
379
369
  singleArgumentUnchanged: false
380
370
  },
381
- ["productId", "inventoryItem"]
371
+ ["incrementData"]
382
372
  );
383
373
  sideEffects?.onError?.(err);
384
374
  throw transformedError;
385
375
  }
386
376
  }
387
- async function decrementInventory2(decrementData) {
388
- const { httpClient, sideEffects } = arguments[1];
377
+ async function getInventoryVariants2(inventoryId, options) {
378
+ const { httpClient, sideEffects } = arguments[2];
389
379
  const payload = renameKeysFromSDKRequestToRESTRequest({
390
- decrementData
380
+ inventoryId,
381
+ externalId: options?.externalId,
382
+ productId: options?.productId,
383
+ variantIds: options?.variantIds
391
384
  });
392
- const reqOpts = decrementInventory(payload);
385
+ const reqOpts = getInventoryVariants(payload);
393
386
  sideEffects?.onSiteCall?.();
394
387
  try {
395
388
  const result = await httpClient.request(reqOpts);
396
389
  sideEffects?.onSuccess?.(result);
390
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
397
391
  } catch (err) {
398
392
  const transformedError = sdkTransformError(
399
393
  err,
400
394
  {
401
395
  spreadPathsToArguments: {},
402
- explicitPathsToArguments: { decrementData: "$[0]" },
396
+ explicitPathsToArguments: {
397
+ inventoryId: "$[0]",
398
+ externalId: "$[1].externalId",
399
+ productId: "$[1].productId",
400
+ variantIds: "$[1].variantIds"
401
+ },
403
402
  singleArgumentUnchanged: false
404
403
  },
405
- ["decrementData"]
404
+ ["inventoryId", "options"]
406
405
  );
407
406
  sideEffects?.onError?.(err);
408
407
  throw transformedError;
409
408
  }
410
409
  }
411
- async function incrementInventory2(incrementData) {
410
+ async function queryInventory2(options) {
412
411
  const { httpClient, sideEffects } = arguments[1];
413
412
  const payload = renameKeysFromSDKRequestToRESTRequest({
414
- incrementData
413
+ query: options?.query
415
414
  });
416
- const reqOpts = incrementInventory(payload);
415
+ const reqOpts = queryInventory(payload);
417
416
  sideEffects?.onSiteCall?.();
418
417
  try {
419
418
  const result = await httpClient.request(reqOpts);
420
419
  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: { incrementData: "$[0]" },
426
+ explicitPathsToArguments: { query: "$[0].query" },
427
427
  singleArgumentUnchanged: false
428
428
  },
429
- ["incrementData"]
429
+ ["options"]
430
430
  );
431
431
  sideEffects?.onError?.(err);
432
432
  throw transformedError;
@@ -434,21 +434,6 @@ async function incrementInventory2(incrementData) {
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
- }
452
437
  function updateInventoryVariants3(httpClient) {
453
438
  return (productId, inventoryItem) => updateInventoryVariants2(
454
439
  productId,
@@ -471,6 +456,21 @@ function incrementInventory3(httpClient) {
471
456
  { httpClient }
472
457
  );
473
458
  }
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);
508
506
  var updateInventoryVariants4 = /* @__PURE__ */ createRESTModule(updateInventoryVariants3);
509
507
  var decrementInventory4 = /* @__PURE__ */ createRESTModule(decrementInventory3);
510
508
  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
  );