@wix/auto_sdk_stores_inventory 1.0.44 → 1.0.45
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 +171 -171
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +154 -154
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +140 -140
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +21 -21
- package/build/es/index.mjs +171 -171
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +154 -154
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +140 -140
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +21 -21
- package/build/internal/cjs/index.js +171 -171
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +230 -230
- package/build/internal/cjs/index.typings.js +154 -154
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +178 -178
- package/build/internal/cjs/meta.js +140 -140
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +21 -21
- package/build/internal/es/index.mjs +171 -171
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +230 -230
- package/build/internal/es/index.typings.mjs +154 -154
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +178 -178
- package/build/internal/es/meta.mjs +140 -140
- package/build/internal/es/meta.mjs.map +1 -1
- 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`, 5>>;
|
|
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`, 5>>;
|
|
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`, 5>>;
|
|
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`, 5>>;
|
|
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
|
@@ -48,6 +48,67 @@ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
|
48
48
|
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
49
49
|
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
50
50
|
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
51
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
52
|
+
const domainToMappings = {
|
|
53
|
+
"api._api_base_domain_": [
|
|
54
|
+
{
|
|
55
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
56
|
+
destPath: ""
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"manage._base_domain_": [
|
|
60
|
+
{
|
|
61
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
62
|
+
destPath: ""
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"www.wixapis.com": [
|
|
66
|
+
{
|
|
67
|
+
srcPath: "/stores-reader/v2/collections",
|
|
68
|
+
destPath: "/v2/collections"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
72
|
+
destPath: "/v2/inventoryItems"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"www._base_domain_": [
|
|
76
|
+
{
|
|
77
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
78
|
+
destPath: ""
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"editor._base_domain_": [
|
|
82
|
+
{
|
|
83
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
84
|
+
destPath: ""
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"blocks._base_domain_": [
|
|
88
|
+
{
|
|
89
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
90
|
+
destPath: ""
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"create.editorx": [
|
|
94
|
+
{
|
|
95
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
96
|
+
destPath: ""
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
_: [
|
|
100
|
+
{
|
|
101
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
102
|
+
destPath: "/v2/inventoryItems"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
srcPath: "/stores-reader/v2/collections",
|
|
106
|
+
destPath: "/v2/collections"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
111
|
+
}
|
|
51
112
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
52
113
|
const domainToMappings = {
|
|
53
114
|
"api._api_base_domain_": [
|
|
@@ -131,122 +192,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
131
192
|
};
|
|
132
193
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
133
194
|
}
|
|
134
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
135
|
-
const domainToMappings = {
|
|
136
|
-
"api._api_base_domain_": [
|
|
137
|
-
{
|
|
138
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
139
|
-
destPath: ""
|
|
140
|
-
}
|
|
141
|
-
],
|
|
142
|
-
"manage._base_domain_": [
|
|
143
|
-
{
|
|
144
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
145
|
-
destPath: ""
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
"www.wixapis.com": [
|
|
149
|
-
{
|
|
150
|
-
srcPath: "/stores-reader/v2/collections",
|
|
151
|
-
destPath: "/v2/collections"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
155
|
-
destPath: "/v2/inventoryItems"
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
"www._base_domain_": [
|
|
159
|
-
{
|
|
160
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
161
|
-
destPath: ""
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"editor._base_domain_": [
|
|
165
|
-
{
|
|
166
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
167
|
-
destPath: ""
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"blocks._base_domain_": [
|
|
171
|
-
{
|
|
172
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
173
|
-
destPath: ""
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"create.editorx": [
|
|
177
|
-
{
|
|
178
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
179
|
-
destPath: ""
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
_: [
|
|
183
|
-
{
|
|
184
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
185
|
-
destPath: "/v2/inventoryItems"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
srcPath: "/stores-reader/v2/collections",
|
|
189
|
-
destPath: "/v2/collections"
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
};
|
|
193
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
194
|
-
}
|
|
195
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: [{ path: "inventoryItem.lastUpdated" }]
|
|
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: [{ path: "inventoryItems.lastUpdated" }]
|
|
243
|
-
}
|
|
244
|
-
])
|
|
245
|
-
};
|
|
246
|
-
return metadata;
|
|
247
|
-
}
|
|
248
|
-
return __queryInventory;
|
|
249
|
-
}
|
|
250
196
|
function updateInventoryVariants(payload) {
|
|
251
197
|
function __updateInventoryVariants({ host }) {
|
|
252
198
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -316,6 +262,60 @@ function incrementInventory(payload) {
|
|
|
316
262
|
}
|
|
317
263
|
return __incrementInventory;
|
|
318
264
|
}
|
|
265
|
+
function getInventoryVariants(payload) {
|
|
266
|
+
function __getInventoryVariants({ host }) {
|
|
267
|
+
const metadata = {
|
|
268
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
269
|
+
method: "POST",
|
|
270
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
271
|
+
packageName: PACKAGE_NAME,
|
|
272
|
+
migrationOptions: {
|
|
273
|
+
optInTransformResponse: true
|
|
274
|
+
},
|
|
275
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
276
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
277
|
+
data: payload,
|
|
278
|
+
host
|
|
279
|
+
}),
|
|
280
|
+
data: payload,
|
|
281
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
282
|
+
{
|
|
283
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
284
|
+
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
285
|
+
}
|
|
286
|
+
])
|
|
287
|
+
};
|
|
288
|
+
return metadata;
|
|
289
|
+
}
|
|
290
|
+
return __getInventoryVariants;
|
|
291
|
+
}
|
|
292
|
+
function queryInventory(payload) {
|
|
293
|
+
function __queryInventory({ host }) {
|
|
294
|
+
const metadata = {
|
|
295
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
296
|
+
method: "POST",
|
|
297
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
298
|
+
packageName: PACKAGE_NAME,
|
|
299
|
+
migrationOptions: {
|
|
300
|
+
optInTransformResponse: true
|
|
301
|
+
},
|
|
302
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
303
|
+
protoPath: "/v2/inventoryItems/query",
|
|
304
|
+
data: payload,
|
|
305
|
+
host
|
|
306
|
+
}),
|
|
307
|
+
data: payload,
|
|
308
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
309
|
+
{
|
|
310
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
311
|
+
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
312
|
+
}
|
|
313
|
+
])
|
|
314
|
+
};
|
|
315
|
+
return metadata;
|
|
316
|
+
}
|
|
317
|
+
return __queryInventory;
|
|
318
|
+
}
|
|
319
319
|
|
|
320
320
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
321
321
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -333,70 +333,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
333
333
|
WebhookIdentityType2["APP"] = "APP";
|
|
334
334
|
return WebhookIdentityType2;
|
|
335
335
|
})(WebhookIdentityType || {});
|
|
336
|
-
async function
|
|
336
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
337
337
|
const { httpClient, sideEffects } = arguments[2];
|
|
338
338
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
339
|
-
|
|
340
|
-
externalId: options?.externalId,
|
|
341
|
-
productId: options?.productId,
|
|
342
|
-
variantIds: options?.variantIds
|
|
339
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
343
340
|
});
|
|
344
|
-
const reqOpts =
|
|
341
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
345
342
|
sideEffects?.onSiteCall?.();
|
|
346
343
|
try {
|
|
347
344
|
const result = await httpClient.request(reqOpts);
|
|
348
345
|
sideEffects?.onSuccess?.(result);
|
|
349
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
350
346
|
} catch (err) {
|
|
351
347
|
const transformedError = (0, import_transform_error.transformError)(
|
|
352
348
|
err,
|
|
353
349
|
{
|
|
354
|
-
spreadPathsToArguments: {},
|
|
355
|
-
explicitPathsToArguments: {
|
|
356
|
-
inventoryId: "$[0]",
|
|
357
|
-
externalId: "$[1].externalId",
|
|
358
|
-
productId: "$[1].productId",
|
|
359
|
-
variantIds: "$[1].variantIds"
|
|
360
|
-
},
|
|
350
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
351
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
361
352
|
singleArgumentUnchanged: false
|
|
362
353
|
},
|
|
363
|
-
["
|
|
354
|
+
["productId", "inventoryItem"]
|
|
364
355
|
);
|
|
365
356
|
sideEffects?.onError?.(err);
|
|
366
357
|
throw transformedError;
|
|
367
358
|
}
|
|
368
359
|
}
|
|
369
|
-
async function
|
|
360
|
+
async function decrementInventory2(decrementData) {
|
|
370
361
|
const { httpClient, sideEffects } = arguments[1];
|
|
371
362
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
372
|
-
|
|
363
|
+
decrementData
|
|
373
364
|
});
|
|
374
|
-
const reqOpts =
|
|
365
|
+
const reqOpts = decrementInventory(payload);
|
|
375
366
|
sideEffects?.onSiteCall?.();
|
|
376
367
|
try {
|
|
377
368
|
const result = await httpClient.request(reqOpts);
|
|
378
369
|
sideEffects?.onSuccess?.(result);
|
|
379
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
380
370
|
} catch (err) {
|
|
381
371
|
const transformedError = (0, import_transform_error.transformError)(
|
|
382
372
|
err,
|
|
383
373
|
{
|
|
384
374
|
spreadPathsToArguments: {},
|
|
385
|
-
explicitPathsToArguments: {
|
|
375
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
386
376
|
singleArgumentUnchanged: false
|
|
387
377
|
},
|
|
388
|
-
["
|
|
378
|
+
["decrementData"]
|
|
389
379
|
);
|
|
390
380
|
sideEffects?.onError?.(err);
|
|
391
381
|
throw transformedError;
|
|
392
382
|
}
|
|
393
383
|
}
|
|
394
|
-
async function
|
|
395
|
-
const { httpClient, sideEffects } = arguments[
|
|
384
|
+
async function incrementInventory2(incrementData) {
|
|
385
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
396
386
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
397
|
-
|
|
387
|
+
incrementData
|
|
398
388
|
});
|
|
399
|
-
const reqOpts =
|
|
389
|
+
const reqOpts = incrementInventory(payload);
|
|
400
390
|
sideEffects?.onSiteCall?.();
|
|
401
391
|
try {
|
|
402
392
|
const result = await httpClient.request(reqOpts);
|
|
@@ -405,59 +395,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
405
395
|
const transformedError = (0, import_transform_error.transformError)(
|
|
406
396
|
err,
|
|
407
397
|
{
|
|
408
|
-
spreadPathsToArguments: {
|
|
409
|
-
explicitPathsToArguments: {
|
|
398
|
+
spreadPathsToArguments: {},
|
|
399
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
410
400
|
singleArgumentUnchanged: false
|
|
411
401
|
},
|
|
412
|
-
["
|
|
402
|
+
["incrementData"]
|
|
413
403
|
);
|
|
414
404
|
sideEffects?.onError?.(err);
|
|
415
405
|
throw transformedError;
|
|
416
406
|
}
|
|
417
407
|
}
|
|
418
|
-
async function
|
|
419
|
-
const { httpClient, sideEffects } = arguments[
|
|
408
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
409
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
420
410
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
421
|
-
|
|
411
|
+
inventoryId,
|
|
412
|
+
externalId: options?.externalId,
|
|
413
|
+
productId: options?.productId,
|
|
414
|
+
variantIds: options?.variantIds
|
|
422
415
|
});
|
|
423
|
-
const reqOpts =
|
|
416
|
+
const reqOpts = getInventoryVariants(payload);
|
|
424
417
|
sideEffects?.onSiteCall?.();
|
|
425
418
|
try {
|
|
426
419
|
const result = await httpClient.request(reqOpts);
|
|
427
420
|
sideEffects?.onSuccess?.(result);
|
|
421
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
428
422
|
} catch (err) {
|
|
429
423
|
const transformedError = (0, import_transform_error.transformError)(
|
|
430
424
|
err,
|
|
431
425
|
{
|
|
432
426
|
spreadPathsToArguments: {},
|
|
433
|
-
explicitPathsToArguments: {
|
|
427
|
+
explicitPathsToArguments: {
|
|
428
|
+
inventoryId: "$[0]",
|
|
429
|
+
externalId: "$[1].externalId",
|
|
430
|
+
productId: "$[1].productId",
|
|
431
|
+
variantIds: "$[1].variantIds"
|
|
432
|
+
},
|
|
434
433
|
singleArgumentUnchanged: false
|
|
435
434
|
},
|
|
436
|
-
["
|
|
435
|
+
["inventoryId", "options"]
|
|
437
436
|
);
|
|
438
437
|
sideEffects?.onError?.(err);
|
|
439
438
|
throw transformedError;
|
|
440
439
|
}
|
|
441
440
|
}
|
|
442
|
-
async function
|
|
441
|
+
async function queryInventory2(options) {
|
|
443
442
|
const { httpClient, sideEffects } = arguments[1];
|
|
444
443
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
445
|
-
|
|
444
|
+
query: options?.query
|
|
446
445
|
});
|
|
447
|
-
const reqOpts =
|
|
446
|
+
const reqOpts = queryInventory(payload);
|
|
448
447
|
sideEffects?.onSiteCall?.();
|
|
449
448
|
try {
|
|
450
449
|
const result = await httpClient.request(reqOpts);
|
|
451
450
|
sideEffects?.onSuccess?.(result);
|
|
451
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
452
452
|
} catch (err) {
|
|
453
453
|
const transformedError = (0, import_transform_error.transformError)(
|
|
454
454
|
err,
|
|
455
455
|
{
|
|
456
456
|
spreadPathsToArguments: {},
|
|
457
|
-
explicitPathsToArguments: {
|
|
457
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
458
458
|
singleArgumentUnchanged: false
|
|
459
459
|
},
|
|
460
|
-
["
|
|
460
|
+
["options"]
|
|
461
461
|
);
|
|
462
462
|
sideEffects?.onError?.(err);
|
|
463
463
|
throw transformedError;
|
|
@@ -465,21 +465,6 @@ async function incrementInventory2(incrementData) {
|
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
// src/stores-v2-inventory-inventory.public.ts
|
|
468
|
-
function getInventoryVariants3(httpClient) {
|
|
469
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
470
|
-
inventoryId,
|
|
471
|
-
options,
|
|
472
|
-
// @ts-ignore
|
|
473
|
-
{ httpClient }
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
function queryInventory3(httpClient) {
|
|
477
|
-
return (options) => queryInventory2(
|
|
478
|
-
options,
|
|
479
|
-
// @ts-ignore
|
|
480
|
-
{ httpClient }
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
468
|
function updateInventoryVariants3(httpClient) {
|
|
484
469
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
485
470
|
productId,
|
|
@@ -502,6 +487,21 @@ function incrementInventory3(httpClient) {
|
|
|
502
487
|
{ httpClient }
|
|
503
488
|
);
|
|
504
489
|
}
|
|
490
|
+
function getInventoryVariants3(httpClient) {
|
|
491
|
+
return (inventoryId, options) => getInventoryVariants2(
|
|
492
|
+
inventoryId,
|
|
493
|
+
options,
|
|
494
|
+
// @ts-ignore
|
|
495
|
+
{ httpClient }
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
function queryInventory3(httpClient) {
|
|
499
|
+
return (options) => queryInventory2(
|
|
500
|
+
options,
|
|
501
|
+
// @ts-ignore
|
|
502
|
+
{ httpClient }
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
505
|
var onInventoryItemChanged = (0, import_sdk_types.EventDefinition)(
|
|
506
506
|
"com.wix.ecommerce.inventory.api.v1.InventoryItemChanged",
|
|
507
507
|
false,
|
|
@@ -534,11 +534,11 @@ var onInventoryVariantsChanged = (0, import_sdk_types.EventDefinition)(
|
|
|
534
534
|
// src/stores-v2-inventory-inventory.context.ts
|
|
535
535
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
536
536
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
537
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
538
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
539
537
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
540
538
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
541
539
|
var incrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(incrementInventory3);
|
|
540
|
+
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
541
|
+
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
542
542
|
var onInventoryItemChanged2 = (0, import_event_definition_modules.createEventModule)(
|
|
543
543
|
onInventoryItemChanged
|
|
544
544
|
);
|