@wix/auto_sdk_stores_inventory 1.0.84 → 1.0.86
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/build/cjs/index.d.ts +21 -21
- package/build/cjs/index.js +127 -121
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +110 -104
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +96 -90
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +127 -121
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +110 -104
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +96 -90
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +21 -21
- package/build/internal/cjs/index.typings.d.ts +242 -242
- package/build/internal/cjs/meta.d.ts +190 -190
- package/build/internal/es/index.d.mts +21 -21
- package/build/internal/es/index.typings.d.mts +242 -242
- package/build/internal/es/meta.d.mts +190 -190
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
2
|
+
import { GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, InventoryItemChangedEnvelope, InventoryVariantsChangedEnvelope } from './index.typings.js';
|
|
3
3
|
export { AccountInfo, 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, ReasonTypeWithLiterals, UpdateInventoryVariantsRequest, UpdateInventoryVariantsResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
|
|
4
4
|
|
|
5
|
+
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
6
|
+
interface GetInventoryVariantsSignature {
|
|
7
|
+
/**
|
|
8
|
+
* Gets inventory variant information based on the specified option choices.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
12
|
+
* @param - Inventory item ID.
|
|
13
|
+
*/
|
|
14
|
+
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
15
|
+
}
|
|
16
|
+
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
17
|
+
interface QueryInventorySignature {
|
|
18
|
+
/**
|
|
19
|
+
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
20
|
+
*/
|
|
21
|
+
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
22
|
+
}
|
|
5
23
|
declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
|
|
6
24
|
interface UpdateInventoryVariantsSignature {
|
|
7
25
|
/**
|
|
@@ -36,32 +54,14 @@ interface IncrementInventorySignature {
|
|
|
36
54
|
*/
|
|
37
55
|
(incrementData: IncrementData[]): Promise<void>;
|
|
38
56
|
}
|
|
39
|
-
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
40
|
-
interface GetInventoryVariantsSignature {
|
|
41
|
-
/**
|
|
42
|
-
* Gets inventory variant information based on the specified option choices.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
46
|
-
* @param - Inventory item ID.
|
|
47
|
-
*/
|
|
48
|
-
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
49
|
-
}
|
|
50
|
-
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
51
|
-
interface QueryInventorySignature {
|
|
52
|
-
/**
|
|
53
|
-
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
54
|
-
*/
|
|
55
|
-
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
56
|
-
}
|
|
57
57
|
declare const onInventoryItemChanged$1: EventDefinition<InventoryItemChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryItemChanged">;
|
|
58
58
|
declare const onInventoryVariantsChanged$1: EventDefinition<InventoryVariantsChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged">;
|
|
59
59
|
|
|
60
|
+
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
61
|
+
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
60
62
|
declare const updateInventoryVariants: MaybeContext<BuildRESTFunction<typeof updateInventoryVariants$1> & typeof updateInventoryVariants$1>;
|
|
61
63
|
declare const decrementInventory: MaybeContext<BuildRESTFunction<typeof decrementInventory$1> & typeof decrementInventory$1>;
|
|
62
64
|
declare const incrementInventory: MaybeContext<BuildRESTFunction<typeof incrementInventory$1> & typeof incrementInventory$1>;
|
|
63
|
-
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
64
|
-
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
65
65
|
/**
|
|
66
66
|
* Triggered when an inventory item is changed.
|
|
67
67
|
*/
|
package/build/cjs/index.js
CHANGED
|
@@ -50,17 +50,6 @@ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform
|
|
|
50
50
|
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
51
51
|
var TRANSFORM_PATHS_0 = [{ path: "inventoryItem.lastUpdated" }];
|
|
52
52
|
var TRANSFORM_PATHS_1 = [{ path: "inventoryItems.lastUpdated" }];
|
|
53
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
54
|
-
const domainToMappings = {
|
|
55
|
-
"api._api_base_domain_": [
|
|
56
|
-
{
|
|
57
|
-
srcPath: "/inventory-read-api-proxy",
|
|
58
|
-
destPath: ""
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
};
|
|
62
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
63
|
-
}
|
|
64
53
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
65
54
|
const domainToMappings = {
|
|
66
55
|
_: [
|
|
@@ -140,7 +129,78 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
140
129
|
};
|
|
141
130
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
142
131
|
}
|
|
132
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
133
|
+
const domainToMappings = {
|
|
134
|
+
"api._api_base_domain_": [
|
|
135
|
+
{
|
|
136
|
+
srcPath: "/inventory-read-api-proxy",
|
|
137
|
+
destPath: ""
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
_: [
|
|
141
|
+
{
|
|
142
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
143
|
+
destPath: "/v2/inventoryItems"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
};
|
|
147
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
148
|
+
}
|
|
143
149
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
150
|
+
function getInventoryVariants(payload) {
|
|
151
|
+
function __getInventoryVariants({ host }) {
|
|
152
|
+
const metadata = {
|
|
153
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
154
|
+
method: "POST",
|
|
155
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
156
|
+
packageName: PACKAGE_NAME,
|
|
157
|
+
migrationOptions: {
|
|
158
|
+
optInTransformResponse: true
|
|
159
|
+
},
|
|
160
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
161
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
162
|
+
data: payload,
|
|
163
|
+
host
|
|
164
|
+
}),
|
|
165
|
+
data: payload,
|
|
166
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
167
|
+
{
|
|
168
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
169
|
+
paths: TRANSFORM_PATHS_0
|
|
170
|
+
}
|
|
171
|
+
])
|
|
172
|
+
};
|
|
173
|
+
return metadata;
|
|
174
|
+
}
|
|
175
|
+
return __getInventoryVariants;
|
|
176
|
+
}
|
|
177
|
+
function queryInventory(payload) {
|
|
178
|
+
function __queryInventory({ host }) {
|
|
179
|
+
const metadata = {
|
|
180
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
181
|
+
method: "POST",
|
|
182
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
183
|
+
packageName: PACKAGE_NAME,
|
|
184
|
+
migrationOptions: {
|
|
185
|
+
optInTransformResponse: true
|
|
186
|
+
},
|
|
187
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
188
|
+
protoPath: "/v2/inventoryItems/query",
|
|
189
|
+
data: payload,
|
|
190
|
+
host
|
|
191
|
+
}),
|
|
192
|
+
data: payload,
|
|
193
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
194
|
+
{
|
|
195
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
196
|
+
paths: TRANSFORM_PATHS_1
|
|
197
|
+
}
|
|
198
|
+
])
|
|
199
|
+
};
|
|
200
|
+
return metadata;
|
|
201
|
+
}
|
|
202
|
+
return __queryInventory;
|
|
203
|
+
}
|
|
144
204
|
function updateInventoryVariants(payload) {
|
|
145
205
|
function __updateInventoryVariants({ host }) {
|
|
146
206
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -210,60 +270,6 @@ function incrementInventory(payload) {
|
|
|
210
270
|
}
|
|
211
271
|
return __incrementInventory;
|
|
212
272
|
}
|
|
213
|
-
function getInventoryVariants(payload) {
|
|
214
|
-
function __getInventoryVariants({ host }) {
|
|
215
|
-
const metadata = {
|
|
216
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
217
|
-
method: "POST",
|
|
218
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
219
|
-
packageName: PACKAGE_NAME,
|
|
220
|
-
migrationOptions: {
|
|
221
|
-
optInTransformResponse: true
|
|
222
|
-
},
|
|
223
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
224
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
225
|
-
data: payload,
|
|
226
|
-
host
|
|
227
|
-
}),
|
|
228
|
-
data: payload,
|
|
229
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
230
|
-
{
|
|
231
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
232
|
-
paths: TRANSFORM_PATHS_0
|
|
233
|
-
}
|
|
234
|
-
])
|
|
235
|
-
};
|
|
236
|
-
return metadata;
|
|
237
|
-
}
|
|
238
|
-
return __getInventoryVariants;
|
|
239
|
-
}
|
|
240
|
-
function queryInventory(payload) {
|
|
241
|
-
function __queryInventory({ host }) {
|
|
242
|
-
const metadata = {
|
|
243
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
244
|
-
method: "POST",
|
|
245
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
246
|
-
packageName: PACKAGE_NAME,
|
|
247
|
-
migrationOptions: {
|
|
248
|
-
optInTransformResponse: true
|
|
249
|
-
},
|
|
250
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
251
|
-
protoPath: "/v2/inventoryItems/query",
|
|
252
|
-
data: payload,
|
|
253
|
-
host
|
|
254
|
-
}),
|
|
255
|
-
data: payload,
|
|
256
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
257
|
-
{
|
|
258
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
259
|
-
paths: TRANSFORM_PATHS_1
|
|
260
|
-
}
|
|
261
|
-
])
|
|
262
|
-
};
|
|
263
|
-
return metadata;
|
|
264
|
-
}
|
|
265
|
-
return __queryInventory;
|
|
266
|
-
}
|
|
267
273
|
|
|
268
274
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
269
275
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -281,60 +287,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
281
287
|
WebhookIdentityType2["APP"] = "APP";
|
|
282
288
|
return WebhookIdentityType2;
|
|
283
289
|
})(WebhookIdentityType || {});
|
|
284
|
-
async function
|
|
290
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
285
291
|
const { httpClient, sideEffects } = arguments[2];
|
|
286
292
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
287
|
-
|
|
293
|
+
inventoryId,
|
|
294
|
+
externalId: options?.externalId,
|
|
295
|
+
productId: options?.productId,
|
|
296
|
+
variantIds: options?.variantIds
|
|
288
297
|
});
|
|
289
|
-
const reqOpts =
|
|
298
|
+
const reqOpts = getInventoryVariants(payload);
|
|
290
299
|
sideEffects?.onSiteCall?.();
|
|
291
300
|
try {
|
|
292
301
|
const result = await httpClient.request(reqOpts);
|
|
293
302
|
sideEffects?.onSuccess?.(result);
|
|
303
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
294
304
|
} catch (err) {
|
|
295
305
|
const transformedError = (0, import_transform_error.transformError)(
|
|
296
306
|
err,
|
|
297
307
|
{
|
|
298
|
-
spreadPathsToArguments: {
|
|
299
|
-
explicitPathsToArguments: {
|
|
308
|
+
spreadPathsToArguments: {},
|
|
309
|
+
explicitPathsToArguments: {
|
|
310
|
+
inventoryId: "$[0]",
|
|
311
|
+
externalId: "$[1].externalId",
|
|
312
|
+
productId: "$[1].productId",
|
|
313
|
+
variantIds: "$[1].variantIds"
|
|
314
|
+
},
|
|
300
315
|
singleArgumentUnchanged: false
|
|
301
316
|
},
|
|
302
|
-
["
|
|
317
|
+
["inventoryId", "options"]
|
|
303
318
|
);
|
|
304
319
|
sideEffects?.onError?.(err);
|
|
305
320
|
throw transformedError;
|
|
306
321
|
}
|
|
307
322
|
}
|
|
308
|
-
async function
|
|
323
|
+
async function queryInventory2(options) {
|
|
309
324
|
const { httpClient, sideEffects } = arguments[1];
|
|
310
325
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
311
|
-
|
|
326
|
+
query: options?.query
|
|
312
327
|
});
|
|
313
|
-
const reqOpts =
|
|
328
|
+
const reqOpts = queryInventory(payload);
|
|
314
329
|
sideEffects?.onSiteCall?.();
|
|
315
330
|
try {
|
|
316
331
|
const result = await httpClient.request(reqOpts);
|
|
317
332
|
sideEffects?.onSuccess?.(result);
|
|
333
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
318
334
|
} catch (err) {
|
|
319
335
|
const transformedError = (0, import_transform_error.transformError)(
|
|
320
336
|
err,
|
|
321
337
|
{
|
|
322
338
|
spreadPathsToArguments: {},
|
|
323
|
-
explicitPathsToArguments: {
|
|
339
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
324
340
|
singleArgumentUnchanged: false
|
|
325
341
|
},
|
|
326
|
-
["
|
|
342
|
+
["options"]
|
|
327
343
|
);
|
|
328
344
|
sideEffects?.onError?.(err);
|
|
329
345
|
throw transformedError;
|
|
330
346
|
}
|
|
331
347
|
}
|
|
332
|
-
async function
|
|
333
|
-
const { httpClient, sideEffects } = arguments[
|
|
348
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
349
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
334
350
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
335
|
-
|
|
351
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
336
352
|
});
|
|
337
|
-
const reqOpts =
|
|
353
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
338
354
|
sideEffects?.onSiteCall?.();
|
|
339
355
|
try {
|
|
340
356
|
const result = await httpClient.request(reqOpts);
|
|
@@ -343,69 +359,59 @@ async function incrementInventory2(incrementData) {
|
|
|
343
359
|
const transformedError = (0, import_transform_error.transformError)(
|
|
344
360
|
err,
|
|
345
361
|
{
|
|
346
|
-
spreadPathsToArguments: {},
|
|
347
|
-
explicitPathsToArguments: {
|
|
362
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
363
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
348
364
|
singleArgumentUnchanged: false
|
|
349
365
|
},
|
|
350
|
-
["
|
|
366
|
+
["productId", "inventoryItem"]
|
|
351
367
|
);
|
|
352
368
|
sideEffects?.onError?.(err);
|
|
353
369
|
throw transformedError;
|
|
354
370
|
}
|
|
355
371
|
}
|
|
356
|
-
async function
|
|
357
|
-
const { httpClient, sideEffects } = arguments[
|
|
372
|
+
async function decrementInventory2(decrementData) {
|
|
373
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
358
374
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
359
|
-
|
|
360
|
-
externalId: options?.externalId,
|
|
361
|
-
productId: options?.productId,
|
|
362
|
-
variantIds: options?.variantIds
|
|
375
|
+
decrementData
|
|
363
376
|
});
|
|
364
|
-
const reqOpts =
|
|
377
|
+
const reqOpts = decrementInventory(payload);
|
|
365
378
|
sideEffects?.onSiteCall?.();
|
|
366
379
|
try {
|
|
367
380
|
const result = await httpClient.request(reqOpts);
|
|
368
381
|
sideEffects?.onSuccess?.(result);
|
|
369
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
370
382
|
} catch (err) {
|
|
371
383
|
const transformedError = (0, import_transform_error.transformError)(
|
|
372
384
|
err,
|
|
373
385
|
{
|
|
374
386
|
spreadPathsToArguments: {},
|
|
375
|
-
explicitPathsToArguments: {
|
|
376
|
-
inventoryId: "$[0]",
|
|
377
|
-
externalId: "$[1].externalId",
|
|
378
|
-
productId: "$[1].productId",
|
|
379
|
-
variantIds: "$[1].variantIds"
|
|
380
|
-
},
|
|
387
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
381
388
|
singleArgumentUnchanged: false
|
|
382
389
|
},
|
|
383
|
-
["
|
|
390
|
+
["decrementData"]
|
|
384
391
|
);
|
|
385
392
|
sideEffects?.onError?.(err);
|
|
386
393
|
throw transformedError;
|
|
387
394
|
}
|
|
388
395
|
}
|
|
389
|
-
async function
|
|
396
|
+
async function incrementInventory2(incrementData) {
|
|
390
397
|
const { httpClient, sideEffects } = arguments[1];
|
|
391
398
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
392
|
-
|
|
399
|
+
incrementData
|
|
393
400
|
});
|
|
394
|
-
const reqOpts =
|
|
401
|
+
const reqOpts = incrementInventory(payload);
|
|
395
402
|
sideEffects?.onSiteCall?.();
|
|
396
403
|
try {
|
|
397
404
|
const result = await httpClient.request(reqOpts);
|
|
398
405
|
sideEffects?.onSuccess?.(result);
|
|
399
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
400
406
|
} catch (err) {
|
|
401
407
|
const transformedError = (0, import_transform_error.transformError)(
|
|
402
408
|
err,
|
|
403
409
|
{
|
|
404
410
|
spreadPathsToArguments: {},
|
|
405
|
-
explicitPathsToArguments: {
|
|
411
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
406
412
|
singleArgumentUnchanged: false
|
|
407
413
|
},
|
|
408
|
-
["
|
|
414
|
+
["incrementData"]
|
|
409
415
|
);
|
|
410
416
|
sideEffects?.onError?.(err);
|
|
411
417
|
throw transformedError;
|
|
@@ -415,6 +421,21 @@ async function queryInventory2(options) {
|
|
|
415
421
|
// src/stores-v2-inventory-inventory.public.ts
|
|
416
422
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
417
423
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
424
|
+
function getInventoryVariants3(httpClient) {
|
|
425
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
426
|
+
inventoryId,
|
|
427
|
+
options,
|
|
428
|
+
// @ts-ignore
|
|
429
|
+
{ httpClient }
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
function queryInventory3(httpClient) {
|
|
433
|
+
return (options) => queryInventory2(
|
|
434
|
+
options,
|
|
435
|
+
// @ts-ignore
|
|
436
|
+
{ httpClient }
|
|
437
|
+
);
|
|
438
|
+
}
|
|
418
439
|
function updateInventoryVariants3(httpClient) {
|
|
419
440
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
420
441
|
productId,
|
|
@@ -437,21 +458,6 @@ function incrementInventory3(httpClient) {
|
|
|
437
458
|
{ httpClient }
|
|
438
459
|
);
|
|
439
460
|
}
|
|
440
|
-
function getInventoryVariants3(httpClient) {
|
|
441
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
442
|
-
inventoryId,
|
|
443
|
-
options,
|
|
444
|
-
// @ts-ignore
|
|
445
|
-
{ httpClient }
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
function queryInventory3(httpClient) {
|
|
449
|
-
return (options) => queryInventory2(
|
|
450
|
-
options,
|
|
451
|
-
// @ts-ignore
|
|
452
|
-
{ httpClient }
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
461
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
456
462
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
457
463
|
false,
|
|
@@ -484,11 +490,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
484
490
|
// src/stores-v2-inventory-inventory.context.ts
|
|
485
491
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
486
492
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
493
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
494
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
487
495
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
488
496
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
489
497
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
490
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
491
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
492
498
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
493
499
|
onInventoryItemChanged
|
|
494
500
|
);
|