@wix/auto_sdk_stores_inventory 1.0.93 → 1.0.94
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 +133 -133
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +116 -116
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +102 -102
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +133 -133
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +116 -116
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +102 -102
- 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,29 +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
|
-
"www.wixapis.com": [
|
|
56
|
-
{
|
|
57
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
58
|
-
destPath: "/v2/inventoryItems"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"api._api_base_domain_": [
|
|
62
|
-
{
|
|
63
|
-
srcPath: "/inventory-read-api-proxy",
|
|
64
|
-
destPath: ""
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
_: [
|
|
68
|
-
{
|
|
69
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
70
|
-
destPath: "/v2/inventoryItems"
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
};
|
|
74
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
75
|
-
}
|
|
76
53
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
77
54
|
const domainToMappings = {
|
|
78
55
|
_: [
|
|
@@ -174,7 +151,84 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
174
151
|
};
|
|
175
152
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
176
153
|
}
|
|
154
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
155
|
+
const domainToMappings = {
|
|
156
|
+
"www.wixapis.com": [
|
|
157
|
+
{
|
|
158
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
159
|
+
destPath: "/v2/inventoryItems"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"api._api_base_domain_": [
|
|
163
|
+
{
|
|
164
|
+
srcPath: "/inventory-read-api-proxy",
|
|
165
|
+
destPath: ""
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
_: [
|
|
169
|
+
{
|
|
170
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
171
|
+
destPath: "/v2/inventoryItems"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
};
|
|
175
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
176
|
+
}
|
|
177
177
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
178
|
+
function getInventoryVariants(payload) {
|
|
179
|
+
function __getInventoryVariants({ host }) {
|
|
180
|
+
const metadata = {
|
|
181
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
182
|
+
method: "POST",
|
|
183
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
184
|
+
packageName: PACKAGE_NAME,
|
|
185
|
+
migrationOptions: {
|
|
186
|
+
optInTransformResponse: true
|
|
187
|
+
},
|
|
188
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
189
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
190
|
+
data: payload,
|
|
191
|
+
host
|
|
192
|
+
}),
|
|
193
|
+
data: payload,
|
|
194
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
195
|
+
{
|
|
196
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
197
|
+
paths: TRANSFORM_PATHS_0
|
|
198
|
+
}
|
|
199
|
+
])
|
|
200
|
+
};
|
|
201
|
+
return metadata;
|
|
202
|
+
}
|
|
203
|
+
return __getInventoryVariants;
|
|
204
|
+
}
|
|
205
|
+
function queryInventory(payload) {
|
|
206
|
+
function __queryInventory({ host }) {
|
|
207
|
+
const metadata = {
|
|
208
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
209
|
+
method: "POST",
|
|
210
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
211
|
+
packageName: PACKAGE_NAME,
|
|
212
|
+
migrationOptions: {
|
|
213
|
+
optInTransformResponse: true
|
|
214
|
+
},
|
|
215
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
216
|
+
protoPath: "/v2/inventoryItems/query",
|
|
217
|
+
data: payload,
|
|
218
|
+
host
|
|
219
|
+
}),
|
|
220
|
+
data: payload,
|
|
221
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
222
|
+
{
|
|
223
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
224
|
+
paths: TRANSFORM_PATHS_1
|
|
225
|
+
}
|
|
226
|
+
])
|
|
227
|
+
};
|
|
228
|
+
return metadata;
|
|
229
|
+
}
|
|
230
|
+
return __queryInventory;
|
|
231
|
+
}
|
|
178
232
|
function updateInventoryVariants(payload) {
|
|
179
233
|
function __updateInventoryVariants({ host }) {
|
|
180
234
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -244,60 +298,6 @@ function incrementInventory(payload) {
|
|
|
244
298
|
}
|
|
245
299
|
return __incrementInventory;
|
|
246
300
|
}
|
|
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
|
-
migrationOptions: {
|
|
255
|
-
optInTransformResponse: true
|
|
256
|
-
},
|
|
257
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
258
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
259
|
-
data: payload,
|
|
260
|
-
host
|
|
261
|
-
}),
|
|
262
|
-
data: payload,
|
|
263
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
264
|
-
{
|
|
265
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
266
|
-
paths: TRANSFORM_PATHS_0
|
|
267
|
-
}
|
|
268
|
-
])
|
|
269
|
-
};
|
|
270
|
-
return metadata;
|
|
271
|
-
}
|
|
272
|
-
return __getInventoryVariants;
|
|
273
|
-
}
|
|
274
|
-
function queryInventory(payload) {
|
|
275
|
-
function __queryInventory({ host }) {
|
|
276
|
-
const metadata = {
|
|
277
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
278
|
-
method: "POST",
|
|
279
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
280
|
-
packageName: PACKAGE_NAME,
|
|
281
|
-
migrationOptions: {
|
|
282
|
-
optInTransformResponse: true
|
|
283
|
-
},
|
|
284
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
285
|
-
protoPath: "/v2/inventoryItems/query",
|
|
286
|
-
data: payload,
|
|
287
|
-
host
|
|
288
|
-
}),
|
|
289
|
-
data: payload,
|
|
290
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
291
|
-
{
|
|
292
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
293
|
-
paths: TRANSFORM_PATHS_1
|
|
294
|
-
}
|
|
295
|
-
])
|
|
296
|
-
};
|
|
297
|
-
return metadata;
|
|
298
|
-
}
|
|
299
|
-
return __queryInventory;
|
|
300
|
-
}
|
|
301
301
|
|
|
302
302
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
303
303
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -315,60 +315,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
315
315
|
WebhookIdentityType2["APP"] = "APP";
|
|
316
316
|
return WebhookIdentityType2;
|
|
317
317
|
})(WebhookIdentityType || {});
|
|
318
|
-
async function
|
|
318
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
319
319
|
const { httpClient, sideEffects } = arguments[2];
|
|
320
320
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
321
|
-
|
|
321
|
+
inventoryId,
|
|
322
|
+
externalId: options?.externalId,
|
|
323
|
+
productId: options?.productId,
|
|
324
|
+
variantIds: options?.variantIds
|
|
322
325
|
});
|
|
323
|
-
const reqOpts =
|
|
326
|
+
const reqOpts = getInventoryVariants(payload);
|
|
324
327
|
sideEffects?.onSiteCall?.();
|
|
325
328
|
try {
|
|
326
329
|
const result = await httpClient.request(reqOpts);
|
|
327
330
|
sideEffects?.onSuccess?.(result);
|
|
331
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
328
332
|
} catch (err) {
|
|
329
333
|
const transformedError = (0, import_transform_error.transformError)(
|
|
330
334
|
err,
|
|
331
335
|
{
|
|
332
|
-
spreadPathsToArguments: {
|
|
333
|
-
explicitPathsToArguments: {
|
|
336
|
+
spreadPathsToArguments: {},
|
|
337
|
+
explicitPathsToArguments: {
|
|
338
|
+
inventoryId: "$[0]",
|
|
339
|
+
externalId: "$[1].externalId",
|
|
340
|
+
productId: "$[1].productId",
|
|
341
|
+
variantIds: "$[1].variantIds"
|
|
342
|
+
},
|
|
334
343
|
singleArgumentUnchanged: false
|
|
335
344
|
},
|
|
336
|
-
["
|
|
345
|
+
["inventoryId", "options"]
|
|
337
346
|
);
|
|
338
347
|
sideEffects?.onError?.(err);
|
|
339
348
|
throw transformedError;
|
|
340
349
|
}
|
|
341
350
|
}
|
|
342
|
-
async function
|
|
351
|
+
async function queryInventory2(options) {
|
|
343
352
|
const { httpClient, sideEffects } = arguments[1];
|
|
344
353
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
345
|
-
|
|
354
|
+
query: options?.query
|
|
346
355
|
});
|
|
347
|
-
const reqOpts =
|
|
356
|
+
const reqOpts = queryInventory(payload);
|
|
348
357
|
sideEffects?.onSiteCall?.();
|
|
349
358
|
try {
|
|
350
359
|
const result = await httpClient.request(reqOpts);
|
|
351
360
|
sideEffects?.onSuccess?.(result);
|
|
361
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
352
362
|
} catch (err) {
|
|
353
363
|
const transformedError = (0, import_transform_error.transformError)(
|
|
354
364
|
err,
|
|
355
365
|
{
|
|
356
366
|
spreadPathsToArguments: {},
|
|
357
|
-
explicitPathsToArguments: {
|
|
367
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
358
368
|
singleArgumentUnchanged: false
|
|
359
369
|
},
|
|
360
|
-
["
|
|
370
|
+
["options"]
|
|
361
371
|
);
|
|
362
372
|
sideEffects?.onError?.(err);
|
|
363
373
|
throw transformedError;
|
|
364
374
|
}
|
|
365
375
|
}
|
|
366
|
-
async function
|
|
367
|
-
const { httpClient, sideEffects } = arguments[
|
|
376
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
377
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
368
378
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
369
|
-
|
|
379
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
370
380
|
});
|
|
371
|
-
const reqOpts =
|
|
381
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
372
382
|
sideEffects?.onSiteCall?.();
|
|
373
383
|
try {
|
|
374
384
|
const result = await httpClient.request(reqOpts);
|
|
@@ -377,69 +387,59 @@ async function incrementInventory2(incrementData) {
|
|
|
377
387
|
const transformedError = (0, import_transform_error.transformError)(
|
|
378
388
|
err,
|
|
379
389
|
{
|
|
380
|
-
spreadPathsToArguments: {},
|
|
381
|
-
explicitPathsToArguments: {
|
|
390
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
391
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
382
392
|
singleArgumentUnchanged: false
|
|
383
393
|
},
|
|
384
|
-
["
|
|
394
|
+
["productId", "inventoryItem"]
|
|
385
395
|
);
|
|
386
396
|
sideEffects?.onError?.(err);
|
|
387
397
|
throw transformedError;
|
|
388
398
|
}
|
|
389
399
|
}
|
|
390
|
-
async function
|
|
391
|
-
const { httpClient, sideEffects } = arguments[
|
|
400
|
+
async function decrementInventory2(decrementData) {
|
|
401
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
392
402
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
393
|
-
|
|
394
|
-
externalId: options?.externalId,
|
|
395
|
-
productId: options?.productId,
|
|
396
|
-
variantIds: options?.variantIds
|
|
403
|
+
decrementData
|
|
397
404
|
});
|
|
398
|
-
const reqOpts =
|
|
405
|
+
const reqOpts = decrementInventory(payload);
|
|
399
406
|
sideEffects?.onSiteCall?.();
|
|
400
407
|
try {
|
|
401
408
|
const result = await httpClient.request(reqOpts);
|
|
402
409
|
sideEffects?.onSuccess?.(result);
|
|
403
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
404
410
|
} catch (err) {
|
|
405
411
|
const transformedError = (0, import_transform_error.transformError)(
|
|
406
412
|
err,
|
|
407
413
|
{
|
|
408
414
|
spreadPathsToArguments: {},
|
|
409
|
-
explicitPathsToArguments: {
|
|
410
|
-
inventoryId: "$[0]",
|
|
411
|
-
externalId: "$[1].externalId",
|
|
412
|
-
productId: "$[1].productId",
|
|
413
|
-
variantIds: "$[1].variantIds"
|
|
414
|
-
},
|
|
415
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
415
416
|
singleArgumentUnchanged: false
|
|
416
417
|
},
|
|
417
|
-
["
|
|
418
|
+
["decrementData"]
|
|
418
419
|
);
|
|
419
420
|
sideEffects?.onError?.(err);
|
|
420
421
|
throw transformedError;
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
|
-
async function
|
|
424
|
+
async function incrementInventory2(incrementData) {
|
|
424
425
|
const { httpClient, sideEffects } = arguments[1];
|
|
425
426
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
426
|
-
|
|
427
|
+
incrementData
|
|
427
428
|
});
|
|
428
|
-
const reqOpts =
|
|
429
|
+
const reqOpts = incrementInventory(payload);
|
|
429
430
|
sideEffects?.onSiteCall?.();
|
|
430
431
|
try {
|
|
431
432
|
const result = await httpClient.request(reqOpts);
|
|
432
433
|
sideEffects?.onSuccess?.(result);
|
|
433
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
434
434
|
} catch (err) {
|
|
435
435
|
const transformedError = (0, import_transform_error.transformError)(
|
|
436
436
|
err,
|
|
437
437
|
{
|
|
438
438
|
spreadPathsToArguments: {},
|
|
439
|
-
explicitPathsToArguments: {
|
|
439
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
440
440
|
singleArgumentUnchanged: false
|
|
441
441
|
},
|
|
442
|
-
["
|
|
442
|
+
["incrementData"]
|
|
443
443
|
);
|
|
444
444
|
sideEffects?.onError?.(err);
|
|
445
445
|
throw transformedError;
|
|
@@ -449,6 +449,21 @@ async function queryInventory2(options) {
|
|
|
449
449
|
// src/stores-v2-inventory-inventory.public.ts
|
|
450
450
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
451
451
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
452
|
+
function getInventoryVariants3(httpClient) {
|
|
453
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
454
|
+
inventoryId,
|
|
455
|
+
options,
|
|
456
|
+
// @ts-ignore
|
|
457
|
+
{ httpClient }
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
function queryInventory3(httpClient) {
|
|
461
|
+
return (options) => queryInventory2(
|
|
462
|
+
options,
|
|
463
|
+
// @ts-ignore
|
|
464
|
+
{ httpClient }
|
|
465
|
+
);
|
|
466
|
+
}
|
|
452
467
|
function updateInventoryVariants3(httpClient) {
|
|
453
468
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
454
469
|
productId,
|
|
@@ -471,21 +486,6 @@ function incrementInventory3(httpClient) {
|
|
|
471
486
|
{ httpClient }
|
|
472
487
|
);
|
|
473
488
|
}
|
|
474
|
-
function getInventoryVariants3(httpClient) {
|
|
475
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
476
|
-
inventoryId,
|
|
477
|
-
options,
|
|
478
|
-
// @ts-ignore
|
|
479
|
-
{ httpClient }
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
function queryInventory3(httpClient) {
|
|
483
|
-
return (options) => queryInventory2(
|
|
484
|
-
options,
|
|
485
|
-
// @ts-ignore
|
|
486
|
-
{ httpClient }
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
489
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
490
490
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
491
491
|
false,
|
|
@@ -518,11 +518,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
518
518
|
// src/stores-v2-inventory-inventory.context.ts
|
|
519
519
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
520
520
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
521
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
522
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
521
523
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
522
524
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
523
525
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
524
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
525
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
526
526
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
527
527
|
onInventoryItemChanged
|
|
528
528
|
);
|