@wix/auto_sdk_stores_inventory 1.0.91 → 1.0.93
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 +142 -124
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +125 -107
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +111 -93
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +142 -124
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +125 -107
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +111 -93
- 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
|
_: [
|
|
@@ -129,88 +152,29 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
129
152
|
srcPath: "/catalog-write-api-proxy",
|
|
130
153
|
destPath: ""
|
|
131
154
|
}
|
|
132
|
-
]
|
|
133
|
-
|
|
134
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
135
|
-
}
|
|
136
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
137
|
-
const domainToMappings = {
|
|
138
|
-
"www.wixapis.com": [
|
|
155
|
+
],
|
|
156
|
+
"editor._base_domain_": [
|
|
139
157
|
{
|
|
140
|
-
srcPath: "/
|
|
141
|
-
destPath: "
|
|
158
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
159
|
+
destPath: ""
|
|
142
160
|
}
|
|
143
161
|
],
|
|
144
|
-
"
|
|
162
|
+
"blocks._base_domain_": [
|
|
145
163
|
{
|
|
146
|
-
srcPath: "/
|
|
164
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
147
165
|
destPath: ""
|
|
148
166
|
}
|
|
149
167
|
],
|
|
150
|
-
|
|
168
|
+
"create.editorx": [
|
|
151
169
|
{
|
|
152
|
-
srcPath: "/
|
|
153
|
-
destPath: "
|
|
170
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
171
|
+
destPath: ""
|
|
154
172
|
}
|
|
155
173
|
]
|
|
156
174
|
};
|
|
157
175
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
158
176
|
}
|
|
159
177
|
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
178
|
function updateInventoryVariants(payload) {
|
|
215
179
|
function __updateInventoryVariants({ host }) {
|
|
216
180
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -280,6 +244,60 @@ function incrementInventory(payload) {
|
|
|
280
244
|
}
|
|
281
245
|
return __incrementInventory;
|
|
282
246
|
}
|
|
247
|
+
function getInventoryVariants(payload) {
|
|
248
|
+
function __getInventoryVariants({ host }) {
|
|
249
|
+
const metadata = {
|
|
250
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
251
|
+
method: "POST",
|
|
252
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
253
|
+
packageName: PACKAGE_NAME,
|
|
254
|
+
migrationOptions: {
|
|
255
|
+
optInTransformResponse: true
|
|
256
|
+
},
|
|
257
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
258
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
259
|
+
data: payload,
|
|
260
|
+
host
|
|
261
|
+
}),
|
|
262
|
+
data: payload,
|
|
263
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
264
|
+
{
|
|
265
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
266
|
+
paths: TRANSFORM_PATHS_0
|
|
267
|
+
}
|
|
268
|
+
])
|
|
269
|
+
};
|
|
270
|
+
return metadata;
|
|
271
|
+
}
|
|
272
|
+
return __getInventoryVariants;
|
|
273
|
+
}
|
|
274
|
+
function queryInventory(payload) {
|
|
275
|
+
function __queryInventory({ host }) {
|
|
276
|
+
const metadata = {
|
|
277
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
278
|
+
method: "POST",
|
|
279
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
280
|
+
packageName: PACKAGE_NAME,
|
|
281
|
+
migrationOptions: {
|
|
282
|
+
optInTransformResponse: true
|
|
283
|
+
},
|
|
284
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
285
|
+
protoPath: "/v2/inventoryItems/query",
|
|
286
|
+
data: payload,
|
|
287
|
+
host
|
|
288
|
+
}),
|
|
289
|
+
data: payload,
|
|
290
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
291
|
+
{
|
|
292
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
293
|
+
paths: TRANSFORM_PATHS_1
|
|
294
|
+
}
|
|
295
|
+
])
|
|
296
|
+
};
|
|
297
|
+
return metadata;
|
|
298
|
+
}
|
|
299
|
+
return __queryInventory;
|
|
300
|
+
}
|
|
283
301
|
|
|
284
302
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
285
303
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -297,70 +315,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
297
315
|
WebhookIdentityType2["APP"] = "APP";
|
|
298
316
|
return WebhookIdentityType2;
|
|
299
317
|
})(WebhookIdentityType || {});
|
|
300
|
-
async function
|
|
318
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
301
319
|
const { httpClient, sideEffects } = arguments[2];
|
|
302
320
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
303
|
-
|
|
304
|
-
externalId: options?.externalId,
|
|
305
|
-
productId: options?.productId,
|
|
306
|
-
variantIds: options?.variantIds
|
|
321
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
307
322
|
});
|
|
308
|
-
const reqOpts =
|
|
323
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
309
324
|
sideEffects?.onSiteCall?.();
|
|
310
325
|
try {
|
|
311
326
|
const result = await httpClient.request(reqOpts);
|
|
312
327
|
sideEffects?.onSuccess?.(result);
|
|
313
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
314
328
|
} catch (err) {
|
|
315
329
|
const transformedError = (0, import_transform_error.transformError)(
|
|
316
330
|
err,
|
|
317
331
|
{
|
|
318
|
-
spreadPathsToArguments: {},
|
|
319
|
-
explicitPathsToArguments: {
|
|
320
|
-
inventoryId: "$[0]",
|
|
321
|
-
externalId: "$[1].externalId",
|
|
322
|
-
productId: "$[1].productId",
|
|
323
|
-
variantIds: "$[1].variantIds"
|
|
324
|
-
},
|
|
332
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
333
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
325
334
|
singleArgumentUnchanged: false
|
|
326
335
|
},
|
|
327
|
-
["
|
|
336
|
+
["productId", "inventoryItem"]
|
|
328
337
|
);
|
|
329
338
|
sideEffects?.onError?.(err);
|
|
330
339
|
throw transformedError;
|
|
331
340
|
}
|
|
332
341
|
}
|
|
333
|
-
async function
|
|
342
|
+
async function decrementInventory2(decrementData) {
|
|
334
343
|
const { httpClient, sideEffects } = arguments[1];
|
|
335
344
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
336
|
-
|
|
345
|
+
decrementData
|
|
337
346
|
});
|
|
338
|
-
const reqOpts =
|
|
347
|
+
const reqOpts = decrementInventory(payload);
|
|
339
348
|
sideEffects?.onSiteCall?.();
|
|
340
349
|
try {
|
|
341
350
|
const result = await httpClient.request(reqOpts);
|
|
342
351
|
sideEffects?.onSuccess?.(result);
|
|
343
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
344
352
|
} catch (err) {
|
|
345
353
|
const transformedError = (0, import_transform_error.transformError)(
|
|
346
354
|
err,
|
|
347
355
|
{
|
|
348
356
|
spreadPathsToArguments: {},
|
|
349
|
-
explicitPathsToArguments: {
|
|
357
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
350
358
|
singleArgumentUnchanged: false
|
|
351
359
|
},
|
|
352
|
-
["
|
|
360
|
+
["decrementData"]
|
|
353
361
|
);
|
|
354
362
|
sideEffects?.onError?.(err);
|
|
355
363
|
throw transformedError;
|
|
356
364
|
}
|
|
357
365
|
}
|
|
358
|
-
async function
|
|
359
|
-
const { httpClient, sideEffects } = arguments[
|
|
366
|
+
async function incrementInventory2(incrementData) {
|
|
367
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
360
368
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
361
|
-
|
|
369
|
+
incrementData
|
|
362
370
|
});
|
|
363
|
-
const reqOpts =
|
|
371
|
+
const reqOpts = incrementInventory(payload);
|
|
364
372
|
sideEffects?.onSiteCall?.();
|
|
365
373
|
try {
|
|
366
374
|
const result = await httpClient.request(reqOpts);
|
|
@@ -369,59 +377,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
369
377
|
const transformedError = (0, import_transform_error.transformError)(
|
|
370
378
|
err,
|
|
371
379
|
{
|
|
372
|
-
spreadPathsToArguments: {
|
|
373
|
-
explicitPathsToArguments: {
|
|
380
|
+
spreadPathsToArguments: {},
|
|
381
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
374
382
|
singleArgumentUnchanged: false
|
|
375
383
|
},
|
|
376
|
-
["
|
|
384
|
+
["incrementData"]
|
|
377
385
|
);
|
|
378
386
|
sideEffects?.onError?.(err);
|
|
379
387
|
throw transformedError;
|
|
380
388
|
}
|
|
381
389
|
}
|
|
382
|
-
async function
|
|
383
|
-
const { httpClient, sideEffects } = arguments[
|
|
390
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
391
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
384
392
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
385
|
-
|
|
393
|
+
inventoryId,
|
|
394
|
+
externalId: options?.externalId,
|
|
395
|
+
productId: options?.productId,
|
|
396
|
+
variantIds: options?.variantIds
|
|
386
397
|
});
|
|
387
|
-
const reqOpts =
|
|
398
|
+
const reqOpts = getInventoryVariants(payload);
|
|
388
399
|
sideEffects?.onSiteCall?.();
|
|
389
400
|
try {
|
|
390
401
|
const result = await httpClient.request(reqOpts);
|
|
391
402
|
sideEffects?.onSuccess?.(result);
|
|
403
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
392
404
|
} catch (err) {
|
|
393
405
|
const transformedError = (0, import_transform_error.transformError)(
|
|
394
406
|
err,
|
|
395
407
|
{
|
|
396
408
|
spreadPathsToArguments: {},
|
|
397
|
-
explicitPathsToArguments: {
|
|
409
|
+
explicitPathsToArguments: {
|
|
410
|
+
inventoryId: "$[0]",
|
|
411
|
+
externalId: "$[1].externalId",
|
|
412
|
+
productId: "$[1].productId",
|
|
413
|
+
variantIds: "$[1].variantIds"
|
|
414
|
+
},
|
|
398
415
|
singleArgumentUnchanged: false
|
|
399
416
|
},
|
|
400
|
-
["
|
|
417
|
+
["inventoryId", "options"]
|
|
401
418
|
);
|
|
402
419
|
sideEffects?.onError?.(err);
|
|
403
420
|
throw transformedError;
|
|
404
421
|
}
|
|
405
422
|
}
|
|
406
|
-
async function
|
|
423
|
+
async function queryInventory2(options) {
|
|
407
424
|
const { httpClient, sideEffects } = arguments[1];
|
|
408
425
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
409
|
-
|
|
426
|
+
query: options?.query
|
|
410
427
|
});
|
|
411
|
-
const reqOpts =
|
|
428
|
+
const reqOpts = queryInventory(payload);
|
|
412
429
|
sideEffects?.onSiteCall?.();
|
|
413
430
|
try {
|
|
414
431
|
const result = await httpClient.request(reqOpts);
|
|
415
432
|
sideEffects?.onSuccess?.(result);
|
|
433
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
416
434
|
} catch (err) {
|
|
417
435
|
const transformedError = (0, import_transform_error.transformError)(
|
|
418
436
|
err,
|
|
419
437
|
{
|
|
420
438
|
spreadPathsToArguments: {},
|
|
421
|
-
explicitPathsToArguments: {
|
|
439
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
422
440
|
singleArgumentUnchanged: false
|
|
423
441
|
},
|
|
424
|
-
["
|
|
442
|
+
["options"]
|
|
425
443
|
);
|
|
426
444
|
sideEffects?.onError?.(err);
|
|
427
445
|
throw transformedError;
|
|
@@ -431,21 +449,6 @@ async function incrementInventory2(incrementData) {
|
|
|
431
449
|
// src/stores-v2-inventory-inventory.public.ts
|
|
432
450
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
433
451
|
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
452
|
function updateInventoryVariants3(httpClient) {
|
|
450
453
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
451
454
|
productId,
|
|
@@ -468,6 +471,21 @@ function incrementInventory3(httpClient) {
|
|
|
468
471
|
{ httpClient }
|
|
469
472
|
);
|
|
470
473
|
}
|
|
474
|
+
function getInventoryVariants3(httpClient) {
|
|
475
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
476
|
+
inventoryId,
|
|
477
|
+
options,
|
|
478
|
+
// @ts-ignore
|
|
479
|
+
{ httpClient }
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
function queryInventory3(httpClient) {
|
|
483
|
+
return (options) => queryInventory2(
|
|
484
|
+
options,
|
|
485
|
+
// @ts-ignore
|
|
486
|
+
{ httpClient }
|
|
487
|
+
);
|
|
488
|
+
}
|
|
471
489
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
472
490
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
473
491
|
false,
|
|
@@ -500,11 +518,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
500
518
|
// src/stores-v2-inventory-inventory.context.ts
|
|
501
519
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
502
520
|
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
521
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
506
522
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
507
523
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
524
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
525
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
508
526
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
509
527
|
onInventoryItemChanged
|
|
510
528
|
);
|