@wix/auto_sdk_stores_inventory 1.0.92 → 1.0.94
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 +151 -133
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +134 -116
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +120 -102
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +151 -133
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +134 -116
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +120 -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,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,29 +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
|
-
"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
|
-
}
|
|
76
53
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
77
54
|
const domainToMappings = {
|
|
78
55
|
_: [
|
|
@@ -152,11 +129,106 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
152
129
|
srcPath: "/catalog-write-api-proxy",
|
|
153
130
|
destPath: ""
|
|
154
131
|
}
|
|
132
|
+
],
|
|
133
|
+
"editor._base_domain_": [
|
|
134
|
+
{
|
|
135
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
136
|
+
destPath: ""
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"blocks._base_domain_": [
|
|
140
|
+
{
|
|
141
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
142
|
+
destPath: ""
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"create.editorx": [
|
|
146
|
+
{
|
|
147
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
148
|
+
destPath: ""
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
153
|
+
}
|
|
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
|
+
}
|
|
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";
|
|
178
|
+
function getInventoryVariants(payload) {
|
|
179
|
+
function __getInventoryVariants({ host }) {
|
|
180
|
+
const metadata = {
|
|
181
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
182
|
+
method: "POST",
|
|
183
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
184
|
+
packageName: PACKAGE_NAME,
|
|
185
|
+
migrationOptions: {
|
|
186
|
+
optInTransformResponse: true
|
|
187
|
+
},
|
|
188
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
189
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
190
|
+
data: payload,
|
|
191
|
+
host
|
|
192
|
+
}),
|
|
193
|
+
data: payload,
|
|
194
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
195
|
+
{
|
|
196
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
197
|
+
paths: TRANSFORM_PATHS_0
|
|
198
|
+
}
|
|
199
|
+
])
|
|
200
|
+
};
|
|
201
|
+
return metadata;
|
|
202
|
+
}
|
|
203
|
+
return __getInventoryVariants;
|
|
204
|
+
}
|
|
205
|
+
function queryInventory(payload) {
|
|
206
|
+
function __queryInventory({ host }) {
|
|
207
|
+
const metadata = {
|
|
208
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
209
|
+
method: "POST",
|
|
210
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
211
|
+
packageName: PACKAGE_NAME,
|
|
212
|
+
migrationOptions: {
|
|
213
|
+
optInTransformResponse: true
|
|
214
|
+
},
|
|
215
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
216
|
+
protoPath: "/v2/inventoryItems/query",
|
|
217
|
+
data: payload,
|
|
218
|
+
host
|
|
219
|
+
}),
|
|
220
|
+
data: payload,
|
|
221
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
222
|
+
{
|
|
223
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
224
|
+
paths: TRANSFORM_PATHS_1
|
|
225
|
+
}
|
|
226
|
+
])
|
|
227
|
+
};
|
|
228
|
+
return metadata;
|
|
229
|
+
}
|
|
230
|
+
return __queryInventory;
|
|
231
|
+
}
|
|
160
232
|
function updateInventoryVariants(payload) {
|
|
161
233
|
function __updateInventoryVariants({ host }) {
|
|
162
234
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -226,60 +298,6 @@ function incrementInventory(payload) {
|
|
|
226
298
|
}
|
|
227
299
|
return __incrementInventory;
|
|
228
300
|
}
|
|
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
301
|
|
|
284
302
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
285
303
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -297,60 +315,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
297
315
|
WebhookIdentityType2["APP"] = "APP";
|
|
298
316
|
return WebhookIdentityType2;
|
|
299
317
|
})(WebhookIdentityType || {});
|
|
300
|
-
async function
|
|
318
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
301
319
|
const { httpClient, sideEffects } = arguments[2];
|
|
302
320
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
303
|
-
|
|
321
|
+
inventoryId,
|
|
322
|
+
externalId: options?.externalId,
|
|
323
|
+
productId: options?.productId,
|
|
324
|
+
variantIds: options?.variantIds
|
|
304
325
|
});
|
|
305
|
-
const reqOpts =
|
|
326
|
+
const reqOpts = getInventoryVariants(payload);
|
|
306
327
|
sideEffects?.onSiteCall?.();
|
|
307
328
|
try {
|
|
308
329
|
const result = await httpClient.request(reqOpts);
|
|
309
330
|
sideEffects?.onSuccess?.(result);
|
|
331
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
310
332
|
} catch (err) {
|
|
311
333
|
const transformedError = (0, import_transform_error.transformError)(
|
|
312
334
|
err,
|
|
313
335
|
{
|
|
314
|
-
spreadPathsToArguments: {
|
|
315
|
-
explicitPathsToArguments: {
|
|
336
|
+
spreadPathsToArguments: {},
|
|
337
|
+
explicitPathsToArguments: {
|
|
338
|
+
inventoryId: "$[0]",
|
|
339
|
+
externalId: "$[1].externalId",
|
|
340
|
+
productId: "$[1].productId",
|
|
341
|
+
variantIds: "$[1].variantIds"
|
|
342
|
+
},
|
|
316
343
|
singleArgumentUnchanged: false
|
|
317
344
|
},
|
|
318
|
-
["
|
|
345
|
+
["inventoryId", "options"]
|
|
319
346
|
);
|
|
320
347
|
sideEffects?.onError?.(err);
|
|
321
348
|
throw transformedError;
|
|
322
349
|
}
|
|
323
350
|
}
|
|
324
|
-
async function
|
|
351
|
+
async function queryInventory2(options) {
|
|
325
352
|
const { httpClient, sideEffects } = arguments[1];
|
|
326
353
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
327
|
-
|
|
354
|
+
query: options?.query
|
|
328
355
|
});
|
|
329
|
-
const reqOpts =
|
|
356
|
+
const reqOpts = queryInventory(payload);
|
|
330
357
|
sideEffects?.onSiteCall?.();
|
|
331
358
|
try {
|
|
332
359
|
const result = await httpClient.request(reqOpts);
|
|
333
360
|
sideEffects?.onSuccess?.(result);
|
|
361
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
334
362
|
} catch (err) {
|
|
335
363
|
const transformedError = (0, import_transform_error.transformError)(
|
|
336
364
|
err,
|
|
337
365
|
{
|
|
338
366
|
spreadPathsToArguments: {},
|
|
339
|
-
explicitPathsToArguments: {
|
|
367
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
340
368
|
singleArgumentUnchanged: false
|
|
341
369
|
},
|
|
342
|
-
["
|
|
370
|
+
["options"]
|
|
343
371
|
);
|
|
344
372
|
sideEffects?.onError?.(err);
|
|
345
373
|
throw transformedError;
|
|
346
374
|
}
|
|
347
375
|
}
|
|
348
|
-
async function
|
|
349
|
-
const { httpClient, sideEffects } = arguments[
|
|
376
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
377
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
350
378
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
351
|
-
|
|
379
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
352
380
|
});
|
|
353
|
-
const reqOpts =
|
|
381
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
354
382
|
sideEffects?.onSiteCall?.();
|
|
355
383
|
try {
|
|
356
384
|
const result = await httpClient.request(reqOpts);
|
|
@@ -359,69 +387,59 @@ async function incrementInventory2(incrementData) {
|
|
|
359
387
|
const transformedError = (0, import_transform_error.transformError)(
|
|
360
388
|
err,
|
|
361
389
|
{
|
|
362
|
-
spreadPathsToArguments: {},
|
|
363
|
-
explicitPathsToArguments: {
|
|
390
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
391
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
364
392
|
singleArgumentUnchanged: false
|
|
365
393
|
},
|
|
366
|
-
["
|
|
394
|
+
["productId", "inventoryItem"]
|
|
367
395
|
);
|
|
368
396
|
sideEffects?.onError?.(err);
|
|
369
397
|
throw transformedError;
|
|
370
398
|
}
|
|
371
399
|
}
|
|
372
|
-
async function
|
|
373
|
-
const { httpClient, sideEffects } = arguments[
|
|
400
|
+
async function decrementInventory2(decrementData) {
|
|
401
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
374
402
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
375
|
-
|
|
376
|
-
externalId: options?.externalId,
|
|
377
|
-
productId: options?.productId,
|
|
378
|
-
variantIds: options?.variantIds
|
|
403
|
+
decrementData
|
|
379
404
|
});
|
|
380
|
-
const reqOpts =
|
|
405
|
+
const reqOpts = decrementInventory(payload);
|
|
381
406
|
sideEffects?.onSiteCall?.();
|
|
382
407
|
try {
|
|
383
408
|
const result = await httpClient.request(reqOpts);
|
|
384
409
|
sideEffects?.onSuccess?.(result);
|
|
385
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
386
410
|
} catch (err) {
|
|
387
411
|
const transformedError = (0, import_transform_error.transformError)(
|
|
388
412
|
err,
|
|
389
413
|
{
|
|
390
414
|
spreadPathsToArguments: {},
|
|
391
|
-
explicitPathsToArguments: {
|
|
392
|
-
inventoryId: "$[0]",
|
|
393
|
-
externalId: "$[1].externalId",
|
|
394
|
-
productId: "$[1].productId",
|
|
395
|
-
variantIds: "$[1].variantIds"
|
|
396
|
-
},
|
|
415
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
397
416
|
singleArgumentUnchanged: false
|
|
398
417
|
},
|
|
399
|
-
["
|
|
418
|
+
["decrementData"]
|
|
400
419
|
);
|
|
401
420
|
sideEffects?.onError?.(err);
|
|
402
421
|
throw transformedError;
|
|
403
422
|
}
|
|
404
423
|
}
|
|
405
|
-
async function
|
|
424
|
+
async function incrementInventory2(incrementData) {
|
|
406
425
|
const { httpClient, sideEffects } = arguments[1];
|
|
407
426
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
408
|
-
|
|
427
|
+
incrementData
|
|
409
428
|
});
|
|
410
|
-
const reqOpts =
|
|
429
|
+
const reqOpts = incrementInventory(payload);
|
|
411
430
|
sideEffects?.onSiteCall?.();
|
|
412
431
|
try {
|
|
413
432
|
const result = await httpClient.request(reqOpts);
|
|
414
433
|
sideEffects?.onSuccess?.(result);
|
|
415
|
-
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: { incrementData: "$[0]" },
|
|
422
440
|
singleArgumentUnchanged: false
|
|
423
441
|
},
|
|
424
|
-
["
|
|
442
|
+
["incrementData"]
|
|
425
443
|
);
|
|
426
444
|
sideEffects?.onError?.(err);
|
|
427
445
|
throw transformedError;
|
|
@@ -431,6 +449,21 @@ async function queryInventory2(options) {
|
|
|
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" }];
|
|
452
|
+
function getInventoryVariants3(httpClient) {
|
|
453
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
454
|
+
inventoryId,
|
|
455
|
+
options,
|
|
456
|
+
// @ts-ignore
|
|
457
|
+
{ httpClient }
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
function queryInventory3(httpClient) {
|
|
461
|
+
return (options) => queryInventory2(
|
|
462
|
+
options,
|
|
463
|
+
// @ts-ignore
|
|
464
|
+
{ httpClient }
|
|
465
|
+
);
|
|
466
|
+
}
|
|
434
467
|
function updateInventoryVariants3(httpClient) {
|
|
435
468
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
436
469
|
productId,
|
|
@@ -453,21 +486,6 @@ function incrementInventory3(httpClient) {
|
|
|
453
486
|
{ httpClient }
|
|
454
487
|
);
|
|
455
488
|
}
|
|
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
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");
|
|
521
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
522
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
503
523
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
504
524
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
505
525
|
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
526
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
509
527
|
onInventoryItemChanged
|
|
510
528
|
);
|