@wix/auto_sdk_stores_inventory 1.0.91 → 1.0.92
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,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
|
_: [
|
|
@@ -133,84 +156,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
133
156
|
};
|
|
134
157
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
135
158
|
}
|
|
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
|
-
}
|
|
214
160
|
function updateInventoryVariants(payload) {
|
|
215
161
|
function __updateInventoryVariants({ host }) {
|
|
216
162
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -280,6 +226,60 @@ function incrementInventory(payload) {
|
|
|
280
226
|
}
|
|
281
227
|
return __incrementInventory;
|
|
282
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
|
+
}
|
|
283
283
|
|
|
284
284
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
285
285
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -297,70 +297,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
297
297
|
WebhookIdentityType2["APP"] = "APP";
|
|
298
298
|
return WebhookIdentityType2;
|
|
299
299
|
})(WebhookIdentityType || {});
|
|
300
|
-
async function
|
|
300
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
301
301
|
const { httpClient, sideEffects } = arguments[2];
|
|
302
302
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
303
|
-
|
|
304
|
-
externalId: options?.externalId,
|
|
305
|
-
productId: options?.productId,
|
|
306
|
-
variantIds: options?.variantIds
|
|
303
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
307
304
|
});
|
|
308
|
-
const reqOpts =
|
|
305
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
309
306
|
sideEffects?.onSiteCall?.();
|
|
310
307
|
try {
|
|
311
308
|
const result = await httpClient.request(reqOpts);
|
|
312
309
|
sideEffects?.onSuccess?.(result);
|
|
313
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
314
310
|
} catch (err) {
|
|
315
311
|
const transformedError = (0, import_transform_error.transformError)(
|
|
316
312
|
err,
|
|
317
313
|
{
|
|
318
|
-
spreadPathsToArguments: {},
|
|
319
|
-
explicitPathsToArguments: {
|
|
320
|
-
inventoryId: "$[0]",
|
|
321
|
-
externalId: "$[1].externalId",
|
|
322
|
-
productId: "$[1].productId",
|
|
323
|
-
variantIds: "$[1].variantIds"
|
|
324
|
-
},
|
|
314
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
315
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
325
316
|
singleArgumentUnchanged: false
|
|
326
317
|
},
|
|
327
|
-
["
|
|
318
|
+
["productId", "inventoryItem"]
|
|
328
319
|
);
|
|
329
320
|
sideEffects?.onError?.(err);
|
|
330
321
|
throw transformedError;
|
|
331
322
|
}
|
|
332
323
|
}
|
|
333
|
-
async function
|
|
324
|
+
async function decrementInventory2(decrementData) {
|
|
334
325
|
const { httpClient, sideEffects } = arguments[1];
|
|
335
326
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
336
|
-
|
|
327
|
+
decrementData
|
|
337
328
|
});
|
|
338
|
-
const reqOpts =
|
|
329
|
+
const reqOpts = decrementInventory(payload);
|
|
339
330
|
sideEffects?.onSiteCall?.();
|
|
340
331
|
try {
|
|
341
332
|
const result = await httpClient.request(reqOpts);
|
|
342
333
|
sideEffects?.onSuccess?.(result);
|
|
343
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
344
334
|
} catch (err) {
|
|
345
335
|
const transformedError = (0, import_transform_error.transformError)(
|
|
346
336
|
err,
|
|
347
337
|
{
|
|
348
338
|
spreadPathsToArguments: {},
|
|
349
|
-
explicitPathsToArguments: {
|
|
339
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
350
340
|
singleArgumentUnchanged: false
|
|
351
341
|
},
|
|
352
|
-
["
|
|
342
|
+
["decrementData"]
|
|
353
343
|
);
|
|
354
344
|
sideEffects?.onError?.(err);
|
|
355
345
|
throw transformedError;
|
|
356
346
|
}
|
|
357
347
|
}
|
|
358
|
-
async function
|
|
359
|
-
const { httpClient, sideEffects } = arguments[
|
|
348
|
+
async function incrementInventory2(incrementData) {
|
|
349
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
360
350
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
361
|
-
|
|
351
|
+
incrementData
|
|
362
352
|
});
|
|
363
|
-
const reqOpts =
|
|
353
|
+
const reqOpts = incrementInventory(payload);
|
|
364
354
|
sideEffects?.onSiteCall?.();
|
|
365
355
|
try {
|
|
366
356
|
const result = await httpClient.request(reqOpts);
|
|
@@ -369,59 +359,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
369
359
|
const transformedError = (0, import_transform_error.transformError)(
|
|
370
360
|
err,
|
|
371
361
|
{
|
|
372
|
-
spreadPathsToArguments: {
|
|
373
|
-
explicitPathsToArguments: {
|
|
362
|
+
spreadPathsToArguments: {},
|
|
363
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
374
364
|
singleArgumentUnchanged: false
|
|
375
365
|
},
|
|
376
|
-
["
|
|
366
|
+
["incrementData"]
|
|
377
367
|
);
|
|
378
368
|
sideEffects?.onError?.(err);
|
|
379
369
|
throw transformedError;
|
|
380
370
|
}
|
|
381
371
|
}
|
|
382
|
-
async function
|
|
383
|
-
const { httpClient, sideEffects } = arguments[
|
|
372
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
373
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
384
374
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
385
|
-
|
|
375
|
+
inventoryId,
|
|
376
|
+
externalId: options?.externalId,
|
|
377
|
+
productId: options?.productId,
|
|
378
|
+
variantIds: options?.variantIds
|
|
386
379
|
});
|
|
387
|
-
const reqOpts =
|
|
380
|
+
const reqOpts = getInventoryVariants(payload);
|
|
388
381
|
sideEffects?.onSiteCall?.();
|
|
389
382
|
try {
|
|
390
383
|
const result = await httpClient.request(reqOpts);
|
|
391
384
|
sideEffects?.onSuccess?.(result);
|
|
385
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
392
386
|
} catch (err) {
|
|
393
387
|
const transformedError = (0, import_transform_error.transformError)(
|
|
394
388
|
err,
|
|
395
389
|
{
|
|
396
390
|
spreadPathsToArguments: {},
|
|
397
|
-
explicitPathsToArguments: {
|
|
391
|
+
explicitPathsToArguments: {
|
|
392
|
+
inventoryId: "$[0]",
|
|
393
|
+
externalId: "$[1].externalId",
|
|
394
|
+
productId: "$[1].productId",
|
|
395
|
+
variantIds: "$[1].variantIds"
|
|
396
|
+
},
|
|
398
397
|
singleArgumentUnchanged: false
|
|
399
398
|
},
|
|
400
|
-
["
|
|
399
|
+
["inventoryId", "options"]
|
|
401
400
|
);
|
|
402
401
|
sideEffects?.onError?.(err);
|
|
403
402
|
throw transformedError;
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
|
-
async function
|
|
405
|
+
async function queryInventory2(options) {
|
|
407
406
|
const { httpClient, sideEffects } = arguments[1];
|
|
408
407
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
409
|
-
|
|
408
|
+
query: options?.query
|
|
410
409
|
});
|
|
411
|
-
const reqOpts =
|
|
410
|
+
const reqOpts = queryInventory(payload);
|
|
412
411
|
sideEffects?.onSiteCall?.();
|
|
413
412
|
try {
|
|
414
413
|
const result = await httpClient.request(reqOpts);
|
|
415
414
|
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: { query: "$[0].query" },
|
|
422
422
|
singleArgumentUnchanged: false
|
|
423
423
|
},
|
|
424
|
-
["
|
|
424
|
+
["options"]
|
|
425
425
|
);
|
|
426
426
|
sideEffects?.onError?.(err);
|
|
427
427
|
throw transformedError;
|
|
@@ -431,21 +431,6 @@ async function incrementInventory2(incrementData) {
|
|
|
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
|
-
}
|
|
449
434
|
function updateInventoryVariants3(httpClient) {
|
|
450
435
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
451
436
|
productId,
|
|
@@ -468,6 +453,21 @@ function incrementInventory3(httpClient) {
|
|
|
468
453
|
{ httpClient }
|
|
469
454
|
);
|
|
470
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
|
+
}
|
|
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);
|
|
505
503
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
506
504
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
507
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);
|
|
508
508
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
509
509
|
onInventoryItemChanged
|
|
510
510
|
);
|