@wix/auto_sdk_stores_inventory 1.0.83 → 1.0.85
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 +121 -171
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +104 -154
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +90 -140
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +121 -171
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +104 -154
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +90 -140
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +21 -21
- package/build/internal/cjs/index.typings.d.ts +242 -242
- package/build/internal/cjs/meta.d.ts +190 -190
- package/build/internal/es/index.d.mts +21 -21
- package/build/internal/es/index.typings.d.mts +242 -242
- package/build/internal/es/meta.d.mts +190 -190
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
2
|
+
import { GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, InventoryItemChangedEnvelope, InventoryVariantsChangedEnvelope } from './index.typings.js';
|
|
3
3
|
export { AccountInfo, BaseEventMetadata, BulkUpdateInventoryItemsRequest, BulkUpdateInventoryItemsResponse, BulkUpdateInventoryVariantsRequest, BulkUpdateInventoryVariantsRequestActionOneOf, BulkUpdateInventoryVariantsResponse, ChangedInventoryVariant, ChangedInventoryVariantData, DecrementDataIdOneOf, DecrementInventoryRequest, DecrementInventoryResponse, GetInventoryItemsRequest, GetInventoryItemsResponse, GetInventoryVariantsOptionsIdOneOf, GetInventoryVariantsRequest, GetInventoryVariantsRequestIdOneOf, IdentificationData, IdentificationDataIdOneOf, IncrementDataIdOneOf, IncrementInventoryRequest, IncrementInventoryResponse, InventoryItemChanged, InventoryItemV2, InventoryVariantV2, InventoryVariantsChanged, MessageEnvelope, Paging, PagingMetadata, PreorderInfo, Query, QueryInventoryRequest, ReasonType, ReasonTypeWithLiterals, UpdateInventoryVariantsRequest, UpdateInventoryVariantsResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
|
|
4
4
|
|
|
5
|
+
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
6
|
+
interface GetInventoryVariantsSignature {
|
|
7
|
+
/**
|
|
8
|
+
* Gets inventory variant information based on the specified option choices.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
12
|
+
* @param - Inventory item ID.
|
|
13
|
+
*/
|
|
14
|
+
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
15
|
+
}
|
|
16
|
+
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
17
|
+
interface QueryInventorySignature {
|
|
18
|
+
/**
|
|
19
|
+
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
20
|
+
*/
|
|
21
|
+
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
22
|
+
}
|
|
5
23
|
declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
|
|
6
24
|
interface UpdateInventoryVariantsSignature {
|
|
7
25
|
/**
|
|
@@ -36,32 +54,14 @@ interface IncrementInventorySignature {
|
|
|
36
54
|
*/
|
|
37
55
|
(incrementData: IncrementData[]): Promise<void>;
|
|
38
56
|
}
|
|
39
|
-
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
40
|
-
interface GetInventoryVariantsSignature {
|
|
41
|
-
/**
|
|
42
|
-
* Gets inventory variant information based on the specified option choices.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
46
|
-
* @param - Inventory item ID.
|
|
47
|
-
*/
|
|
48
|
-
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
49
|
-
}
|
|
50
|
-
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
51
|
-
interface QueryInventorySignature {
|
|
52
|
-
/**
|
|
53
|
-
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
54
|
-
*/
|
|
55
|
-
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
56
|
-
}
|
|
57
57
|
declare const onInventoryItemChanged$1: EventDefinition<InventoryItemChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryItemChanged">;
|
|
58
58
|
declare const onInventoryVariantsChanged$1: EventDefinition<InventoryVariantsChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged">;
|
|
59
59
|
|
|
60
|
+
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
61
|
+
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
60
62
|
declare const updateInventoryVariants: MaybeContext<BuildRESTFunction<typeof updateInventoryVariants$1> & typeof updateInventoryVariants$1>;
|
|
61
63
|
declare const decrementInventory: MaybeContext<BuildRESTFunction<typeof decrementInventory$1> & typeof decrementInventory$1>;
|
|
62
64
|
declare const incrementInventory: MaybeContext<BuildRESTFunction<typeof incrementInventory$1> & typeof incrementInventory$1>;
|
|
63
|
-
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
64
|
-
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
65
65
|
/**
|
|
66
66
|
* Triggered when an inventory item is changed.
|
|
67
67
|
*/
|
package/build/cjs/index.js
CHANGED
|
@@ -50,67 +50,6 @@ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform
|
|
|
50
50
|
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
51
51
|
var TRANSFORM_PATHS_0 = [{ path: "inventoryItem.lastUpdated" }];
|
|
52
52
|
var TRANSFORM_PATHS_1 = [{ path: "inventoryItems.lastUpdated" }];
|
|
53
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
54
|
-
const domainToMappings = {
|
|
55
|
-
"api._api_base_domain_": [
|
|
56
|
-
{
|
|
57
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
58
|
-
destPath: ""
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"manage._base_domain_": [
|
|
62
|
-
{
|
|
63
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
64
|
-
destPath: ""
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
"www.wixapis.com": [
|
|
68
|
-
{
|
|
69
|
-
srcPath: "/stores-reader/v2/collections",
|
|
70
|
-
destPath: "/v2/collections"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
74
|
-
destPath: "/v2/inventoryItems"
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
"www._base_domain_": [
|
|
78
|
-
{
|
|
79
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
80
|
-
destPath: ""
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
"editor._base_domain_": [
|
|
84
|
-
{
|
|
85
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
86
|
-
destPath: ""
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"blocks._base_domain_": [
|
|
90
|
-
{
|
|
91
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
92
|
-
destPath: ""
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"create.editorx": [
|
|
96
|
-
{
|
|
97
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
98
|
-
destPath: ""
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
_: [
|
|
102
|
-
{
|
|
103
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
104
|
-
destPath: "/v2/inventoryItems"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
srcPath: "/stores-reader/v2/collections",
|
|
108
|
-
destPath: "/v2/collections"
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
};
|
|
112
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
113
|
-
}
|
|
114
53
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
115
54
|
const domainToMappings = {
|
|
116
55
|
_: [
|
|
@@ -190,7 +129,72 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
190
129
|
};
|
|
191
130
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
192
131
|
}
|
|
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
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
142
|
+
}
|
|
193
143
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
144
|
+
function getInventoryVariants(payload) {
|
|
145
|
+
function __getInventoryVariants({ host }) {
|
|
146
|
+
const metadata = {
|
|
147
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
148
|
+
method: "POST",
|
|
149
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
150
|
+
packageName: PACKAGE_NAME,
|
|
151
|
+
migrationOptions: {
|
|
152
|
+
optInTransformResponse: true
|
|
153
|
+
},
|
|
154
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
155
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
156
|
+
data: payload,
|
|
157
|
+
host
|
|
158
|
+
}),
|
|
159
|
+
data: payload,
|
|
160
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
161
|
+
{
|
|
162
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
163
|
+
paths: TRANSFORM_PATHS_0
|
|
164
|
+
}
|
|
165
|
+
])
|
|
166
|
+
};
|
|
167
|
+
return metadata;
|
|
168
|
+
}
|
|
169
|
+
return __getInventoryVariants;
|
|
170
|
+
}
|
|
171
|
+
function queryInventory(payload) {
|
|
172
|
+
function __queryInventory({ host }) {
|
|
173
|
+
const metadata = {
|
|
174
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
175
|
+
method: "POST",
|
|
176
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
177
|
+
packageName: PACKAGE_NAME,
|
|
178
|
+
migrationOptions: {
|
|
179
|
+
optInTransformResponse: true
|
|
180
|
+
},
|
|
181
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
182
|
+
protoPath: "/v2/inventoryItems/query",
|
|
183
|
+
data: payload,
|
|
184
|
+
host
|
|
185
|
+
}),
|
|
186
|
+
data: payload,
|
|
187
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
188
|
+
{
|
|
189
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
190
|
+
paths: TRANSFORM_PATHS_1
|
|
191
|
+
}
|
|
192
|
+
])
|
|
193
|
+
};
|
|
194
|
+
return metadata;
|
|
195
|
+
}
|
|
196
|
+
return __queryInventory;
|
|
197
|
+
}
|
|
194
198
|
function updateInventoryVariants(payload) {
|
|
195
199
|
function __updateInventoryVariants({ host }) {
|
|
196
200
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -260,60 +264,6 @@ function incrementInventory(payload) {
|
|
|
260
264
|
}
|
|
261
265
|
return __incrementInventory;
|
|
262
266
|
}
|
|
263
|
-
function getInventoryVariants(payload) {
|
|
264
|
-
function __getInventoryVariants({ host }) {
|
|
265
|
-
const metadata = {
|
|
266
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
267
|
-
method: "POST",
|
|
268
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
269
|
-
packageName: PACKAGE_NAME,
|
|
270
|
-
migrationOptions: {
|
|
271
|
-
optInTransformResponse: true
|
|
272
|
-
},
|
|
273
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
274
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
275
|
-
data: payload,
|
|
276
|
-
host
|
|
277
|
-
}),
|
|
278
|
-
data: payload,
|
|
279
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
280
|
-
{
|
|
281
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
282
|
-
paths: TRANSFORM_PATHS_0
|
|
283
|
-
}
|
|
284
|
-
])
|
|
285
|
-
};
|
|
286
|
-
return metadata;
|
|
287
|
-
}
|
|
288
|
-
return __getInventoryVariants;
|
|
289
|
-
}
|
|
290
|
-
function queryInventory(payload) {
|
|
291
|
-
function __queryInventory({ host }) {
|
|
292
|
-
const metadata = {
|
|
293
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
294
|
-
method: "POST",
|
|
295
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
296
|
-
packageName: PACKAGE_NAME,
|
|
297
|
-
migrationOptions: {
|
|
298
|
-
optInTransformResponse: true
|
|
299
|
-
},
|
|
300
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
301
|
-
protoPath: "/v2/inventoryItems/query",
|
|
302
|
-
data: payload,
|
|
303
|
-
host
|
|
304
|
-
}),
|
|
305
|
-
data: payload,
|
|
306
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
307
|
-
{
|
|
308
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
309
|
-
paths: TRANSFORM_PATHS_1
|
|
310
|
-
}
|
|
311
|
-
])
|
|
312
|
-
};
|
|
313
|
-
return metadata;
|
|
314
|
-
}
|
|
315
|
-
return __queryInventory;
|
|
316
|
-
}
|
|
317
267
|
|
|
318
268
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
319
269
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -331,60 +281,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
331
281
|
WebhookIdentityType2["APP"] = "APP";
|
|
332
282
|
return WebhookIdentityType2;
|
|
333
283
|
})(WebhookIdentityType || {});
|
|
334
|
-
async function
|
|
284
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
335
285
|
const { httpClient, sideEffects } = arguments[2];
|
|
336
286
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
337
|
-
|
|
287
|
+
inventoryId,
|
|
288
|
+
externalId: options?.externalId,
|
|
289
|
+
productId: options?.productId,
|
|
290
|
+
variantIds: options?.variantIds
|
|
338
291
|
});
|
|
339
|
-
const reqOpts =
|
|
292
|
+
const reqOpts = getInventoryVariants(payload);
|
|
340
293
|
sideEffects?.onSiteCall?.();
|
|
341
294
|
try {
|
|
342
295
|
const result = await httpClient.request(reqOpts);
|
|
343
296
|
sideEffects?.onSuccess?.(result);
|
|
297
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
344
298
|
} catch (err) {
|
|
345
299
|
const transformedError = (0, import_transform_error.transformError)(
|
|
346
300
|
err,
|
|
347
301
|
{
|
|
348
|
-
spreadPathsToArguments: {
|
|
349
|
-
explicitPathsToArguments: {
|
|
302
|
+
spreadPathsToArguments: {},
|
|
303
|
+
explicitPathsToArguments: {
|
|
304
|
+
inventoryId: "$[0]",
|
|
305
|
+
externalId: "$[1].externalId",
|
|
306
|
+
productId: "$[1].productId",
|
|
307
|
+
variantIds: "$[1].variantIds"
|
|
308
|
+
},
|
|
350
309
|
singleArgumentUnchanged: false
|
|
351
310
|
},
|
|
352
|
-
["
|
|
311
|
+
["inventoryId", "options"]
|
|
353
312
|
);
|
|
354
313
|
sideEffects?.onError?.(err);
|
|
355
314
|
throw transformedError;
|
|
356
315
|
}
|
|
357
316
|
}
|
|
358
|
-
async function
|
|
317
|
+
async function queryInventory2(options) {
|
|
359
318
|
const { httpClient, sideEffects } = arguments[1];
|
|
360
319
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
361
|
-
|
|
320
|
+
query: options?.query
|
|
362
321
|
});
|
|
363
|
-
const reqOpts =
|
|
322
|
+
const reqOpts = queryInventory(payload);
|
|
364
323
|
sideEffects?.onSiteCall?.();
|
|
365
324
|
try {
|
|
366
325
|
const result = await httpClient.request(reqOpts);
|
|
367
326
|
sideEffects?.onSuccess?.(result);
|
|
327
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
368
328
|
} catch (err) {
|
|
369
329
|
const transformedError = (0, import_transform_error.transformError)(
|
|
370
330
|
err,
|
|
371
331
|
{
|
|
372
332
|
spreadPathsToArguments: {},
|
|
373
|
-
explicitPathsToArguments: {
|
|
333
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
374
334
|
singleArgumentUnchanged: false
|
|
375
335
|
},
|
|
376
|
-
["
|
|
336
|
+
["options"]
|
|
377
337
|
);
|
|
378
338
|
sideEffects?.onError?.(err);
|
|
379
339
|
throw transformedError;
|
|
380
340
|
}
|
|
381
341
|
}
|
|
382
|
-
async function
|
|
383
|
-
const { httpClient, sideEffects } = arguments[
|
|
342
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
343
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
384
344
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
385
|
-
|
|
345
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
386
346
|
});
|
|
387
|
-
const reqOpts =
|
|
347
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
388
348
|
sideEffects?.onSiteCall?.();
|
|
389
349
|
try {
|
|
390
350
|
const result = await httpClient.request(reqOpts);
|
|
@@ -393,69 +353,59 @@ async function incrementInventory2(incrementData) {
|
|
|
393
353
|
const transformedError = (0, import_transform_error.transformError)(
|
|
394
354
|
err,
|
|
395
355
|
{
|
|
396
|
-
spreadPathsToArguments: {},
|
|
397
|
-
explicitPathsToArguments: {
|
|
356
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
357
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
398
358
|
singleArgumentUnchanged: false
|
|
399
359
|
},
|
|
400
|
-
["
|
|
360
|
+
["productId", "inventoryItem"]
|
|
401
361
|
);
|
|
402
362
|
sideEffects?.onError?.(err);
|
|
403
363
|
throw transformedError;
|
|
404
364
|
}
|
|
405
365
|
}
|
|
406
|
-
async function
|
|
407
|
-
const { httpClient, sideEffects } = arguments[
|
|
366
|
+
async function decrementInventory2(decrementData) {
|
|
367
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
408
368
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
409
|
-
|
|
410
|
-
externalId: options?.externalId,
|
|
411
|
-
productId: options?.productId,
|
|
412
|
-
variantIds: options?.variantIds
|
|
369
|
+
decrementData
|
|
413
370
|
});
|
|
414
|
-
const reqOpts =
|
|
371
|
+
const reqOpts = decrementInventory(payload);
|
|
415
372
|
sideEffects?.onSiteCall?.();
|
|
416
373
|
try {
|
|
417
374
|
const result = await httpClient.request(reqOpts);
|
|
418
375
|
sideEffects?.onSuccess?.(result);
|
|
419
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
420
376
|
} catch (err) {
|
|
421
377
|
const transformedError = (0, import_transform_error.transformError)(
|
|
422
378
|
err,
|
|
423
379
|
{
|
|
424
380
|
spreadPathsToArguments: {},
|
|
425
|
-
explicitPathsToArguments: {
|
|
426
|
-
inventoryId: "$[0]",
|
|
427
|
-
externalId: "$[1].externalId",
|
|
428
|
-
productId: "$[1].productId",
|
|
429
|
-
variantIds: "$[1].variantIds"
|
|
430
|
-
},
|
|
381
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
431
382
|
singleArgumentUnchanged: false
|
|
432
383
|
},
|
|
433
|
-
["
|
|
384
|
+
["decrementData"]
|
|
434
385
|
);
|
|
435
386
|
sideEffects?.onError?.(err);
|
|
436
387
|
throw transformedError;
|
|
437
388
|
}
|
|
438
389
|
}
|
|
439
|
-
async function
|
|
390
|
+
async function incrementInventory2(incrementData) {
|
|
440
391
|
const { httpClient, sideEffects } = arguments[1];
|
|
441
392
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
442
|
-
|
|
393
|
+
incrementData
|
|
443
394
|
});
|
|
444
|
-
const reqOpts =
|
|
395
|
+
const reqOpts = incrementInventory(payload);
|
|
445
396
|
sideEffects?.onSiteCall?.();
|
|
446
397
|
try {
|
|
447
398
|
const result = await httpClient.request(reqOpts);
|
|
448
399
|
sideEffects?.onSuccess?.(result);
|
|
449
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
450
400
|
} catch (err) {
|
|
451
401
|
const transformedError = (0, import_transform_error.transformError)(
|
|
452
402
|
err,
|
|
453
403
|
{
|
|
454
404
|
spreadPathsToArguments: {},
|
|
455
|
-
explicitPathsToArguments: {
|
|
405
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
456
406
|
singleArgumentUnchanged: false
|
|
457
407
|
},
|
|
458
|
-
["
|
|
408
|
+
["incrementData"]
|
|
459
409
|
);
|
|
460
410
|
sideEffects?.onError?.(err);
|
|
461
411
|
throw transformedError;
|
|
@@ -465,6 +415,21 @@ async function queryInventory2(options) {
|
|
|
465
415
|
// src/stores-v2-inventory-inventory.public.ts
|
|
466
416
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
467
417
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
418
|
+
function getInventoryVariants3(httpClient) {
|
|
419
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
420
|
+
inventoryId,
|
|
421
|
+
options,
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
{ httpClient }
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
function queryInventory3(httpClient) {
|
|
427
|
+
return (options) => queryInventory2(
|
|
428
|
+
options,
|
|
429
|
+
// @ts-ignore
|
|
430
|
+
{ httpClient }
|
|
431
|
+
);
|
|
432
|
+
}
|
|
468
433
|
function updateInventoryVariants3(httpClient) {
|
|
469
434
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
470
435
|
productId,
|
|
@@ -487,21 +452,6 @@ function incrementInventory3(httpClient) {
|
|
|
487
452
|
{ httpClient }
|
|
488
453
|
);
|
|
489
454
|
}
|
|
490
|
-
function getInventoryVariants3(httpClient) {
|
|
491
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
492
|
-
inventoryId,
|
|
493
|
-
options,
|
|
494
|
-
// @ts-ignore
|
|
495
|
-
{ httpClient }
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
function queryInventory3(httpClient) {
|
|
499
|
-
return (options) => queryInventory2(
|
|
500
|
-
options,
|
|
501
|
-
// @ts-ignore
|
|
502
|
-
{ httpClient }
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
455
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
506
456
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
507
457
|
false,
|
|
@@ -534,11 +484,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
534
484
|
// src/stores-v2-inventory-inventory.context.ts
|
|
535
485
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
536
486
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
487
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
488
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
537
489
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
538
490
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
539
491
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
540
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
541
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
542
492
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
543
493
|
onInventoryItemChanged
|
|
544
494
|
);
|