@wix/auto_sdk_stores_inventory 1.0.96 → 1.0.98
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 +141 -145
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +124 -128
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +110 -114
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +141 -145
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +124 -128
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +110 -114
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +21 -21
- package/build/internal/cjs/index.typings.d.ts +242 -242
- package/build/internal/cjs/meta.d.ts +190 -190
- package/build/internal/es/index.d.mts +21 -21
- package/build/internal/es/index.typings.d.mts +242 -242
- package/build/internal/es/meta.d.mts +190 -190
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
|
|
2
|
-
import {
|
|
2
|
+
import { UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, InventoryItemChangedEnvelope, InventoryVariantsChangedEnvelope } from './index.typings.js';
|
|
3
3
|
export { AccountInfo, BaseEventMetadata, BulkUpdateInventoryItemsRequest, BulkUpdateInventoryItemsResponse, BulkUpdateInventoryVariantsRequest, BulkUpdateInventoryVariantsRequestActionOneOf, BulkUpdateInventoryVariantsResponse, ChangedInventoryVariant, ChangedInventoryVariantData, DecrementDataIdOneOf, DecrementInventoryRequest, DecrementInventoryResponse, GetInventoryItemsRequest, GetInventoryItemsResponse, GetInventoryVariantsOptionsIdOneOf, GetInventoryVariantsRequest, GetInventoryVariantsRequestIdOneOf, IdentificationData, IdentificationDataIdOneOf, IncrementDataIdOneOf, IncrementInventoryRequest, IncrementInventoryResponse, InventoryItemChanged, InventoryItemV2, InventoryVariantV2, InventoryVariantsChanged, MessageEnvelope, Paging, PagingMetadata, PreorderInfo, Query, QueryInventoryRequest, ReasonType, ReasonTypeWithLiterals, UpdateInventoryVariantsRequest, UpdateInventoryVariantsResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
|
|
4
4
|
|
|
5
|
-
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
6
|
-
interface GetInventoryVariantsSignature {
|
|
7
|
-
/**
|
|
8
|
-
* Gets inventory variant information based on the specified option choices.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
12
|
-
* @param - Inventory item ID.
|
|
13
|
-
*/
|
|
14
|
-
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
15
|
-
}
|
|
16
|
-
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
17
|
-
interface QueryInventorySignature {
|
|
18
|
-
/**
|
|
19
|
-
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
20
|
-
*/
|
|
21
|
-
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
22
|
-
}
|
|
23
5
|
declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
|
|
24
6
|
interface UpdateInventoryVariantsSignature {
|
|
25
7
|
/**
|
|
@@ -54,14 +36,32 @@ interface IncrementInventorySignature {
|
|
|
54
36
|
*/
|
|
55
37
|
(incrementData: IncrementData[]): Promise<void>;
|
|
56
38
|
}
|
|
39
|
+
declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
|
|
40
|
+
interface GetInventoryVariantsSignature {
|
|
41
|
+
/**
|
|
42
|
+
* Gets inventory variant information based on the specified option choices.
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
* The `getInventoryVariants()` function returns a Promise that resolves to the specified inventory variant information.
|
|
46
|
+
* @param - Inventory item ID.
|
|
47
|
+
*/
|
|
48
|
+
(inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 3>>;
|
|
49
|
+
}
|
|
50
|
+
declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
|
|
51
|
+
interface QueryInventorySignature {
|
|
52
|
+
/**
|
|
53
|
+
* Returns a list of inventory items, given the provided paging, sorting and filtering.
|
|
54
|
+
*/
|
|
55
|
+
(options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 3>>;
|
|
56
|
+
}
|
|
57
57
|
declare const onInventoryItemChanged$1: EventDefinition<InventoryItemChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryItemChanged">;
|
|
58
58
|
declare const onInventoryVariantsChanged$1: EventDefinition<InventoryVariantsChangedEnvelope, "com.wix.ecommerce.inventory.api.v1.InventoryVariantsChanged">;
|
|
59
59
|
|
|
60
|
-
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
61
|
-
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
62
60
|
declare const updateInventoryVariants: MaybeContext<BuildRESTFunction<typeof updateInventoryVariants$1> & typeof updateInventoryVariants$1>;
|
|
63
61
|
declare const decrementInventory: MaybeContext<BuildRESTFunction<typeof decrementInventory$1> & typeof decrementInventory$1>;
|
|
64
62
|
declare const incrementInventory: MaybeContext<BuildRESTFunction<typeof incrementInventory$1> & typeof incrementInventory$1>;
|
|
63
|
+
declare const getInventoryVariants: MaybeContext<BuildRESTFunction<typeof getInventoryVariants$1> & typeof getInventoryVariants$1>;
|
|
64
|
+
declare const queryInventory: MaybeContext<BuildRESTFunction<typeof queryInventory$1> & typeof queryInventory$1>;
|
|
65
65
|
/**
|
|
66
66
|
* Triggered when an inventory item is changed.
|
|
67
67
|
*/
|
package/build/cjs/index.js
CHANGED
|
@@ -50,18 +50,37 @@ 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 resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
54
54
|
const domainToMappings = {
|
|
55
|
-
"www.
|
|
55
|
+
"www.wixapis.com": [
|
|
56
56
|
{
|
|
57
|
-
srcPath: "/
|
|
58
|
-
destPath: ""
|
|
59
|
-
}
|
|
57
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
58
|
+
destPath: "/v2/inventoryItems"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"api._api_base_domain_": [
|
|
60
62
|
{
|
|
61
|
-
srcPath: "/
|
|
63
|
+
srcPath: "/inventory-read-api-proxy",
|
|
62
64
|
destPath: ""
|
|
63
65
|
}
|
|
64
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
|
+
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
83
|
+
const domainToMappings = {
|
|
65
84
|
_: [
|
|
66
85
|
{
|
|
67
86
|
srcPath: "/_api/catalog-server",
|
|
@@ -134,111 +153,34 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
134
153
|
destPath: ""
|
|
135
154
|
}
|
|
136
155
|
],
|
|
137
|
-
"
|
|
156
|
+
"www._base_domain_": [
|
|
138
157
|
{
|
|
139
|
-
srcPath: "/
|
|
158
|
+
srcPath: "/catalog-write-api-proxy",
|
|
140
159
|
destPath: ""
|
|
141
160
|
}
|
|
142
161
|
],
|
|
143
|
-
"
|
|
162
|
+
"editor._base_domain_": [
|
|
144
163
|
{
|
|
145
164
|
srcPath: "/_api/catalog-write-api-proxy",
|
|
146
165
|
destPath: ""
|
|
147
166
|
}
|
|
148
167
|
],
|
|
149
|
-
"
|
|
168
|
+
"blocks._base_domain_": [
|
|
150
169
|
{
|
|
151
170
|
srcPath: "/_api/catalog-write-api-proxy",
|
|
152
171
|
destPath: ""
|
|
153
172
|
}
|
|
154
|
-
]
|
|
155
|
-
};
|
|
156
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
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
173
|
],
|
|
166
|
-
"
|
|
174
|
+
"create.editorx": [
|
|
167
175
|
{
|
|
168
|
-
srcPath: "/
|
|
176
|
+
srcPath: "/_api/catalog-write-api-proxy",
|
|
169
177
|
destPath: ""
|
|
170
178
|
}
|
|
171
|
-
],
|
|
172
|
-
_: [
|
|
173
|
-
{
|
|
174
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
175
|
-
destPath: "/v2/inventoryItems"
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
"*.dev.wix-code.com": [
|
|
179
|
-
{
|
|
180
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
181
|
-
destPath: "/v2/inventoryItems"
|
|
182
|
-
}
|
|
183
179
|
]
|
|
184
180
|
};
|
|
185
181
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
186
182
|
}
|
|
187
183
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
188
|
-
function getInventoryVariants(payload) {
|
|
189
|
-
function __getInventoryVariants({ host }) {
|
|
190
|
-
const metadata = {
|
|
191
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
192
|
-
method: "POST",
|
|
193
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
194
|
-
packageName: PACKAGE_NAME,
|
|
195
|
-
migrationOptions: {
|
|
196
|
-
optInTransformResponse: true
|
|
197
|
-
},
|
|
198
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
199
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
200
|
-
data: payload,
|
|
201
|
-
host
|
|
202
|
-
}),
|
|
203
|
-
data: payload,
|
|
204
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
205
|
-
{
|
|
206
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
207
|
-
paths: TRANSFORM_PATHS_0
|
|
208
|
-
}
|
|
209
|
-
])
|
|
210
|
-
};
|
|
211
|
-
return metadata;
|
|
212
|
-
}
|
|
213
|
-
return __getInventoryVariants;
|
|
214
|
-
}
|
|
215
|
-
function queryInventory(payload) {
|
|
216
|
-
function __queryInventory({ host }) {
|
|
217
|
-
const metadata = {
|
|
218
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
219
|
-
method: "POST",
|
|
220
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
221
|
-
packageName: PACKAGE_NAME,
|
|
222
|
-
migrationOptions: {
|
|
223
|
-
optInTransformResponse: true
|
|
224
|
-
},
|
|
225
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
226
|
-
protoPath: "/v2/inventoryItems/query",
|
|
227
|
-
data: payload,
|
|
228
|
-
host
|
|
229
|
-
}),
|
|
230
|
-
data: payload,
|
|
231
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
232
|
-
{
|
|
233
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
234
|
-
paths: TRANSFORM_PATHS_1
|
|
235
|
-
}
|
|
236
|
-
])
|
|
237
|
-
};
|
|
238
|
-
return metadata;
|
|
239
|
-
}
|
|
240
|
-
return __queryInventory;
|
|
241
|
-
}
|
|
242
184
|
function updateInventoryVariants(payload) {
|
|
243
185
|
function __updateInventoryVariants({ host }) {
|
|
244
186
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -308,6 +250,60 @@ function incrementInventory(payload) {
|
|
|
308
250
|
}
|
|
309
251
|
return __incrementInventory;
|
|
310
252
|
}
|
|
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
|
+
}
|
|
311
307
|
|
|
312
308
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
313
309
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -325,70 +321,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
325
321
|
WebhookIdentityType2["APP"] = "APP";
|
|
326
322
|
return WebhookIdentityType2;
|
|
327
323
|
})(WebhookIdentityType || {});
|
|
328
|
-
async function
|
|
324
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
329
325
|
const { httpClient, sideEffects } = arguments[2];
|
|
330
326
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
331
|
-
|
|
332
|
-
externalId: options?.externalId,
|
|
333
|
-
productId: options?.productId,
|
|
334
|
-
variantIds: options?.variantIds
|
|
327
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
335
328
|
});
|
|
336
|
-
const reqOpts =
|
|
329
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
337
330
|
sideEffects?.onSiteCall?.();
|
|
338
331
|
try {
|
|
339
332
|
const result = await httpClient.request(reqOpts);
|
|
340
333
|
sideEffects?.onSuccess?.(result);
|
|
341
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
342
334
|
} catch (err) {
|
|
343
335
|
const transformedError = (0, import_transform_error.transformError)(
|
|
344
336
|
err,
|
|
345
337
|
{
|
|
346
|
-
spreadPathsToArguments: {},
|
|
347
|
-
explicitPathsToArguments: {
|
|
348
|
-
inventoryId: "$[0]",
|
|
349
|
-
externalId: "$[1].externalId",
|
|
350
|
-
productId: "$[1].productId",
|
|
351
|
-
variantIds: "$[1].variantIds"
|
|
352
|
-
},
|
|
338
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
339
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
353
340
|
singleArgumentUnchanged: false
|
|
354
341
|
},
|
|
355
|
-
["
|
|
342
|
+
["productId", "inventoryItem"]
|
|
356
343
|
);
|
|
357
344
|
sideEffects?.onError?.(err);
|
|
358
345
|
throw transformedError;
|
|
359
346
|
}
|
|
360
347
|
}
|
|
361
|
-
async function
|
|
348
|
+
async function decrementInventory2(decrementData) {
|
|
362
349
|
const { httpClient, sideEffects } = arguments[1];
|
|
363
350
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
364
|
-
|
|
351
|
+
decrementData
|
|
365
352
|
});
|
|
366
|
-
const reqOpts =
|
|
353
|
+
const reqOpts = decrementInventory(payload);
|
|
367
354
|
sideEffects?.onSiteCall?.();
|
|
368
355
|
try {
|
|
369
356
|
const result = await httpClient.request(reqOpts);
|
|
370
357
|
sideEffects?.onSuccess?.(result);
|
|
371
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
372
358
|
} catch (err) {
|
|
373
359
|
const transformedError = (0, import_transform_error.transformError)(
|
|
374
360
|
err,
|
|
375
361
|
{
|
|
376
362
|
spreadPathsToArguments: {},
|
|
377
|
-
explicitPathsToArguments: {
|
|
363
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
378
364
|
singleArgumentUnchanged: false
|
|
379
365
|
},
|
|
380
|
-
["
|
|
366
|
+
["decrementData"]
|
|
381
367
|
);
|
|
382
368
|
sideEffects?.onError?.(err);
|
|
383
369
|
throw transformedError;
|
|
384
370
|
}
|
|
385
371
|
}
|
|
386
|
-
async function
|
|
387
|
-
const { httpClient, sideEffects } = arguments[
|
|
372
|
+
async function incrementInventory2(incrementData) {
|
|
373
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
388
374
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
389
|
-
|
|
375
|
+
incrementData
|
|
390
376
|
});
|
|
391
|
-
const reqOpts =
|
|
377
|
+
const reqOpts = incrementInventory(payload);
|
|
392
378
|
sideEffects?.onSiteCall?.();
|
|
393
379
|
try {
|
|
394
380
|
const result = await httpClient.request(reqOpts);
|
|
@@ -397,59 +383,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
397
383
|
const transformedError = (0, import_transform_error.transformError)(
|
|
398
384
|
err,
|
|
399
385
|
{
|
|
400
|
-
spreadPathsToArguments: {
|
|
401
|
-
explicitPathsToArguments: {
|
|
386
|
+
spreadPathsToArguments: {},
|
|
387
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
402
388
|
singleArgumentUnchanged: false
|
|
403
389
|
},
|
|
404
|
-
["
|
|
390
|
+
["incrementData"]
|
|
405
391
|
);
|
|
406
392
|
sideEffects?.onError?.(err);
|
|
407
393
|
throw transformedError;
|
|
408
394
|
}
|
|
409
395
|
}
|
|
410
|
-
async function
|
|
411
|
-
const { httpClient, sideEffects } = arguments[
|
|
396
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
397
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
412
398
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
413
|
-
|
|
399
|
+
inventoryId,
|
|
400
|
+
externalId: options?.externalId,
|
|
401
|
+
productId: options?.productId,
|
|
402
|
+
variantIds: options?.variantIds
|
|
414
403
|
});
|
|
415
|
-
const reqOpts =
|
|
404
|
+
const reqOpts = getInventoryVariants(payload);
|
|
416
405
|
sideEffects?.onSiteCall?.();
|
|
417
406
|
try {
|
|
418
407
|
const result = await httpClient.request(reqOpts);
|
|
419
408
|
sideEffects?.onSuccess?.(result);
|
|
409
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
420
410
|
} catch (err) {
|
|
421
411
|
const transformedError = (0, import_transform_error.transformError)(
|
|
422
412
|
err,
|
|
423
413
|
{
|
|
424
414
|
spreadPathsToArguments: {},
|
|
425
|
-
explicitPathsToArguments: {
|
|
415
|
+
explicitPathsToArguments: {
|
|
416
|
+
inventoryId: "$[0]",
|
|
417
|
+
externalId: "$[1].externalId",
|
|
418
|
+
productId: "$[1].productId",
|
|
419
|
+
variantIds: "$[1].variantIds"
|
|
420
|
+
},
|
|
426
421
|
singleArgumentUnchanged: false
|
|
427
422
|
},
|
|
428
|
-
["
|
|
423
|
+
["inventoryId", "options"]
|
|
429
424
|
);
|
|
430
425
|
sideEffects?.onError?.(err);
|
|
431
426
|
throw transformedError;
|
|
432
427
|
}
|
|
433
428
|
}
|
|
434
|
-
async function
|
|
429
|
+
async function queryInventory2(options) {
|
|
435
430
|
const { httpClient, sideEffects } = arguments[1];
|
|
436
431
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
437
|
-
|
|
432
|
+
query: options?.query
|
|
438
433
|
});
|
|
439
|
-
const reqOpts =
|
|
434
|
+
const reqOpts = queryInventory(payload);
|
|
440
435
|
sideEffects?.onSiteCall?.();
|
|
441
436
|
try {
|
|
442
437
|
const result = await httpClient.request(reqOpts);
|
|
443
438
|
sideEffects?.onSuccess?.(result);
|
|
439
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
444
440
|
} catch (err) {
|
|
445
441
|
const transformedError = (0, import_transform_error.transformError)(
|
|
446
442
|
err,
|
|
447
443
|
{
|
|
448
444
|
spreadPathsToArguments: {},
|
|
449
|
-
explicitPathsToArguments: {
|
|
445
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
450
446
|
singleArgumentUnchanged: false
|
|
451
447
|
},
|
|
452
|
-
["
|
|
448
|
+
["options"]
|
|
453
449
|
);
|
|
454
450
|
sideEffects?.onError?.(err);
|
|
455
451
|
throw transformedError;
|
|
@@ -459,21 +455,6 @@ async function incrementInventory2(incrementData) {
|
|
|
459
455
|
// src/stores-v2-inventory-inventory.public.ts
|
|
460
456
|
var TRANSFORM_PATHS_02 = [{ path: "data.fieldMask" }];
|
|
461
457
|
var TRANSFORM_PATHS_12 = [{ path: "data.updatedDate" }];
|
|
462
|
-
function getInventoryVariants3(httpClient) {
|
|
463
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
464
|
-
inventoryId,
|
|
465
|
-
options,
|
|
466
|
-
// @ts-ignore
|
|
467
|
-
{ httpClient }
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
function queryInventory3(httpClient) {
|
|
471
|
-
return (options) => queryInventory2(
|
|
472
|
-
options,
|
|
473
|
-
// @ts-ignore
|
|
474
|
-
{ httpClient }
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
458
|
function updateInventoryVariants3(httpClient) {
|
|
478
459
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
479
460
|
productId,
|
|
@@ -496,6 +477,21 @@ function incrementInventory3(httpClient) {
|
|
|
496
477
|
{ httpClient }
|
|
497
478
|
);
|
|
498
479
|
}
|
|
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
|
+
}
|
|
499
495
|
var onInventoryItemChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefinition)(
|
|
500
496
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
501
497
|
false,
|
|
@@ -528,11 +524,11 @@ var onInventoryVariantsChanged = /* @__PURE__ */ (0, import_sdk_types.EventDefin
|
|
|
528
524
|
// src/stores-v2-inventory-inventory.context.ts
|
|
529
525
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
530
526
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
531
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
532
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
533
527
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
534
528
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
535
529
|
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);
|
|
536
532
|
var onInventoryItemChanged2 = /* @__PURE__ */ (0, import_event_definition_modules.createEventModule)(
|
|
537
533
|
onInventoryItemChanged
|
|
538
534
|
);
|