@wix/auto_sdk_stores_inventory 1.0.86 → 1.0.88
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 +137 -127
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +120 -110
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +106 -96
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +137 -127
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +120 -110
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +106 -96
- 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,25 +1,7 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
2
|
+
import { UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, 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
|
-
}
|
|
23
5
|
declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
|
|
24
6
|
interface UpdateInventoryVariantsSignature {
|
|
25
7
|
/**
|
|
@@ -54,14 +36,32 @@ interface IncrementInventorySignature {
|
|
|
54
36
|
*/
|
|
55
37
|
(incrementData: IncrementData[]): Promise<void>;
|
|
56
38
|
}
|
|
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>;
|
|
62
60
|
declare const updateInventoryVariants: MaybeContext<BuildRESTFunction<typeof updateInventoryVariants$1> & typeof updateInventoryVariants$1>;
|
|
63
61
|
declare const decrementInventory: MaybeContext<BuildRESTFunction<typeof decrementInventory$1> & typeof decrementInventory$1>;
|
|
64
62
|
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,6 +50,29 @@ 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
|
+
}
|
|
53
76
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
54
77
|
const domainToMappings = {
|
|
55
78
|
_: [
|
|
@@ -73,6 +96,10 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
73
96
|
srcPath: "/stores/v1/products",
|
|
74
97
|
destPath: "/v1/products"
|
|
75
98
|
},
|
|
99
|
+
{
|
|
100
|
+
srcPath: "/stores/v2/inventoryItems",
|
|
101
|
+
destPath: "/v2/inventoryItems"
|
|
102
|
+
},
|
|
76
103
|
{
|
|
77
104
|
srcPath: "/stores/v1/variants",
|
|
78
105
|
destPath: "/v1/variants"
|
|
@@ -129,78 +156,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
129
156
|
};
|
|
130
157
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
131
158
|
}
|
|
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
|
-
}
|
|
149
159
|
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
|
-
}
|
|
204
160
|
function updateInventoryVariants(payload) {
|
|
205
161
|
function __updateInventoryVariants({ host }) {
|
|
206
162
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -270,6 +226,60 @@ function incrementInventory(payload) {
|
|
|
270
226
|
}
|
|
271
227
|
return __incrementInventory;
|
|
272
228
|
}
|
|
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
|
+
}
|
|
273
283
|
|
|
274
284
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
275
285
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -287,70 +297,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
287
297
|
WebhookIdentityType2["APP"] = "APP";
|
|
288
298
|
return WebhookIdentityType2;
|
|
289
299
|
})(WebhookIdentityType || {});
|
|
290
|
-
async function
|
|
300
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
291
301
|
const { httpClient, sideEffects } = arguments[2];
|
|
292
302
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
293
|
-
|
|
294
|
-
externalId: options?.externalId,
|
|
295
|
-
productId: options?.productId,
|
|
296
|
-
variantIds: options?.variantIds
|
|
303
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
297
304
|
});
|
|
298
|
-
const reqOpts =
|
|
305
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
299
306
|
sideEffects?.onSiteCall?.();
|
|
300
307
|
try {
|
|
301
308
|
const result = await httpClient.request(reqOpts);
|
|
302
309
|
sideEffects?.onSuccess?.(result);
|
|
303
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
304
310
|
} catch (err) {
|
|
305
311
|
const transformedError = (0, import_transform_error.transformError)(
|
|
306
312
|
err,
|
|
307
313
|
{
|
|
308
|
-
spreadPathsToArguments: {},
|
|
309
|
-
explicitPathsToArguments: {
|
|
310
|
-
inventoryId: "$[0]",
|
|
311
|
-
externalId: "$[1].externalId",
|
|
312
|
-
productId: "$[1].productId",
|
|
313
|
-
variantIds: "$[1].variantIds"
|
|
314
|
-
},
|
|
314
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
315
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
315
316
|
singleArgumentUnchanged: false
|
|
316
317
|
},
|
|
317
|
-
["
|
|
318
|
+
["productId", "inventoryItem"]
|
|
318
319
|
);
|
|
319
320
|
sideEffects?.onError?.(err);
|
|
320
321
|
throw transformedError;
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
|
-
async function
|
|
324
|
+
async function decrementInventory2(decrementData) {
|
|
324
325
|
const { httpClient, sideEffects } = arguments[1];
|
|
325
326
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
326
|
-
|
|
327
|
+
decrementData
|
|
327
328
|
});
|
|
328
|
-
const reqOpts =
|
|
329
|
+
const reqOpts = decrementInventory(payload);
|
|
329
330
|
sideEffects?.onSiteCall?.();
|
|
330
331
|
try {
|
|
331
332
|
const result = await httpClient.request(reqOpts);
|
|
332
333
|
sideEffects?.onSuccess?.(result);
|
|
333
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
334
334
|
} catch (err) {
|
|
335
335
|
const transformedError = (0, import_transform_error.transformError)(
|
|
336
336
|
err,
|
|
337
337
|
{
|
|
338
338
|
spreadPathsToArguments: {},
|
|
339
|
-
explicitPathsToArguments: {
|
|
339
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
340
340
|
singleArgumentUnchanged: false
|
|
341
341
|
},
|
|
342
|
-
["
|
|
342
|
+
["decrementData"]
|
|
343
343
|
);
|
|
344
344
|
sideEffects?.onError?.(err);
|
|
345
345
|
throw transformedError;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
async function
|
|
349
|
-
const { httpClient, sideEffects } = arguments[
|
|
348
|
+
async function incrementInventory2(incrementData) {
|
|
349
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
350
350
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
351
|
-
|
|
351
|
+
incrementData
|
|
352
352
|
});
|
|
353
|
-
const reqOpts =
|
|
353
|
+
const reqOpts = incrementInventory(payload);
|
|
354
354
|
sideEffects?.onSiteCall?.();
|
|
355
355
|
try {
|
|
356
356
|
const result = await httpClient.request(reqOpts);
|
|
@@ -359,59 +359,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
359
359
|
const transformedError = (0, import_transform_error.transformError)(
|
|
360
360
|
err,
|
|
361
361
|
{
|
|
362
|
-
spreadPathsToArguments: {
|
|
363
|
-
explicitPathsToArguments: {
|
|
362
|
+
spreadPathsToArguments: {},
|
|
363
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
364
364
|
singleArgumentUnchanged: false
|
|
365
365
|
},
|
|
366
|
-
["
|
|
366
|
+
["incrementData"]
|
|
367
367
|
);
|
|
368
368
|
sideEffects?.onError?.(err);
|
|
369
369
|
throw transformedError;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
async function
|
|
373
|
-
const { httpClient, sideEffects } = arguments[
|
|
372
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
373
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
374
374
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
375
|
-
|
|
375
|
+
inventoryId,
|
|
376
|
+
externalId: options?.externalId,
|
|
377
|
+
productId: options?.productId,
|
|
378
|
+
variantIds: options?.variantIds
|
|
376
379
|
});
|
|
377
|
-
const reqOpts =
|
|
380
|
+
const reqOpts = getInventoryVariants(payload);
|
|
378
381
|
sideEffects?.onSiteCall?.();
|
|
379
382
|
try {
|
|
380
383
|
const result = await httpClient.request(reqOpts);
|
|
381
384
|
sideEffects?.onSuccess?.(result);
|
|
385
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
382
386
|
} catch (err) {
|
|
383
387
|
const transformedError = (0, import_transform_error.transformError)(
|
|
384
388
|
err,
|
|
385
389
|
{
|
|
386
390
|
spreadPathsToArguments: {},
|
|
387
|
-
explicitPathsToArguments: {
|
|
391
|
+
explicitPathsToArguments: {
|
|
392
|
+
inventoryId: "$[0]",
|
|
393
|
+
externalId: "$[1].externalId",
|
|
394
|
+
productId: "$[1].productId",
|
|
395
|
+
variantIds: "$[1].variantIds"
|
|
396
|
+
},
|
|
388
397
|
singleArgumentUnchanged: false
|
|
389
398
|
},
|
|
390
|
-
["
|
|
399
|
+
["inventoryId", "options"]
|
|
391
400
|
);
|
|
392
401
|
sideEffects?.onError?.(err);
|
|
393
402
|
throw transformedError;
|
|
394
403
|
}
|
|
395
404
|
}
|
|
396
|
-
async function
|
|
405
|
+
async function queryInventory2(options) {
|
|
397
406
|
const { httpClient, sideEffects } = arguments[1];
|
|
398
407
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
399
|
-
|
|
408
|
+
query: options?.query
|
|
400
409
|
});
|
|
401
|
-
const reqOpts =
|
|
410
|
+
const reqOpts = queryInventory(payload);
|
|
402
411
|
sideEffects?.onSiteCall?.();
|
|
403
412
|
try {
|
|
404
413
|
const result = await httpClient.request(reqOpts);
|
|
405
414
|
sideEffects?.onSuccess?.(result);
|
|
415
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
406
416
|
} catch (err) {
|
|
407
417
|
const transformedError = (0, import_transform_error.transformError)(
|
|
408
418
|
err,
|
|
409
419
|
{
|
|
410
420
|
spreadPathsToArguments: {},
|
|
411
|
-
explicitPathsToArguments: {
|
|
421
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
412
422
|
singleArgumentUnchanged: false
|
|
413
423
|
},
|
|
414
|
-
["
|
|
424
|
+
["options"]
|
|
415
425
|
);
|
|
416
426
|
sideEffects?.onError?.(err);
|
|
417
427
|
throw transformedError;
|
|
@@ -421,21 +431,6 @@ async function incrementInventory2(incrementData) {
|
|
|
421
431
|
// src/stores-v2-inventory-inventory.public.ts
|
|
422
432
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
423
433
|
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
|
-
}
|
|
439
434
|
function updateInventoryVariants3(httpClient) {
|
|
440
435
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
441
436
|
productId,
|
|
@@ -458,6 +453,21 @@ function incrementInventory3(httpClient) {
|
|
|
458
453
|
{ httpClient }
|
|
459
454
|
);
|
|
460
455
|
}
|
|
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
|
+
}
|
|
461
471
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
462
472
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
463
473
|
false,
|
|
@@ -490,11 +500,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
490
500
|
// src/stores-v2-inventory-inventory.context.ts
|
|
491
501
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
492
502
|
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);
|
|
495
503
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
496
504
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
497
505
|
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);
|
|
498
508
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
499
509
|
onInventoryItemChanged
|
|
500
510
|
);
|