@wix/auto_sdk_stores_inventory 1.0.93 → 1.0.95
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 -135
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +122 -118
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +108 -104
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +139 -135
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +122 -118
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +108 -104
- 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,31 +50,18 @@ 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
|
|
53
|
+
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
54
54
|
const domainToMappings = {
|
|
55
|
-
"www.
|
|
55
|
+
"www._base_domain_": [
|
|
56
56
|
{
|
|
57
|
-
srcPath: "/
|
|
58
|
-
destPath: "
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"api._api_base_domain_": [
|
|
57
|
+
srcPath: "/_api/catalog-server",
|
|
58
|
+
destPath: ""
|
|
59
|
+
},
|
|
62
60
|
{
|
|
63
|
-
srcPath: "/
|
|
61
|
+
srcPath: "/catalog-write-api-proxy",
|
|
64
62
|
destPath: ""
|
|
65
63
|
}
|
|
66
64
|
],
|
|
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
|
-
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
77
|
-
const domainToMappings = {
|
|
78
65
|
_: [
|
|
79
66
|
{
|
|
80
67
|
srcPath: "/_api/catalog-server",
|
|
@@ -147,12 +134,6 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
147
134
|
destPath: ""
|
|
148
135
|
}
|
|
149
136
|
],
|
|
150
|
-
"www._base_domain_": [
|
|
151
|
-
{
|
|
152
|
-
srcPath: "/catalog-write-api-proxy",
|
|
153
|
-
destPath: ""
|
|
154
|
-
}
|
|
155
|
-
],
|
|
156
137
|
"editor._base_domain_": [
|
|
157
138
|
{
|
|
158
139
|
srcPath: "/_api/catalog-write-api-proxy",
|
|
@@ -174,7 +155,84 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
174
155
|
};
|
|
175
156
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
176
157
|
}
|
|
158
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
159
|
+
const domainToMappings = {
|
|
160
|
+
"www.wixapis.com": [
|
|
161
|
+
{
|
|
162
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
163
|
+
destPath: "/v2/inventoryItems"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"api._api_base_domain_": [
|
|
167
|
+
{
|
|
168
|
+
srcPath: "/inventory-read-api-proxy",
|
|
169
|
+
destPath: ""
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
_: [
|
|
173
|
+
{
|
|
174
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
175
|
+
destPath: "/v2/inventoryItems"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
};
|
|
179
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
180
|
+
}
|
|
177
181
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
182
|
+
function getInventoryVariants(payload) {
|
|
183
|
+
function __getInventoryVariants({ host }) {
|
|
184
|
+
const metadata = {
|
|
185
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
186
|
+
method: "POST",
|
|
187
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
188
|
+
packageName: PACKAGE_NAME,
|
|
189
|
+
migrationOptions: {
|
|
190
|
+
optInTransformResponse: true
|
|
191
|
+
},
|
|
192
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
193
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
194
|
+
data: payload,
|
|
195
|
+
host
|
|
196
|
+
}),
|
|
197
|
+
data: payload,
|
|
198
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
199
|
+
{
|
|
200
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
201
|
+
paths: TRANSFORM_PATHS_0
|
|
202
|
+
}
|
|
203
|
+
])
|
|
204
|
+
};
|
|
205
|
+
return metadata;
|
|
206
|
+
}
|
|
207
|
+
return __getInventoryVariants;
|
|
208
|
+
}
|
|
209
|
+
function queryInventory(payload) {
|
|
210
|
+
function __queryInventory({ host }) {
|
|
211
|
+
const metadata = {
|
|
212
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
213
|
+
method: "POST",
|
|
214
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
215
|
+
packageName: PACKAGE_NAME,
|
|
216
|
+
migrationOptions: {
|
|
217
|
+
optInTransformResponse: true
|
|
218
|
+
},
|
|
219
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
220
|
+
protoPath: "/v2/inventoryItems/query",
|
|
221
|
+
data: payload,
|
|
222
|
+
host
|
|
223
|
+
}),
|
|
224
|
+
data: payload,
|
|
225
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
226
|
+
{
|
|
227
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
228
|
+
paths: TRANSFORM_PATHS_1
|
|
229
|
+
}
|
|
230
|
+
])
|
|
231
|
+
};
|
|
232
|
+
return metadata;
|
|
233
|
+
}
|
|
234
|
+
return __queryInventory;
|
|
235
|
+
}
|
|
178
236
|
function updateInventoryVariants(payload) {
|
|
179
237
|
function __updateInventoryVariants({ host }) {
|
|
180
238
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -244,60 +302,6 @@ function incrementInventory(payload) {
|
|
|
244
302
|
}
|
|
245
303
|
return __incrementInventory;
|
|
246
304
|
}
|
|
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
|
-
}
|
|
301
305
|
|
|
302
306
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
303
307
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -315,60 +319,70 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
315
319
|
WebhookIdentityType2["APP"] = "APP";
|
|
316
320
|
return WebhookIdentityType2;
|
|
317
321
|
})(WebhookIdentityType || {});
|
|
318
|
-
async function
|
|
322
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
319
323
|
const { httpClient, sideEffects } = arguments[2];
|
|
320
324
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
321
|
-
|
|
325
|
+
inventoryId,
|
|
326
|
+
externalId: options?.externalId,
|
|
327
|
+
productId: options?.productId,
|
|
328
|
+
variantIds: options?.variantIds
|
|
322
329
|
});
|
|
323
|
-
const reqOpts =
|
|
330
|
+
const reqOpts = getInventoryVariants(payload);
|
|
324
331
|
sideEffects?.onSiteCall?.();
|
|
325
332
|
try {
|
|
326
333
|
const result = await httpClient.request(reqOpts);
|
|
327
334
|
sideEffects?.onSuccess?.(result);
|
|
335
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
328
336
|
} catch (err) {
|
|
329
337
|
const transformedError = (0, import_transform_error.transformError)(
|
|
330
338
|
err,
|
|
331
339
|
{
|
|
332
|
-
spreadPathsToArguments: {
|
|
333
|
-
explicitPathsToArguments: {
|
|
340
|
+
spreadPathsToArguments: {},
|
|
341
|
+
explicitPathsToArguments: {
|
|
342
|
+
inventoryId: "$[0]",
|
|
343
|
+
externalId: "$[1].externalId",
|
|
344
|
+
productId: "$[1].productId",
|
|
345
|
+
variantIds: "$[1].variantIds"
|
|
346
|
+
},
|
|
334
347
|
singleArgumentUnchanged: false
|
|
335
348
|
},
|
|
336
|
-
["
|
|
349
|
+
["inventoryId", "options"]
|
|
337
350
|
);
|
|
338
351
|
sideEffects?.onError?.(err);
|
|
339
352
|
throw transformedError;
|
|
340
353
|
}
|
|
341
354
|
}
|
|
342
|
-
async function
|
|
355
|
+
async function queryInventory2(options) {
|
|
343
356
|
const { httpClient, sideEffects } = arguments[1];
|
|
344
357
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
345
|
-
|
|
358
|
+
query: options?.query
|
|
346
359
|
});
|
|
347
|
-
const reqOpts =
|
|
360
|
+
const reqOpts = queryInventory(payload);
|
|
348
361
|
sideEffects?.onSiteCall?.();
|
|
349
362
|
try {
|
|
350
363
|
const result = await httpClient.request(reqOpts);
|
|
351
364
|
sideEffects?.onSuccess?.(result);
|
|
365
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
352
366
|
} catch (err) {
|
|
353
367
|
const transformedError = (0, import_transform_error.transformError)(
|
|
354
368
|
err,
|
|
355
369
|
{
|
|
356
370
|
spreadPathsToArguments: {},
|
|
357
|
-
explicitPathsToArguments: {
|
|
371
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
358
372
|
singleArgumentUnchanged: false
|
|
359
373
|
},
|
|
360
|
-
["
|
|
374
|
+
["options"]
|
|
361
375
|
);
|
|
362
376
|
sideEffects?.onError?.(err);
|
|
363
377
|
throw transformedError;
|
|
364
378
|
}
|
|
365
379
|
}
|
|
366
|
-
async function
|
|
367
|
-
const { httpClient, sideEffects } = arguments[
|
|
380
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
381
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
368
382
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
369
|
-
|
|
383
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
370
384
|
});
|
|
371
|
-
const reqOpts =
|
|
385
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
372
386
|
sideEffects?.onSiteCall?.();
|
|
373
387
|
try {
|
|
374
388
|
const result = await httpClient.request(reqOpts);
|
|
@@ -377,69 +391,59 @@ async function incrementInventory2(incrementData) {
|
|
|
377
391
|
const transformedError = (0, import_transform_error.transformError)(
|
|
378
392
|
err,
|
|
379
393
|
{
|
|
380
|
-
spreadPathsToArguments: {},
|
|
381
|
-
explicitPathsToArguments: {
|
|
394
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
395
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
382
396
|
singleArgumentUnchanged: false
|
|
383
397
|
},
|
|
384
|
-
["
|
|
398
|
+
["productId", "inventoryItem"]
|
|
385
399
|
);
|
|
386
400
|
sideEffects?.onError?.(err);
|
|
387
401
|
throw transformedError;
|
|
388
402
|
}
|
|
389
403
|
}
|
|
390
|
-
async function
|
|
391
|
-
const { httpClient, sideEffects } = arguments[
|
|
404
|
+
async function decrementInventory2(decrementData) {
|
|
405
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
392
406
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
393
|
-
|
|
394
|
-
externalId: options?.externalId,
|
|
395
|
-
productId: options?.productId,
|
|
396
|
-
variantIds: options?.variantIds
|
|
407
|
+
decrementData
|
|
397
408
|
});
|
|
398
|
-
const reqOpts =
|
|
409
|
+
const reqOpts = decrementInventory(payload);
|
|
399
410
|
sideEffects?.onSiteCall?.();
|
|
400
411
|
try {
|
|
401
412
|
const result = await httpClient.request(reqOpts);
|
|
402
413
|
sideEffects?.onSuccess?.(result);
|
|
403
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
404
414
|
} catch (err) {
|
|
405
415
|
const transformedError = (0, import_transform_error.transformError)(
|
|
406
416
|
err,
|
|
407
417
|
{
|
|
408
418
|
spreadPathsToArguments: {},
|
|
409
|
-
explicitPathsToArguments: {
|
|
410
|
-
inventoryId: "$[0]",
|
|
411
|
-
externalId: "$[1].externalId",
|
|
412
|
-
productId: "$[1].productId",
|
|
413
|
-
variantIds: "$[1].variantIds"
|
|
414
|
-
},
|
|
419
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
415
420
|
singleArgumentUnchanged: false
|
|
416
421
|
},
|
|
417
|
-
["
|
|
422
|
+
["decrementData"]
|
|
418
423
|
);
|
|
419
424
|
sideEffects?.onError?.(err);
|
|
420
425
|
throw transformedError;
|
|
421
426
|
}
|
|
422
427
|
}
|
|
423
|
-
async function
|
|
428
|
+
async function incrementInventory2(incrementData) {
|
|
424
429
|
const { httpClient, sideEffects } = arguments[1];
|
|
425
430
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
426
|
-
|
|
431
|
+
incrementData
|
|
427
432
|
});
|
|
428
|
-
const reqOpts =
|
|
433
|
+
const reqOpts = incrementInventory(payload);
|
|
429
434
|
sideEffects?.onSiteCall?.();
|
|
430
435
|
try {
|
|
431
436
|
const result = await httpClient.request(reqOpts);
|
|
432
437
|
sideEffects?.onSuccess?.(result);
|
|
433
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
434
438
|
} catch (err) {
|
|
435
439
|
const transformedError = (0, import_transform_error.transformError)(
|
|
436
440
|
err,
|
|
437
441
|
{
|
|
438
442
|
spreadPathsToArguments: {},
|
|
439
|
-
explicitPathsToArguments: {
|
|
443
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
440
444
|
singleArgumentUnchanged: false
|
|
441
445
|
},
|
|
442
|
-
["
|
|
446
|
+
["incrementData"]
|
|
443
447
|
);
|
|
444
448
|
sideEffects?.onError?.(err);
|
|
445
449
|
throw transformedError;
|
|
@@ -449,6 +453,21 @@ async function queryInventory2(options) {
|
|
|
449
453
|
// src/stores-v2-inventory-inventory.public.ts
|
|
450
454
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
451
455
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
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
|
+
}
|
|
452
471
|
function updateInventoryVariants3(httpClient) {
|
|
453
472
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
454
473
|
productId,
|
|
@@ -471,21 +490,6 @@ function incrementInventory3(httpClient) {
|
|
|
471
490
|
{ httpClient }
|
|
472
491
|
);
|
|
473
492
|
}
|
|
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
|
-
}
|
|
489
493
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
490
494
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
491
495
|
false,
|
|
@@ -518,11 +522,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
518
522
|
// src/stores-v2-inventory-inventory.context.ts
|
|
519
523
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
520
524
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
525
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
526
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
521
527
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
522
528
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
523
529
|
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);
|
|
526
530
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
527
531
|
onInventoryItemChanged
|
|
528
532
|
);
|