@wix/auto_sdk_stores_inventory 1.0.88 → 1.0.89
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
|
_: [
|
|
@@ -156,7 +133,84 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
156
133
|
};
|
|
157
134
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
158
135
|
}
|
|
136
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
137
|
+
const domainToMappings = {
|
|
138
|
+
"www.wixapis.com": [
|
|
139
|
+
{
|
|
140
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
141
|
+
destPath: "/v2/inventoryItems"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"api._api_base_domain_": [
|
|
145
|
+
{
|
|
146
|
+
srcPath: "/inventory-read-api-proxy",
|
|
147
|
+
destPath: ""
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
_: [
|
|
151
|
+
{
|
|
152
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
153
|
+
destPath: "/v2/inventoryItems"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
};
|
|
157
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
158
|
+
}
|
|
159
159
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
160
|
+
function getInventoryVariants(payload) {
|
|
161
|
+
function __getInventoryVariants({ host }) {
|
|
162
|
+
const metadata = {
|
|
163
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
164
|
+
method: "POST",
|
|
165
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
166
|
+
packageName: PACKAGE_NAME,
|
|
167
|
+
migrationOptions: {
|
|
168
|
+
optInTransformResponse: true
|
|
169
|
+
},
|
|
170
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
171
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
172
|
+
data: payload,
|
|
173
|
+
host
|
|
174
|
+
}),
|
|
175
|
+
data: payload,
|
|
176
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
177
|
+
{
|
|
178
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
179
|
+
paths: TRANSFORM_PATHS_0
|
|
180
|
+
}
|
|
181
|
+
])
|
|
182
|
+
};
|
|
183
|
+
return metadata;
|
|
184
|
+
}
|
|
185
|
+
return __getInventoryVariants;
|
|
186
|
+
}
|
|
187
|
+
function queryInventory(payload) {
|
|
188
|
+
function __queryInventory({ host }) {
|
|
189
|
+
const metadata = {
|
|
190
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
191
|
+
method: "POST",
|
|
192
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
193
|
+
packageName: PACKAGE_NAME,
|
|
194
|
+
migrationOptions: {
|
|
195
|
+
optInTransformResponse: true
|
|
196
|
+
},
|
|
197
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
198
|
+
protoPath: "/v2/inventoryItems/query",
|
|
199
|
+
data: payload,
|
|
200
|
+
host
|
|
201
|
+
}),
|
|
202
|
+
data: payload,
|
|
203
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
204
|
+
{
|
|
205
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
206
|
+
paths: TRANSFORM_PATHS_1
|
|
207
|
+
}
|
|
208
|
+
])
|
|
209
|
+
};
|
|
210
|
+
return metadata;
|
|
211
|
+
}
|
|
212
|
+
return __queryInventory;
|
|
213
|
+
}
|
|
160
214
|
function updateInventoryVariants(payload) {
|
|
161
215
|
function __updateInventoryVariants({ host }) {
|
|
162
216
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -226,60 +280,6 @@ function incrementInventory(payload) {
|
|
|
226
280
|
}
|
|
227
281
|
return __incrementInventory;
|
|
228
282
|
}
|
|
229
|
-
function getInventoryVariants(payload) {
|
|
230
|
-
function __getInventoryVariants({ host }) {
|
|
231
|
-
const metadata = {
|
|
232
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
233
|
-
method: "POST",
|
|
234
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
235
|
-
packageName: PACKAGE_NAME,
|
|
236
|
-
migrationOptions: {
|
|
237
|
-
optInTransformResponse: true
|
|
238
|
-
},
|
|
239
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
240
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
241
|
-
data: payload,
|
|
242
|
-
host
|
|
243
|
-
}),
|
|
244
|
-
data: payload,
|
|
245
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
246
|
-
{
|
|
247
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
248
|
-
paths: TRANSFORM_PATHS_0
|
|
249
|
-
}
|
|
250
|
-
])
|
|
251
|
-
};
|
|
252
|
-
return metadata;
|
|
253
|
-
}
|
|
254
|
-
return __getInventoryVariants;
|
|
255
|
-
}
|
|
256
|
-
function queryInventory(payload) {
|
|
257
|
-
function __queryInventory({ host }) {
|
|
258
|
-
const metadata = {
|
|
259
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
260
|
-
method: "POST",
|
|
261
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
262
|
-
packageName: PACKAGE_NAME,
|
|
263
|
-
migrationOptions: {
|
|
264
|
-
optInTransformResponse: true
|
|
265
|
-
},
|
|
266
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
267
|
-
protoPath: "/v2/inventoryItems/query",
|
|
268
|
-
data: payload,
|
|
269
|
-
host
|
|
270
|
-
}),
|
|
271
|
-
data: payload,
|
|
272
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
273
|
-
{
|
|
274
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
275
|
-
paths: TRANSFORM_PATHS_1
|
|
276
|
-
}
|
|
277
|
-
])
|
|
278
|
-
};
|
|
279
|
-
return metadata;
|
|
280
|
-
}
|
|
281
|
-
return __queryInventory;
|
|
282
|
-
}
|
|
283
283
|
|
|
284
284
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
285
285
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -297,60 +297,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
297
297
|
WebhookIdentityType2["APP"] = "APP";
|
|
298
298
|
return WebhookIdentityType2;
|
|
299
299
|
})(WebhookIdentityType || {});
|
|
300
|
-
async function
|
|
300
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
301
301
|
const { httpClient, sideEffects } = arguments[2];
|
|
302
302
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
303
|
-
|
|
303
|
+
inventoryId,
|
|
304
|
+
externalId: options?.externalId,
|
|
305
|
+
productId: options?.productId,
|
|
306
|
+
variantIds: options?.variantIds
|
|
304
307
|
});
|
|
305
|
-
const reqOpts =
|
|
308
|
+
const reqOpts = getInventoryVariants(payload);
|
|
306
309
|
sideEffects?.onSiteCall?.();
|
|
307
310
|
try {
|
|
308
311
|
const result = await httpClient.request(reqOpts);
|
|
309
312
|
sideEffects?.onSuccess?.(result);
|
|
313
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
310
314
|
} catch (err) {
|
|
311
315
|
const transformedError = (0, import_transform_error.transformError)(
|
|
312
316
|
err,
|
|
313
317
|
{
|
|
314
|
-
spreadPathsToArguments: {
|
|
315
|
-
explicitPathsToArguments: {
|
|
318
|
+
spreadPathsToArguments: {},
|
|
319
|
+
explicitPathsToArguments: {
|
|
320
|
+
inventoryId: "$[0]",
|
|
321
|
+
externalId: "$[1].externalId",
|
|
322
|
+
productId: "$[1].productId",
|
|
323
|
+
variantIds: "$[1].variantIds"
|
|
324
|
+
},
|
|
316
325
|
singleArgumentUnchanged: false
|
|
317
326
|
},
|
|
318
|
-
["
|
|
327
|
+
["inventoryId", "options"]
|
|
319
328
|
);
|
|
320
329
|
sideEffects?.onError?.(err);
|
|
321
330
|
throw transformedError;
|
|
322
331
|
}
|
|
323
332
|
}
|
|
324
|
-
async function
|
|
333
|
+
async function queryInventory2(options) {
|
|
325
334
|
const { httpClient, sideEffects } = arguments[1];
|
|
326
335
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
327
|
-
|
|
336
|
+
query: options?.query
|
|
328
337
|
});
|
|
329
|
-
const reqOpts =
|
|
338
|
+
const reqOpts = queryInventory(payload);
|
|
330
339
|
sideEffects?.onSiteCall?.();
|
|
331
340
|
try {
|
|
332
341
|
const result = await httpClient.request(reqOpts);
|
|
333
342
|
sideEffects?.onSuccess?.(result);
|
|
343
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
334
344
|
} catch (err) {
|
|
335
345
|
const transformedError = (0, import_transform_error.transformError)(
|
|
336
346
|
err,
|
|
337
347
|
{
|
|
338
348
|
spreadPathsToArguments: {},
|
|
339
|
-
explicitPathsToArguments: {
|
|
349
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
340
350
|
singleArgumentUnchanged: false
|
|
341
351
|
},
|
|
342
|
-
["
|
|
352
|
+
["options"]
|
|
343
353
|
);
|
|
344
354
|
sideEffects?.onError?.(err);
|
|
345
355
|
throw transformedError;
|
|
346
356
|
}
|
|
347
357
|
}
|
|
348
|
-
async function
|
|
349
|
-
const { httpClient, sideEffects } = arguments[
|
|
358
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
359
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
350
360
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
351
|
-
|
|
361
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
352
362
|
});
|
|
353
|
-
const reqOpts =
|
|
363
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
354
364
|
sideEffects?.onSiteCall?.();
|
|
355
365
|
try {
|
|
356
366
|
const result = await httpClient.request(reqOpts);
|
|
@@ -359,69 +369,59 @@ async function incrementInventory2(incrementData) {
|
|
|
359
369
|
const transformedError = (0, import_transform_error.transformError)(
|
|
360
370
|
err,
|
|
361
371
|
{
|
|
362
|
-
spreadPathsToArguments: {},
|
|
363
|
-
explicitPathsToArguments: {
|
|
372
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
373
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
364
374
|
singleArgumentUnchanged: false
|
|
365
375
|
},
|
|
366
|
-
["
|
|
376
|
+
["productId", "inventoryItem"]
|
|
367
377
|
);
|
|
368
378
|
sideEffects?.onError?.(err);
|
|
369
379
|
throw transformedError;
|
|
370
380
|
}
|
|
371
381
|
}
|
|
372
|
-
async function
|
|
373
|
-
const { httpClient, sideEffects } = arguments[
|
|
382
|
+
async function decrementInventory2(decrementData) {
|
|
383
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
374
384
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
375
|
-
|
|
376
|
-
externalId: options?.externalId,
|
|
377
|
-
productId: options?.productId,
|
|
378
|
-
variantIds: options?.variantIds
|
|
385
|
+
decrementData
|
|
379
386
|
});
|
|
380
|
-
const reqOpts =
|
|
387
|
+
const reqOpts = decrementInventory(payload);
|
|
381
388
|
sideEffects?.onSiteCall?.();
|
|
382
389
|
try {
|
|
383
390
|
const result = await httpClient.request(reqOpts);
|
|
384
391
|
sideEffects?.onSuccess?.(result);
|
|
385
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
386
392
|
} catch (err) {
|
|
387
393
|
const transformedError = (0, import_transform_error.transformError)(
|
|
388
394
|
err,
|
|
389
395
|
{
|
|
390
396
|
spreadPathsToArguments: {},
|
|
391
|
-
explicitPathsToArguments: {
|
|
392
|
-
inventoryId: "$[0]",
|
|
393
|
-
externalId: "$[1].externalId",
|
|
394
|
-
productId: "$[1].productId",
|
|
395
|
-
variantIds: "$[1].variantIds"
|
|
396
|
-
},
|
|
397
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
397
398
|
singleArgumentUnchanged: false
|
|
398
399
|
},
|
|
399
|
-
["
|
|
400
|
+
["decrementData"]
|
|
400
401
|
);
|
|
401
402
|
sideEffects?.onError?.(err);
|
|
402
403
|
throw transformedError;
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
|
-
async function
|
|
406
|
+
async function incrementInventory2(incrementData) {
|
|
406
407
|
const { httpClient, sideEffects } = arguments[1];
|
|
407
408
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
408
|
-
|
|
409
|
+
incrementData
|
|
409
410
|
});
|
|
410
|
-
const reqOpts =
|
|
411
|
+
const reqOpts = incrementInventory(payload);
|
|
411
412
|
sideEffects?.onSiteCall?.();
|
|
412
413
|
try {
|
|
413
414
|
const result = await httpClient.request(reqOpts);
|
|
414
415
|
sideEffects?.onSuccess?.(result);
|
|
415
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
416
416
|
} catch (err) {
|
|
417
417
|
const transformedError = (0, import_transform_error.transformError)(
|
|
418
418
|
err,
|
|
419
419
|
{
|
|
420
420
|
spreadPathsToArguments: {},
|
|
421
|
-
explicitPathsToArguments: {
|
|
421
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
422
422
|
singleArgumentUnchanged: false
|
|
423
423
|
},
|
|
424
|
-
["
|
|
424
|
+
["incrementData"]
|
|
425
425
|
);
|
|
426
426
|
sideEffects?.onError?.(err);
|
|
427
427
|
throw transformedError;
|
|
@@ -431,6 +431,21 @@ async function queryInventory2(options) {
|
|
|
431
431
|
// src/stores-v2-inventory-inventory.public.ts
|
|
432
432
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
433
433
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
434
|
+
function getInventoryVariants3(httpClient) {
|
|
435
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
436
|
+
inventoryId,
|
|
437
|
+
options,
|
|
438
|
+
// @ts-ignore
|
|
439
|
+
{ httpClient }
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
function queryInventory3(httpClient) {
|
|
443
|
+
return (options) => queryInventory2(
|
|
444
|
+
options,
|
|
445
|
+
// @ts-ignore
|
|
446
|
+
{ httpClient }
|
|
447
|
+
);
|
|
448
|
+
}
|
|
434
449
|
function updateInventoryVariants3(httpClient) {
|
|
435
450
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
436
451
|
productId,
|
|
@@ -453,21 +468,6 @@ function incrementInventory3(httpClient) {
|
|
|
453
468
|
{ httpClient }
|
|
454
469
|
);
|
|
455
470
|
}
|
|
456
|
-
function getInventoryVariants3(httpClient) {
|
|
457
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
458
|
-
inventoryId,
|
|
459
|
-
options,
|
|
460
|
-
// @ts-ignore
|
|
461
|
-
{ httpClient }
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
function queryInventory3(httpClient) {
|
|
465
|
-
return (options) => queryInventory2(
|
|
466
|
-
options,
|
|
467
|
-
// @ts-ignore
|
|
468
|
-
{ httpClient }
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
471
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
472
472
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
473
473
|
false,
|
|
@@ -500,11 +500,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
500
500
|
// src/stores-v2-inventory-inventory.context.ts
|
|
501
501
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
502
502
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
503
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
504
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
503
505
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
504
506
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
505
507
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
506
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
507
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
508
508
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
509
509
|
onInventoryItemChanged
|
|
510
510
|
);
|