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