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