@wix/auto_sdk_stores_inventory 1.0.14 → 1.0.16

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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  interface InventoryItemV2 {
2
4
  /** Inventory item ID. */
3
5
  _id?: string | null;
@@ -75,6 +77,8 @@ declare enum ReasonType {
75
77
  /** Reverting an inventory change. */
76
78
  REVERT_INVENTORY_CHANGE = "REVERT_INVENTORY_CHANGE"
77
79
  }
80
+ /** @enumType */
81
+ type ReasonTypeWithLiterals = ReasonType | 'UNKNOWN' | 'ORDER' | 'MANUAL' | 'REVERT_INVENTORY_CHANGE';
78
82
  interface UpdateInventoryVariantsResponse {
79
83
  }
80
84
  interface BulkUpdateInventoryVariantsRequest extends BulkUpdateInventoryVariantsRequestActionOneOf {
@@ -460,10 +464,64 @@ interface InventoryItemChangedEnvelope {
460
464
  data: InventoryItemChanged;
461
465
  metadata: BaseEventMetadata;
462
466
  }
467
+ /**
468
+ * Triggered when an inventory item is changed.
469
+ * @permissionScope Manage Stores - all permissions
470
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
471
+ * @permissionScope Manage Stores
472
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
473
+ * @permissionScope Manage Products
474
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
475
+ * @permissionScope Read Stores - all read permissions
476
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
477
+ * @permissionScope Read Products
478
+ * @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
479
+ * @permissionId WIX_STORES.READ_INVENTORY
480
+ * @webhook
481
+ * @eventType com.wix.ecommerce.inventory.api.v1.InventoryItemChanged
482
+ * @serviceIdentifier wix.inventory.api.v1.InventoryReadApi
483
+ * @slug inventory_item_changed
484
+ */
485
+ declare function onInventoryItemChanged(handler: (event: InventoryItemChangedEnvelope) => void | Promise<void>): void;
463
486
  interface InventoryVariantsChangedEnvelope {
464
487
  data: InventoryVariantsChanged;
465
488
  metadata: BaseEventMetadata;
466
489
  }
490
+ /**
491
+ * Triggered when inventory variants are changed.
492
+ * @permissionScope Manage Stores - all permissions
493
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
494
+ * @permissionScope Manage Stores
495
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
496
+ * @permissionScope Manage Products
497
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
498
+ * @permissionScope Read Stores - all read permissions
499
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
500
+ * @permissionScope Read Products
501
+ * @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
502
+ * @permissionId WIX_STORES.READ_INVENTORY
503
+ * @webhook
504
+ * @eventType com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged
505
+ * @serviceIdentifier wix.inventory.api.v1.InventoryReadApi
506
+ * @slug inventory_variants_changed
507
+ */
508
+ declare function onInventoryVariantsChanged(handler: (event: InventoryVariantsChangedEnvelope) => void | Promise<void>): void;
509
+ type InventoryNonNullablePaths = `variants` | `variants.${number}.variantId` | `variants.${number}.availableForPreorder` | `numericId` | `preorderInfo.enabled`;
510
+ /**
511
+ * Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.
512
+ *
513
+ *
514
+ * The `updateInventoryVariants()` function is a Promise that resolves to the updated inventory variant data.
515
+ * @param productId - Product ID.
516
+ * @public
517
+ * @requiredField inventoryItem
518
+ * @requiredField productId
519
+ * @param inventoryItem - Inventory item to update.
520
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
521
+ * @applicableIdentity APP
522
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.UpdateInventoryVariants
523
+ */
524
+ declare function updateInventoryVariants(productId: string, inventoryItem: UpdateInventoryVariantsInventoryItem): Promise<void>;
467
525
  interface UpdateInventoryVariantsInventoryItem {
468
526
  /** Inventory item ID. */
469
527
  _id?: string | null;
@@ -494,6 +552,48 @@ interface UpdateInventoryVariantsInventoryItem {
494
552
  /** Preorder information. */
495
553
  preorderInfo?: PreorderInfo;
496
554
  }
555
+ /**
556
+ * Subtracts a set number of items from inventory.
557
+ *
558
+ *
559
+ * The `decrementInventory()` function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.
560
+ * @param decrementData - Item or product to decrement.
561
+ * @public
562
+ * @requiredField decrementData
563
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
564
+ * @applicableIdentity APP
565
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.DecrementInventory
566
+ */
567
+ declare function decrementInventory(decrementData: DecrementData[]): Promise<void>;
568
+ /**
569
+ * Adds a set number of items to inventory.
570
+ *
571
+ *
572
+ * The `incrementInventory()` function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.
573
+ * @param incrementData - Item or product to increment.
574
+ * @public
575
+ * @requiredField incrementData
576
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
577
+ * @applicableIdentity APP
578
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.IncrementInventory
579
+ */
580
+ declare function incrementInventory(incrementData: IncrementData[]): Promise<void>;
581
+ /**
582
+ * Gets inventory variant information based on the specified option choices.
583
+ *
584
+ *
585
+ * The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
586
+ * @param inventoryId - Inventory item ID.
587
+ * @public
588
+ * @requiredField inventoryId
589
+ * @permissionId WIX_STORES.READ_INVENTORY
590
+ * @applicableIdentity APP
591
+ * @applicableIdentity VISITOR
592
+ * @fqn wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants
593
+ */
594
+ declare function getInventoryVariants(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, {
595
+ [P in InventoryNonNullablePaths]: `inventoryItem.${P}`;
596
+ }[InventoryNonNullablePaths]>>;
497
597
  interface GetInventoryVariantsOptions extends GetInventoryVariantsOptionsIdOneOf {
498
598
  /**
499
599
  * @internal
@@ -522,9 +622,20 @@ interface GetInventoryVariantsOptionsIdOneOf {
522
622
  /** Product ID. */
523
623
  productId?: string;
524
624
  }
625
+ /**
626
+ * Returns a list of inventory items, given the provided paging, sorting and filtering.
627
+ * @public
628
+ * @permissionId WIX_STORES.READ_INVENTORY
629
+ * @applicableIdentity APP
630
+ * @applicableIdentity VISITOR
631
+ * @fqn wix.inventory.api.v1.InventoryReadApi.QueryInventory
632
+ */
633
+ declare function queryInventory(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, {
634
+ [P in InventoryNonNullablePaths]: `inventoryItems.${number}.${P}`;
635
+ }[InventoryNonNullablePaths] | `metadata.items` | `metadata.offset` | `totalResults`>>;
525
636
  interface QueryInventoryOptions {
526
637
  /** Information about paging, filters, sorting. */
527
638
  query?: Query;
528
639
  }
529
640
 
530
- export { type Query as A, type BulkUpdateInventoryVariantsRequest as B, type ChangedInventoryVariant as C, type DecrementData as D, type Paging as E, type PagingMetadata as F, type GetInventoryVariantsOptions as G, type IdentificationData as H, type IncrementData as I, type IdentificationDataIdOneOf as J, type BaseEventMetadata as K, type GetInventoryVariantsOptionsIdOneOf as L, type MessageEnvelope as M, type PreorderInfo as P, type QueryInventoryOptions as Q, ReasonType as R, type UpdateInventoryVariantsInventoryItem as U, WebhookIdentityType as W, type GetInventoryVariantsResponse as a, type QueryInventoryResponse as b, type InventoryItemChangedEnvelope as c, type InventoryVariantsChangedEnvelope as d, type InventoryItemV2 as e, type InventoryVariantV2 as f, type UpdateInventoryVariantsRequest as g, type UpdateInventoryVariantsResponse as h, type BulkUpdateInventoryVariantsRequestActionOneOf as i, type BulkUpdateInventoryVariantsResponse as j, type BulkUpdateInventoryItemsRequest as k, type BulkUpdateInventoryItemsResponse as l, type DecrementInventoryRequest as m, type DecrementDataIdOneOf as n, type DecrementInventoryResponse as o, type IncrementInventoryRequest as p, type IncrementDataIdOneOf as q, type IncrementInventoryResponse as r, type InventoryItemChanged as s, type InventoryVariantsChanged as t, type ChangedInventoryVariantData as u, type GetInventoryVariantsRequest as v, type GetInventoryVariantsRequestIdOneOf as w, type GetInventoryItemsRequest as x, type GetInventoryItemsResponse as y, type QueryInventoryRequest as z };
641
+ export { type BaseEventMetadata, type BulkUpdateInventoryItemsRequest, type BulkUpdateInventoryItemsResponse, type BulkUpdateInventoryVariantsRequest, type BulkUpdateInventoryVariantsRequestActionOneOf, type BulkUpdateInventoryVariantsResponse, type ChangedInventoryVariant, type ChangedInventoryVariantData, type DecrementData, type DecrementDataIdOneOf, type DecrementInventoryRequest, type DecrementInventoryResponse, type GetInventoryItemsRequest, type GetInventoryItemsResponse, type GetInventoryVariantsOptions, type GetInventoryVariantsOptionsIdOneOf, type GetInventoryVariantsRequest, type GetInventoryVariantsRequestIdOneOf, type GetInventoryVariantsResponse, type IdentificationData, type IdentificationDataIdOneOf, type IncrementData, type IncrementDataIdOneOf, type IncrementInventoryRequest, type IncrementInventoryResponse, type InventoryItemChanged, type InventoryItemChangedEnvelope, type InventoryItemV2, type InventoryVariantV2, type InventoryVariantsChanged, type InventoryVariantsChangedEnvelope, type MessageEnvelope, type Paging, type PagingMetadata, type PreorderInfo, type Query, type QueryInventoryOptions, type QueryInventoryRequest, type QueryInventoryResponse, ReasonType, type ReasonTypeWithLiterals, type UpdateInventoryVariantsInventoryItem, type UpdateInventoryVariantsRequest, type UpdateInventoryVariantsResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, decrementInventory, getInventoryVariants, incrementInventory, onInventoryItemChanged, onInventoryVariantsChanged, queryInventory, updateInventoryVariants };
@@ -0,0 +1,452 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ ReasonType: () => ReasonType,
24
+ WebhookIdentityType: () => WebhookIdentityType,
25
+ decrementInventory: () => decrementInventory2,
26
+ getInventoryVariants: () => getInventoryVariants2,
27
+ incrementInventory: () => incrementInventory2,
28
+ queryInventory: () => queryInventory2,
29
+ updateInventoryVariants: () => updateInventoryVariants2
30
+ });
31
+ module.exports = __toCommonJS(index_typings_exports);
32
+
33
+ // src/stores-v2-inventory-inventory.universal.ts
34
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
35
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
36
+
37
+ // src/stores-v2-inventory-inventory.http.ts
38
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
39
+ var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
40
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
41
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
42
+ function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
43
+ const domainToMappings = {
44
+ "api._api_base_domain_": [
45
+ {
46
+ srcPath: "/wix-ecommerce-catalog-reader-web",
47
+ destPath: ""
48
+ }
49
+ ],
50
+ "manage._base_domain_": [
51
+ {
52
+ srcPath: "/wix-ecommerce-catalog-reader-web",
53
+ destPath: ""
54
+ }
55
+ ],
56
+ "www.wixapis.com": [
57
+ {
58
+ srcPath: "/stores-reader/v2/collections",
59
+ destPath: "/v2/collections"
60
+ },
61
+ {
62
+ srcPath: "/stores-reader/v2/inventoryItems",
63
+ destPath: "/v2/inventoryItems"
64
+ }
65
+ ],
66
+ "www._base_domain_": [
67
+ {
68
+ srcPath: "/wix-ecommerce-catalog-reader-web",
69
+ destPath: ""
70
+ }
71
+ ],
72
+ "editor._base_domain_": [
73
+ {
74
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
75
+ destPath: ""
76
+ }
77
+ ],
78
+ "blocks._base_domain_": [
79
+ {
80
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
81
+ destPath: ""
82
+ }
83
+ ],
84
+ "create.editorx": [
85
+ {
86
+ srcPath: "/_api/wix-ecommerce-catalog-reader-web",
87
+ destPath: ""
88
+ }
89
+ ],
90
+ _: [
91
+ {
92
+ srcPath: "/stores-reader/v2/inventoryItems",
93
+ destPath: "/v2/inventoryItems"
94
+ },
95
+ {
96
+ srcPath: "/stores-reader/v2/collections",
97
+ destPath: "/v2/collections"
98
+ }
99
+ ]
100
+ };
101
+ return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
102
+ }
103
+ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
104
+ const domainToMappings = {
105
+ "api._api_base_domain_": [
106
+ {
107
+ srcPath: "/wix-ecommerce-catalog-web",
108
+ destPath: ""
109
+ }
110
+ ],
111
+ "www._base_domain_": [
112
+ {
113
+ srcPath: "/_api/catalog-server",
114
+ destPath: ""
115
+ },
116
+ {
117
+ srcPath: "/wix-ecommerce-catalog",
118
+ destPath: ""
119
+ }
120
+ ],
121
+ "ecom._base_domain_": [
122
+ {
123
+ srcPath: "/_api/catalog-server",
124
+ destPath: ""
125
+ }
126
+ ],
127
+ "*.pub.wix-code.com": [
128
+ {
129
+ srcPath: "/_api/catalog-server",
130
+ destPath: ""
131
+ }
132
+ ],
133
+ "www.wixapis.com": [
134
+ {
135
+ srcPath: "/stores/v1/inventoryItems",
136
+ destPath: "/v1/inventoryItems"
137
+ },
138
+ {
139
+ srcPath: "/stores/v2/inventoryItems",
140
+ destPath: "/v2/inventoryItems"
141
+ }
142
+ ],
143
+ "manage._base_domain_": [
144
+ {
145
+ srcPath: "/wix-ecommerce-catalog",
146
+ destPath: ""
147
+ }
148
+ ],
149
+ "editor.wixapps.net": [
150
+ {
151
+ srcPath: "/_api/catalog-server",
152
+ destPath: ""
153
+ }
154
+ ],
155
+ "www.wixgateway.com": [
156
+ {
157
+ srcPath: "/stores/v1/products",
158
+ destPath: "/v1/products"
159
+ },
160
+ {
161
+ srcPath: "/stores/v1/collections",
162
+ destPath: "/v1/collections"
163
+ }
164
+ ],
165
+ "editor._base_domain_": [
166
+ {
167
+ srcPath: "/_api/catalog-server",
168
+ destPath: ""
169
+ }
170
+ ],
171
+ "blocks._base_domain_": [
172
+ {
173
+ srcPath: "/_api/catalog-server",
174
+ destPath: ""
175
+ }
176
+ ],
177
+ "create.editorx": [
178
+ {
179
+ srcPath: "/_api/catalog-server",
180
+ destPath: ""
181
+ }
182
+ ]
183
+ };
184
+ return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
185
+ }
186
+ var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
187
+ function updateInventoryVariants(payload) {
188
+ function __updateInventoryVariants({ host }) {
189
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
190
+ {
191
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
192
+ paths: [{ path: "inventoryItem.lastUpdated" }]
193
+ }
194
+ ]);
195
+ const metadata = {
196
+ entityFqdn: "wix.stores.v2.inventory",
197
+ method: "PATCH",
198
+ methodFqn: "wix.inventory.api.v1.InventoryWriteApi.UpdateInventoryVariants",
199
+ packageName: PACKAGE_NAME,
200
+ url: resolveWixInventoryApiV1InventoryWriteApiUrl({
201
+ protoPath: "/v2/inventoryItems/product/{inventoryItem.productId}",
202
+ data: serializedData,
203
+ host
204
+ }),
205
+ data: serializedData
206
+ };
207
+ return metadata;
208
+ }
209
+ return __updateInventoryVariants;
210
+ }
211
+ function decrementInventory(payload) {
212
+ function __decrementInventory({ host }) {
213
+ const metadata = {
214
+ entityFqdn: "wix.stores.v2.inventory",
215
+ method: "POST",
216
+ methodFqn: "wix.inventory.api.v1.InventoryWriteApi.DecrementInventory",
217
+ packageName: PACKAGE_NAME,
218
+ url: resolveWixInventoryApiV1InventoryWriteApiUrl({
219
+ protoPath: "/v2/inventoryItems/decrement",
220
+ data: payload,
221
+ host
222
+ }),
223
+ data: payload
224
+ };
225
+ return metadata;
226
+ }
227
+ return __decrementInventory;
228
+ }
229
+ function incrementInventory(payload) {
230
+ function __incrementInventory({ host }) {
231
+ const metadata = {
232
+ entityFqdn: "wix.stores.v2.inventory",
233
+ method: "POST",
234
+ methodFqn: "wix.inventory.api.v1.InventoryWriteApi.IncrementInventory",
235
+ packageName: PACKAGE_NAME,
236
+ url: resolveWixInventoryApiV1InventoryWriteApiUrl({
237
+ protoPath: "/v2/inventoryItems/increment",
238
+ data: payload,
239
+ host
240
+ }),
241
+ data: payload
242
+ };
243
+ return metadata;
244
+ }
245
+ return __incrementInventory;
246
+ }
247
+ function getInventoryVariants(payload) {
248
+ function __getInventoryVariants({ host }) {
249
+ const metadata = {
250
+ entityFqdn: "wix.stores.v2.inventory",
251
+ method: "POST",
252
+ methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
253
+ packageName: PACKAGE_NAME,
254
+ url: resolveWixInventoryApiV1InventoryReadApiUrl({
255
+ protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
256
+ data: payload,
257
+ host
258
+ }),
259
+ data: payload,
260
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
261
+ {
262
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
263
+ paths: [{ path: "inventoryItem.lastUpdated" }]
264
+ }
265
+ ])
266
+ };
267
+ return metadata;
268
+ }
269
+ return __getInventoryVariants;
270
+ }
271
+ function queryInventory(payload) {
272
+ function __queryInventory({ host }) {
273
+ const metadata = {
274
+ entityFqdn: "wix.stores.v2.inventory",
275
+ method: "POST",
276
+ methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
277
+ packageName: PACKAGE_NAME,
278
+ url: resolveWixInventoryApiV1InventoryReadApiUrl({
279
+ protoPath: "/v2/inventoryItems/query",
280
+ data: payload,
281
+ host
282
+ }),
283
+ data: payload,
284
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
285
+ {
286
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
287
+ paths: [{ path: "inventoryItems.lastUpdated" }]
288
+ }
289
+ ])
290
+ };
291
+ return metadata;
292
+ }
293
+ return __queryInventory;
294
+ }
295
+
296
+ // src/stores-v2-inventory-inventory.universal.ts
297
+ var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
298
+ ReasonType2["UNKNOWN"] = "UNKNOWN";
299
+ ReasonType2["ORDER"] = "ORDER";
300
+ ReasonType2["MANUAL"] = "MANUAL";
301
+ ReasonType2["REVERT_INVENTORY_CHANGE"] = "REVERT_INVENTORY_CHANGE";
302
+ return ReasonType2;
303
+ })(ReasonType || {});
304
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
305
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
306
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
307
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
308
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
309
+ WebhookIdentityType2["APP"] = "APP";
310
+ return WebhookIdentityType2;
311
+ })(WebhookIdentityType || {});
312
+ async function updateInventoryVariants2(productId, inventoryItem) {
313
+ const { httpClient, sideEffects } = arguments[2];
314
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
315
+ inventoryItem: { ...inventoryItem, productId }
316
+ });
317
+ const reqOpts = updateInventoryVariants(payload);
318
+ sideEffects?.onSiteCall?.();
319
+ try {
320
+ const result = await httpClient.request(reqOpts);
321
+ sideEffects?.onSuccess?.(result);
322
+ } catch (err) {
323
+ const transformedError = (0, import_transform_error.transformError)(
324
+ err,
325
+ {
326
+ spreadPathsToArguments: { inventoryItem: "$[1]" },
327
+ explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
328
+ singleArgumentUnchanged: false
329
+ },
330
+ ["productId", "inventoryItem"]
331
+ );
332
+ sideEffects?.onError?.(err);
333
+ throw transformedError;
334
+ }
335
+ }
336
+ async function decrementInventory2(decrementData) {
337
+ const { httpClient, sideEffects } = arguments[1];
338
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
339
+ decrementData
340
+ });
341
+ const reqOpts = decrementInventory(payload);
342
+ sideEffects?.onSiteCall?.();
343
+ try {
344
+ const result = await httpClient.request(reqOpts);
345
+ sideEffects?.onSuccess?.(result);
346
+ } catch (err) {
347
+ const transformedError = (0, import_transform_error.transformError)(
348
+ err,
349
+ {
350
+ spreadPathsToArguments: {},
351
+ explicitPathsToArguments: { decrementData: "$[0]" },
352
+ singleArgumentUnchanged: false
353
+ },
354
+ ["decrementData"]
355
+ );
356
+ sideEffects?.onError?.(err);
357
+ throw transformedError;
358
+ }
359
+ }
360
+ async function incrementInventory2(incrementData) {
361
+ const { httpClient, sideEffects } = arguments[1];
362
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
363
+ incrementData
364
+ });
365
+ const reqOpts = incrementInventory(payload);
366
+ sideEffects?.onSiteCall?.();
367
+ try {
368
+ const result = await httpClient.request(reqOpts);
369
+ sideEffects?.onSuccess?.(result);
370
+ } catch (err) {
371
+ const transformedError = (0, import_transform_error.transformError)(
372
+ err,
373
+ {
374
+ spreadPathsToArguments: {},
375
+ explicitPathsToArguments: { incrementData: "$[0]" },
376
+ singleArgumentUnchanged: false
377
+ },
378
+ ["incrementData"]
379
+ );
380
+ sideEffects?.onError?.(err);
381
+ throw transformedError;
382
+ }
383
+ }
384
+ async function getInventoryVariants2(inventoryId, options) {
385
+ const { httpClient, sideEffects } = arguments[2];
386
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
387
+ inventoryId,
388
+ externalId: options?.externalId,
389
+ productId: options?.productId,
390
+ variantIds: options?.variantIds
391
+ });
392
+ const reqOpts = getInventoryVariants(payload);
393
+ sideEffects?.onSiteCall?.();
394
+ try {
395
+ const result = await httpClient.request(reqOpts);
396
+ sideEffects?.onSuccess?.(result);
397
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
398
+ } catch (err) {
399
+ const transformedError = (0, import_transform_error.transformError)(
400
+ err,
401
+ {
402
+ spreadPathsToArguments: {},
403
+ explicitPathsToArguments: {
404
+ inventoryId: "$[0]",
405
+ externalId: "$[1].externalId",
406
+ productId: "$[1].productId",
407
+ variantIds: "$[1].variantIds"
408
+ },
409
+ singleArgumentUnchanged: false
410
+ },
411
+ ["inventoryId", "options"]
412
+ );
413
+ sideEffects?.onError?.(err);
414
+ throw transformedError;
415
+ }
416
+ }
417
+ async function queryInventory2(options) {
418
+ const { httpClient, sideEffects } = arguments[1];
419
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
420
+ query: options?.query
421
+ });
422
+ const reqOpts = queryInventory(payload);
423
+ sideEffects?.onSiteCall?.();
424
+ try {
425
+ const result = await httpClient.request(reqOpts);
426
+ sideEffects?.onSuccess?.(result);
427
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
428
+ } catch (err) {
429
+ const transformedError = (0, import_transform_error.transformError)(
430
+ err,
431
+ {
432
+ spreadPathsToArguments: {},
433
+ explicitPathsToArguments: { query: "$[0].query" },
434
+ singleArgumentUnchanged: false
435
+ },
436
+ ["options"]
437
+ );
438
+ sideEffects?.onError?.(err);
439
+ throw transformedError;
440
+ }
441
+ }
442
+ // Annotate the CommonJS export names for ESM import in node:
443
+ 0 && (module.exports = {
444
+ ReasonType,
445
+ WebhookIdentityType,
446
+ decrementInventory,
447
+ getInventoryVariants,
448
+ incrementInventory,
449
+ queryInventory,
450
+ updateInventoryVariants
451
+ });
452
+ //# sourceMappingURL=index.typings.js.map