@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,6 +1,6 @@
1
1
  import { HttpClient, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { U as UpdateInventoryVariantsInventoryItem, D as DecrementData, I as IncrementData, G as GetInventoryVariantsOptions, a as GetInventoryVariantsResponse, Q as QueryInventoryOptions, b as QueryInventoryResponse, c as InventoryItemChangedEnvelope, d as InventoryVariantsChangedEnvelope } from './stores-v2-inventory-inventory.universal-BltJPMge.js';
3
- export { K as BaseEventMetadata, k as BulkUpdateInventoryItemsRequest, l as BulkUpdateInventoryItemsResponse, B as BulkUpdateInventoryVariantsRequest, i as BulkUpdateInventoryVariantsRequestActionOneOf, j as BulkUpdateInventoryVariantsResponse, C as ChangedInventoryVariant, u as ChangedInventoryVariantData, n as DecrementDataIdOneOf, m as DecrementInventoryRequest, o as DecrementInventoryResponse, x as GetInventoryItemsRequest, y as GetInventoryItemsResponse, L as GetInventoryVariantsOptionsIdOneOf, v as GetInventoryVariantsRequest, w as GetInventoryVariantsRequestIdOneOf, H as IdentificationData, J as IdentificationDataIdOneOf, q as IncrementDataIdOneOf, p as IncrementInventoryRequest, r as IncrementInventoryResponse, s as InventoryItemChanged, e as InventoryItemV2, f as InventoryVariantV2, t as InventoryVariantsChanged, M as MessageEnvelope, E as Paging, F as PagingMetadata, P as PreorderInfo, A as Query, z as QueryInventoryRequest, R as ReasonType, g as UpdateInventoryVariantsRequest, h as UpdateInventoryVariantsResponse, W as WebhookIdentityType } from './stores-v2-inventory-inventory.universal-BltJPMge.js';
2
+ import { UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, InventoryItemChangedEnvelope, InventoryVariantsChangedEnvelope } from './index.typings.js';
3
+ export { BaseEventMetadata, BulkUpdateInventoryItemsRequest, BulkUpdateInventoryItemsResponse, BulkUpdateInventoryVariantsRequest, BulkUpdateInventoryVariantsRequestActionOneOf, BulkUpdateInventoryVariantsResponse, ChangedInventoryVariant, ChangedInventoryVariantData, DecrementDataIdOneOf, DecrementInventoryRequest, DecrementInventoryResponse, GetInventoryItemsRequest, GetInventoryItemsResponse, GetInventoryVariantsOptionsIdOneOf, GetInventoryVariantsRequest, GetInventoryVariantsRequestIdOneOf, IdentificationData, IdentificationDataIdOneOf, IncrementDataIdOneOf, IncrementInventoryRequest, IncrementInventoryResponse, InventoryItemChanged, InventoryItemV2, InventoryVariantV2, InventoryVariantsChanged, MessageEnvelope, Paging, PagingMetadata, PreorderInfo, Query, QueryInventoryRequest, ReasonType, UpdateInventoryVariantsRequest, UpdateInventoryVariantsResponse, WebhookIdentityType } from './index.typings.js';
4
4
 
5
5
  declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
6
6
  interface UpdateInventoryVariantsSignature {
@@ -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;
@@ -66,6 +68,8 @@ declare enum ReasonType {
66
68
  /** Reverting an inventory change. */
67
69
  REVERT_INVENTORY_CHANGE = "REVERT_INVENTORY_CHANGE"
68
70
  }
71
+ /** @enumType */
72
+ type ReasonTypeWithLiterals = ReasonType | 'UNKNOWN' | 'ORDER' | 'MANUAL' | 'REVERT_INVENTORY_CHANGE';
69
73
  interface UpdateInventoryVariantsResponse {
70
74
  }
71
75
  interface BulkUpdateInventoryVariantsRequest extends BulkUpdateInventoryVariantsRequestActionOneOf {
@@ -401,10 +405,64 @@ interface InventoryItemChangedEnvelope {
401
405
  data: InventoryItemChanged;
402
406
  metadata: BaseEventMetadata;
403
407
  }
408
+ /**
409
+ * Triggered when an inventory item is changed.
410
+ * @permissionScope Manage Stores - all permissions
411
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
412
+ * @permissionScope Manage Stores
413
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
414
+ * @permissionScope Manage Products
415
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
416
+ * @permissionScope Read Stores - all read permissions
417
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
418
+ * @permissionScope Read Products
419
+ * @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
420
+ * @permissionId WIX_STORES.READ_INVENTORY
421
+ * @webhook
422
+ * @eventType com.wix.ecommerce.inventory.api.v1.InventoryItemChanged
423
+ * @serviceIdentifier wix.inventory.api.v1.InventoryReadApi
424
+ * @slug inventory_item_changed
425
+ */
426
+ declare function onInventoryItemChanged(handler: (event: InventoryItemChangedEnvelope) => void | Promise<void>): void;
404
427
  interface InventoryVariantsChangedEnvelope {
405
428
  data: InventoryVariantsChanged;
406
429
  metadata: BaseEventMetadata;
407
430
  }
431
+ /**
432
+ * Triggered when inventory variants are changed.
433
+ * @permissionScope Manage Stores - all permissions
434
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
435
+ * @permissionScope Manage Stores
436
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
437
+ * @permissionScope Manage Products
438
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
439
+ * @permissionScope Read Stores - all read permissions
440
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
441
+ * @permissionScope Read Products
442
+ * @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
443
+ * @permissionId WIX_STORES.READ_INVENTORY
444
+ * @webhook
445
+ * @eventType com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged
446
+ * @serviceIdentifier wix.inventory.api.v1.InventoryReadApi
447
+ * @slug inventory_variants_changed
448
+ */
449
+ declare function onInventoryVariantsChanged(handler: (event: InventoryVariantsChangedEnvelope) => void | Promise<void>): void;
450
+ type InventoryNonNullablePaths = `variants` | `variants.${number}.variantId` | `variants.${number}.availableForPreorder` | `numericId` | `preorderInfo.enabled`;
451
+ /**
452
+ * Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.
453
+ *
454
+ *
455
+ * The `updateInventoryVariants()` function is a Promise that resolves to the updated inventory variant data.
456
+ * @param productId - Product ID.
457
+ * @public
458
+ * @requiredField inventoryItem
459
+ * @requiredField productId
460
+ * @param inventoryItem - Inventory item to update.
461
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
462
+ * @applicableIdentity APP
463
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.UpdateInventoryVariants
464
+ */
465
+ declare function updateInventoryVariants(productId: string, inventoryItem: UpdateInventoryVariantsInventoryItem): Promise<void>;
408
466
  interface UpdateInventoryVariantsInventoryItem {
409
467
  /** Inventory item ID. */
410
468
  _id?: string | null;
@@ -426,6 +484,48 @@ interface UpdateInventoryVariantsInventoryItem {
426
484
  /** Preorder information. */
427
485
  preorderInfo?: PreorderInfo;
428
486
  }
487
+ /**
488
+ * Subtracts a set number of items from inventory.
489
+ *
490
+ *
491
+ * The `decrementInventory()` function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.
492
+ * @param decrementData - Item or product to decrement.
493
+ * @public
494
+ * @requiredField decrementData
495
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
496
+ * @applicableIdentity APP
497
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.DecrementInventory
498
+ */
499
+ declare function decrementInventory(decrementData: DecrementData[]): Promise<void>;
500
+ /**
501
+ * Adds a set number of items to inventory.
502
+ *
503
+ *
504
+ * The `incrementInventory()` function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.
505
+ * @param incrementData - Item or product to increment.
506
+ * @public
507
+ * @requiredField incrementData
508
+ * @permissionId WIX_STORES.MODIFY_INVENTORY
509
+ * @applicableIdentity APP
510
+ * @fqn wix.inventory.api.v1.InventoryWriteApi.IncrementInventory
511
+ */
512
+ declare function incrementInventory(incrementData: IncrementData[]): Promise<void>;
513
+ /**
514
+ * Gets inventory variant information based on the specified option choices.
515
+ *
516
+ *
517
+ * The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
518
+ * @param inventoryId - Inventory item ID.
519
+ * @public
520
+ * @requiredField inventoryId
521
+ * @permissionId WIX_STORES.READ_INVENTORY
522
+ * @applicableIdentity APP
523
+ * @applicableIdentity VISITOR
524
+ * @fqn wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants
525
+ */
526
+ declare function getInventoryVariants(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, {
527
+ [P in InventoryNonNullablePaths]: `inventoryItem.${P}`;
528
+ }[InventoryNonNullablePaths]>>;
429
529
  interface GetInventoryVariantsOptions extends GetInventoryVariantsOptionsIdOneOf {
430
530
  /** Product ID. */
431
531
  productId?: string;
@@ -439,9 +539,20 @@ interface GetInventoryVariantsOptionsIdOneOf {
439
539
  /** Product ID. */
440
540
  productId?: string;
441
541
  }
542
+ /**
543
+ * Returns a list of inventory items, given the provided paging, sorting and filtering.
544
+ * @public
545
+ * @permissionId WIX_STORES.READ_INVENTORY
546
+ * @applicableIdentity APP
547
+ * @applicableIdentity VISITOR
548
+ * @fqn wix.inventory.api.v1.InventoryReadApi.QueryInventory
549
+ */
550
+ declare function queryInventory(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, {
551
+ [P in InventoryNonNullablePaths]: `inventoryItems.${number}.${P}`;
552
+ }[InventoryNonNullablePaths] | `metadata.items` | `metadata.offset` | `totalResults`>>;
442
553
  interface QueryInventoryOptions {
443
554
  /** Information about paging, filters, sorting. */
444
555
  query?: Query;
445
556
  }
446
557
 
447
- 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 };
558
+ 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