@wix/auto_sdk_stores_inventory 1.0.65 → 1.0.67
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 +24 -34
- package/build/cjs/index.js +176 -417
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +153 -394
- 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/cjs/schemas.d.ts +63 -63
- package/build/cjs/schemas.js +100 -100
- package/build/cjs/schemas.js.map +1 -1
- package/build/es/index.d.mts +24 -34
- package/build/es/index.mjs +176 -407
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +153 -384
- 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/es/schemas.d.mts +63 -63
- package/build/es/schemas.mjs +100 -100
- package/build/es/schemas.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +24 -34
- package/build/internal/cjs/index.js +176 -417
- 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 +153 -394
- 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/cjs/schemas.d.ts +63 -63
- package/build/internal/cjs/schemas.js +100 -100
- package/build/internal/cjs/schemas.js.map +1 -1
- package/build/internal/es/index.d.mts +24 -34
- package/build/internal/es/index.mjs +176 -407
- 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 +153 -384
- 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/build/internal/es/schemas.d.mts +63 -63
- package/build/internal/es/schemas.mjs +100 -100
- package/build/internal/es/schemas.mjs.map +1 -1
- package/package.json +2 -2
package/build/cjs/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// index.ts
|
|
@@ -58,6 +48,67 @@ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
|
58
48
|
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
59
49
|
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
60
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
|
+
}
|
|
61
112
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
62
113
|
const domainToMappings = {
|
|
63
114
|
"api._api_base_domain_": [
|
|
@@ -141,122 +192,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
141
192
|
};
|
|
142
193
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
143
194
|
}
|
|
144
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
145
|
-
const domainToMappings = {
|
|
146
|
-
"api._api_base_domain_": [
|
|
147
|
-
{
|
|
148
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
149
|
-
destPath: ""
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"manage._base_domain_": [
|
|
153
|
-
{
|
|
154
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
155
|
-
destPath: ""
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
"www.wixapis.com": [
|
|
159
|
-
{
|
|
160
|
-
srcPath: "/stores-reader/v2/collections",
|
|
161
|
-
destPath: "/v2/collections"
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
165
|
-
destPath: "/v2/inventoryItems"
|
|
166
|
-
}
|
|
167
|
-
],
|
|
168
|
-
"www._base_domain_": [
|
|
169
|
-
{
|
|
170
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
171
|
-
destPath: ""
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"editor._base_domain_": [
|
|
175
|
-
{
|
|
176
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
177
|
-
destPath: ""
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
"blocks._base_domain_": [
|
|
181
|
-
{
|
|
182
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
183
|
-
destPath: ""
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
"create.editorx": [
|
|
187
|
-
{
|
|
188
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
189
|
-
destPath: ""
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
_: [
|
|
193
|
-
{
|
|
194
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
195
|
-
destPath: "/v2/inventoryItems"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
srcPath: "/stores-reader/v2/collections",
|
|
199
|
-
destPath: "/v2/collections"
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
};
|
|
203
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
204
|
-
}
|
|
205
195
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
206
|
-
function getInventoryVariants(payload) {
|
|
207
|
-
function __getInventoryVariants({ host }) {
|
|
208
|
-
const metadata = {
|
|
209
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
210
|
-
method: "POST",
|
|
211
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
212
|
-
packageName: PACKAGE_NAME,
|
|
213
|
-
migrationOptions: {
|
|
214
|
-
optInTransformResponse: true
|
|
215
|
-
},
|
|
216
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
217
|
-
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
218
|
-
data: payload,
|
|
219
|
-
host
|
|
220
|
-
}),
|
|
221
|
-
data: payload,
|
|
222
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
223
|
-
{
|
|
224
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
225
|
-
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
226
|
-
}
|
|
227
|
-
])
|
|
228
|
-
};
|
|
229
|
-
return metadata;
|
|
230
|
-
}
|
|
231
|
-
return __getInventoryVariants;
|
|
232
|
-
}
|
|
233
|
-
function queryInventory(payload) {
|
|
234
|
-
function __queryInventory({ host }) {
|
|
235
|
-
const metadata = {
|
|
236
|
-
entityFqdn: "wix.stores.v2.inventory",
|
|
237
|
-
method: "POST",
|
|
238
|
-
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
239
|
-
packageName: PACKAGE_NAME,
|
|
240
|
-
migrationOptions: {
|
|
241
|
-
optInTransformResponse: true
|
|
242
|
-
},
|
|
243
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
244
|
-
protoPath: "/v2/inventoryItems/query",
|
|
245
|
-
data: payload,
|
|
246
|
-
host
|
|
247
|
-
}),
|
|
248
|
-
data: payload,
|
|
249
|
-
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
250
|
-
{
|
|
251
|
-
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
252
|
-
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
253
|
-
}
|
|
254
|
-
])
|
|
255
|
-
};
|
|
256
|
-
return metadata;
|
|
257
|
-
}
|
|
258
|
-
return __queryInventory;
|
|
259
|
-
}
|
|
260
196
|
function updateInventoryVariants(payload) {
|
|
261
197
|
function __updateInventoryVariants({ host }) {
|
|
262
198
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -326,222 +262,60 @@ function incrementInventory(payload) {
|
|
|
326
262
|
}
|
|
327
263
|
return __incrementInventory;
|
|
328
264
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
externalId: z.never().optional(),
|
|
344
|
-
productId: z.never().optional(),
|
|
345
|
-
inventoryId: z.string().describe("Inventory item ID.")
|
|
346
|
-
}),
|
|
347
|
-
z.object({
|
|
348
|
-
inventoryId: z.never().optional(),
|
|
349
|
-
productId: z.never().optional(),
|
|
350
|
-
externalId: z.string().describe("Deprecated (use productID instead).")
|
|
351
|
-
}),
|
|
352
|
-
z.object({
|
|
353
|
-
inventoryId: z.never().optional(),
|
|
354
|
-
externalId: z.never().optional(),
|
|
355
|
-
productId: z.string().describe("Product ID.")
|
|
356
|
-
})
|
|
357
|
-
])
|
|
358
|
-
).optional()
|
|
359
|
-
});
|
|
360
|
-
var GetInventoryVariantsResponse = z.object({
|
|
361
|
-
inventoryItem: z.object({
|
|
362
|
-
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
363
|
-
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
364
|
-
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
365
|
-
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
366
|
-
variants: z.array(
|
|
367
|
-
z.object({
|
|
368
|
-
variantId: z.string().describe("Variant ID.").optional(),
|
|
369
|
-
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
370
|
-
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
371
|
-
availableForPreorder: z.boolean().describe(
|
|
372
|
-
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
373
|
-
).optional()
|
|
374
|
-
})
|
|
375
|
-
).optional(),
|
|
376
|
-
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
377
|
-
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
378
|
-
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
379
|
-
).optional(),
|
|
380
|
-
preorderInfo: z.object({
|
|
381
|
-
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
382
|
-
message: z.string().describe(
|
|
383
|
-
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
384
|
-
).min(1).max(250).optional().nullable(),
|
|
385
|
-
limit: z.number().int().describe(
|
|
386
|
-
"Number of products that can be preordered after stock reaches zero."
|
|
387
|
-
).min(0).max(1e5).optional().nullable()
|
|
388
|
-
}).describe("Preorder information.").optional()
|
|
389
|
-
}).describe("Inventory item.").optional()
|
|
390
|
-
});
|
|
391
|
-
var QueryInventoryRequest = z.object({
|
|
392
|
-
options: z.object({
|
|
393
|
-
query: z.object({
|
|
394
|
-
paging: z.object({
|
|
395
|
-
limit: z.number().int().describe("Amount of items to load per page").min(0).max(100).optional().nullable(),
|
|
396
|
-
offset: z.number().int().describe(
|
|
397
|
-
"Number of items to skip in the display (relevant for all pages after the first)"
|
|
398
|
-
).min(0).optional().nullable()
|
|
399
|
-
}).optional(),
|
|
400
|
-
filter: z.string().describe("Filter string").optional().nullable(),
|
|
401
|
-
sort: z.string().describe("Sort string").optional().nullable()
|
|
402
|
-
}).optional()
|
|
403
|
-
}).optional()
|
|
404
|
-
});
|
|
405
|
-
var QueryInventoryResponse = z.object({
|
|
406
|
-
inventoryItems: z.array(
|
|
407
|
-
z.object({
|
|
408
|
-
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
409
|
-
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
410
|
-
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
411
|
-
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
412
|
-
variants: z.array(
|
|
413
|
-
z.object({
|
|
414
|
-
variantId: z.string().describe("Variant ID.").optional(),
|
|
415
|
-
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
416
|
-
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
417
|
-
availableForPreorder: z.boolean().describe(
|
|
418
|
-
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
419
|
-
).optional()
|
|
420
|
-
})
|
|
421
|
-
).optional(),
|
|
422
|
-
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
423
|
-
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
424
|
-
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
425
|
-
).optional(),
|
|
426
|
-
preorderInfo: z.object({
|
|
427
|
-
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
428
|
-
message: z.string().describe(
|
|
429
|
-
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
430
|
-
).min(1).max(250).optional().nullable(),
|
|
431
|
-
limit: z.number().int().describe(
|
|
432
|
-
"Number of products that can be preordered after stock reaches zero."
|
|
433
|
-
).min(0).max(1e5).optional().nullable()
|
|
434
|
-
}).describe("Preorder information.").optional()
|
|
435
|
-
})
|
|
436
|
-
).optional(),
|
|
437
|
-
metadata: z.object({
|
|
438
|
-
items: z.number().int().describe("Amount of items to load per page").optional(),
|
|
439
|
-
offset: z.number().int().describe(
|
|
440
|
-
"Number of items to skip in the display (relevant for all pages after the first)"
|
|
441
|
-
).optional()
|
|
442
|
-
}).describe("Display metadata.").optional(),
|
|
443
|
-
totalResults: z.number().int().describe("Number of total results.").optional()
|
|
444
|
-
});
|
|
445
|
-
var UpdateInventoryVariantsRequest = z.object({
|
|
446
|
-
productId: z.string().describe("Product ID."),
|
|
447
|
-
inventoryItem: z.object({
|
|
448
|
-
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
449
|
-
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
450
|
-
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
451
|
-
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
452
|
-
variants: z.array(
|
|
453
|
-
z.object({
|
|
454
|
-
variantId: z.string().describe("Variant ID.").optional(),
|
|
455
|
-
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
456
|
-
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
457
|
-
availableForPreorder: z.boolean().describe(
|
|
458
|
-
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
459
|
-
).optional()
|
|
460
|
-
})
|
|
461
|
-
).optional(),
|
|
462
|
-
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
463
|
-
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
464
|
-
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
465
|
-
).optional(),
|
|
466
|
-
preorderInfo: z.object({
|
|
467
|
-
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
468
|
-
message: z.string().describe(
|
|
469
|
-
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
470
|
-
).min(1).max(250).optional().nullable(),
|
|
471
|
-
limit: z.number().int().describe(
|
|
472
|
-
"Number of products that can be preordered after stock reaches zero."
|
|
473
|
-
).min(0).max(1e5).optional().nullable()
|
|
474
|
-
}).describe("Preorder information.").optional()
|
|
475
|
-
}).describe("Inventory item to update.")
|
|
476
|
-
});
|
|
477
|
-
var UpdateInventoryVariantsResponse = z.object({});
|
|
478
|
-
var DecrementInventoryRequest = z.object({
|
|
479
|
-
decrementData: z.array(
|
|
480
|
-
z.intersection(
|
|
481
|
-
z.object({
|
|
482
|
-
variantId: z.string().describe("Variant ID.").regex(
|
|
483
|
-
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
484
|
-
"Must be a valid GUID"
|
|
485
|
-
).optional(),
|
|
486
|
-
decrementBy: z.number().int().describe("Number to decrement inventory by.").min(1).optional(),
|
|
487
|
-
preorderRequest: z.boolean().describe(
|
|
488
|
-
"Whether the request to decrement the item's inventory was made as part of a purchase that includes preorder items.\nIf true and the item is available for preorder, we allow negative inventory.\nIf false and the item is not available for preorder, we allow regular buy flow (no negative inventory)."
|
|
489
|
-
).optional()
|
|
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
|
|
490
279
|
}),
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
z.object({
|
|
498
|
-
externalId: z.never().optional(),
|
|
499
|
-
productId: z.never().optional(),
|
|
500
|
-
inventoryId: z.string().describe("Inventory item ID.").max(36)
|
|
501
|
-
}),
|
|
502
|
-
z.object({
|
|
503
|
-
inventoryId: z.never().optional(),
|
|
504
|
-
productId: z.never().optional(),
|
|
505
|
-
externalId: z.string().describe("Deprecated: use productId.").max(36)
|
|
506
|
-
}),
|
|
507
|
-
z.object({
|
|
508
|
-
inventoryId: z.never().optional(),
|
|
509
|
-
externalId: z.never().optional(),
|
|
510
|
-
productId: z.string().describe("Product ID.").max(36)
|
|
511
|
-
})
|
|
280
|
+
data: payload,
|
|
281
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
282
|
+
{
|
|
283
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
284
|
+
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
285
|
+
}
|
|
512
286
|
])
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
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
|
|
526
306
|
}),
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
productId: z.never().optional(),
|
|
534
|
-
inventoryId: z.string().describe("Inventory item ID.").max(36)
|
|
535
|
-
}),
|
|
536
|
-
z.object({
|
|
537
|
-
inventoryId: z.never().optional(),
|
|
538
|
-
productId: z.string().describe("Product ID.").max(36)
|
|
539
|
-
})
|
|
307
|
+
data: payload,
|
|
308
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
309
|
+
{
|
|
310
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
311
|
+
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
312
|
+
}
|
|
540
313
|
])
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
314
|
+
};
|
|
315
|
+
return metadata;
|
|
316
|
+
}
|
|
317
|
+
return __queryInventory;
|
|
318
|
+
}
|
|
545
319
|
|
|
546
320
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
547
321
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -559,79 +333,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
559
333
|
WebhookIdentityType2["APP"] = "APP";
|
|
560
334
|
return WebhookIdentityType2;
|
|
561
335
|
})(WebhookIdentityType || {});
|
|
562
|
-
async function
|
|
563
|
-
const { httpClient, sideEffects
|
|
564
|
-
if (validateRequestSchema) {
|
|
565
|
-
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
566
|
-
}
|
|
336
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
337
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
567
338
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
568
|
-
|
|
569
|
-
externalId: options?.externalId,
|
|
570
|
-
productId: options?.productId,
|
|
571
|
-
variantIds: options?.variantIds
|
|
339
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
572
340
|
});
|
|
573
|
-
const reqOpts =
|
|
341
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
574
342
|
sideEffects?.onSiteCall?.();
|
|
575
343
|
try {
|
|
576
344
|
const result = await httpClient.request(reqOpts);
|
|
577
345
|
sideEffects?.onSuccess?.(result);
|
|
578
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
579
346
|
} catch (err) {
|
|
580
347
|
const transformedError = (0, import_transform_error.transformError)(
|
|
581
348
|
err,
|
|
582
349
|
{
|
|
583
|
-
spreadPathsToArguments: {},
|
|
584
|
-
explicitPathsToArguments: {
|
|
585
|
-
inventoryId: "$[0]",
|
|
586
|
-
externalId: "$[1].externalId",
|
|
587
|
-
productId: "$[1].productId",
|
|
588
|
-
variantIds: "$[1].variantIds"
|
|
589
|
-
},
|
|
350
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
351
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
590
352
|
singleArgumentUnchanged: false
|
|
591
353
|
},
|
|
592
|
-
["
|
|
354
|
+
["productId", "inventoryItem"]
|
|
593
355
|
);
|
|
594
356
|
sideEffects?.onError?.(err);
|
|
595
357
|
throw transformedError;
|
|
596
358
|
}
|
|
597
359
|
}
|
|
598
|
-
async function
|
|
599
|
-
const { httpClient, sideEffects
|
|
600
|
-
if (validateRequestSchema) {
|
|
601
|
-
QueryInventoryRequest.parse({ options });
|
|
602
|
-
}
|
|
360
|
+
async function decrementInventory2(decrementData) {
|
|
361
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
603
362
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
604
|
-
|
|
363
|
+
decrementData
|
|
605
364
|
});
|
|
606
|
-
const reqOpts =
|
|
365
|
+
const reqOpts = decrementInventory(payload);
|
|
607
366
|
sideEffects?.onSiteCall?.();
|
|
608
367
|
try {
|
|
609
368
|
const result = await httpClient.request(reqOpts);
|
|
610
369
|
sideEffects?.onSuccess?.(result);
|
|
611
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
612
370
|
} catch (err) {
|
|
613
371
|
const transformedError = (0, import_transform_error.transformError)(
|
|
614
372
|
err,
|
|
615
373
|
{
|
|
616
374
|
spreadPathsToArguments: {},
|
|
617
|
-
explicitPathsToArguments: {
|
|
375
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
618
376
|
singleArgumentUnchanged: false
|
|
619
377
|
},
|
|
620
|
-
["
|
|
378
|
+
["decrementData"]
|
|
621
379
|
);
|
|
622
380
|
sideEffects?.onError?.(err);
|
|
623
381
|
throw transformedError;
|
|
624
382
|
}
|
|
625
383
|
}
|
|
626
|
-
async function
|
|
627
|
-
const { httpClient, sideEffects
|
|
628
|
-
if (validateRequestSchema) {
|
|
629
|
-
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
630
|
-
}
|
|
384
|
+
async function incrementInventory2(incrementData) {
|
|
385
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
631
386
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
632
|
-
|
|
387
|
+
incrementData
|
|
633
388
|
});
|
|
634
|
-
const reqOpts =
|
|
389
|
+
const reqOpts = incrementInventory(payload);
|
|
635
390
|
sideEffects?.onSiteCall?.();
|
|
636
391
|
try {
|
|
637
392
|
const result = await httpClient.request(reqOpts);
|
|
@@ -640,65 +395,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
640
395
|
const transformedError = (0, import_transform_error.transformError)(
|
|
641
396
|
err,
|
|
642
397
|
{
|
|
643
|
-
spreadPathsToArguments: {
|
|
644
|
-
explicitPathsToArguments: {
|
|
398
|
+
spreadPathsToArguments: {},
|
|
399
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
645
400
|
singleArgumentUnchanged: false
|
|
646
401
|
},
|
|
647
|
-
["
|
|
402
|
+
["incrementData"]
|
|
648
403
|
);
|
|
649
404
|
sideEffects?.onError?.(err);
|
|
650
405
|
throw transformedError;
|
|
651
406
|
}
|
|
652
407
|
}
|
|
653
|
-
async function
|
|
654
|
-
const { httpClient, sideEffects
|
|
655
|
-
if (validateRequestSchema) {
|
|
656
|
-
DecrementInventoryRequest.parse({ decrementData });
|
|
657
|
-
}
|
|
408
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
409
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
658
410
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
659
|
-
|
|
411
|
+
inventoryId,
|
|
412
|
+
externalId: options?.externalId,
|
|
413
|
+
productId: options?.productId,
|
|
414
|
+
variantIds: options?.variantIds
|
|
660
415
|
});
|
|
661
|
-
const reqOpts =
|
|
416
|
+
const reqOpts = getInventoryVariants(payload);
|
|
662
417
|
sideEffects?.onSiteCall?.();
|
|
663
418
|
try {
|
|
664
419
|
const result = await httpClient.request(reqOpts);
|
|
665
420
|
sideEffects?.onSuccess?.(result);
|
|
421
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
666
422
|
} catch (err) {
|
|
667
423
|
const transformedError = (0, import_transform_error.transformError)(
|
|
668
424
|
err,
|
|
669
425
|
{
|
|
670
426
|
spreadPathsToArguments: {},
|
|
671
|
-
explicitPathsToArguments: {
|
|
427
|
+
explicitPathsToArguments: {
|
|
428
|
+
inventoryId: "$[0]",
|
|
429
|
+
externalId: "$[1].externalId",
|
|
430
|
+
productId: "$[1].productId",
|
|
431
|
+
variantIds: "$[1].variantIds"
|
|
432
|
+
},
|
|
672
433
|
singleArgumentUnchanged: false
|
|
673
434
|
},
|
|
674
|
-
["
|
|
435
|
+
["inventoryId", "options"]
|
|
675
436
|
);
|
|
676
437
|
sideEffects?.onError?.(err);
|
|
677
438
|
throw transformedError;
|
|
678
439
|
}
|
|
679
440
|
}
|
|
680
|
-
async function
|
|
681
|
-
const { httpClient, sideEffects
|
|
682
|
-
if (validateRequestSchema) {
|
|
683
|
-
IncrementInventoryRequest.parse({ incrementData });
|
|
684
|
-
}
|
|
441
|
+
async function queryInventory2(options) {
|
|
442
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
685
443
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
686
|
-
|
|
444
|
+
query: options?.query
|
|
687
445
|
});
|
|
688
|
-
const reqOpts =
|
|
446
|
+
const reqOpts = queryInventory(payload);
|
|
689
447
|
sideEffects?.onSiteCall?.();
|
|
690
448
|
try {
|
|
691
449
|
const result = await httpClient.request(reqOpts);
|
|
692
450
|
sideEffects?.onSuccess?.(result);
|
|
451
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
693
452
|
} catch (err) {
|
|
694
453
|
const transformedError = (0, import_transform_error.transformError)(
|
|
695
454
|
err,
|
|
696
455
|
{
|
|
697
456
|
spreadPathsToArguments: {},
|
|
698
|
-
explicitPathsToArguments: {
|
|
457
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
699
458
|
singleArgumentUnchanged: false
|
|
700
459
|
},
|
|
701
|
-
["
|
|
460
|
+
["options"]
|
|
702
461
|
);
|
|
703
462
|
sideEffects?.onError?.(err);
|
|
704
463
|
throw transformedError;
|
|
@@ -706,41 +465,41 @@ async function incrementInventory2(incrementData) {
|
|
|
706
465
|
}
|
|
707
466
|
|
|
708
467
|
// src/stores-v2-inventory-inventory.public.ts
|
|
709
|
-
function
|
|
710
|
-
return (inventoryId, options) => getInventoryVariants2(
|
|
711
|
-
inventoryId,
|
|
712
|
-
options,
|
|
713
|
-
// @ts-ignore
|
|
714
|
-
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
715
|
-
);
|
|
716
|
-
}
|
|
717
|
-
function queryInventory3(httpClient, __options) {
|
|
718
|
-
return (options) => queryInventory2(
|
|
719
|
-
options,
|
|
720
|
-
// @ts-ignore
|
|
721
|
-
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
function updateInventoryVariants3(httpClient, __options) {
|
|
468
|
+
function updateInventoryVariants3(httpClient) {
|
|
725
469
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
726
470
|
productId,
|
|
727
471
|
inventoryItem,
|
|
728
472
|
// @ts-ignore
|
|
729
|
-
{ httpClient
|
|
473
|
+
{ httpClient }
|
|
730
474
|
);
|
|
731
475
|
}
|
|
732
|
-
function decrementInventory3(httpClient
|
|
476
|
+
function decrementInventory3(httpClient) {
|
|
733
477
|
return (decrementData) => decrementInventory2(
|
|
734
478
|
decrementData,
|
|
735
479
|
// @ts-ignore
|
|
736
|
-
{ httpClient
|
|
480
|
+
{ httpClient }
|
|
737
481
|
);
|
|
738
482
|
}
|
|
739
|
-
function incrementInventory3(httpClient
|
|
483
|
+
function incrementInventory3(httpClient) {
|
|
740
484
|
return (incrementData) => incrementInventory2(
|
|
741
485
|
incrementData,
|
|
742
486
|
// @ts-ignore
|
|
743
|
-
{ httpClient
|
|
487
|
+
{ httpClient }
|
|
488
|
+
);
|
|
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 }
|
|
744
503
|
);
|
|
745
504
|
}
|
|
746
505
|
var onInventoryItemChanged = (0, import_sdk_types.EventDefinition)(
|
|
@@ -775,11 +534,11 @@ var onInventoryVariantsChanged = (0, import_sdk_types.EventDefinition)(
|
|
|
775
534
|
// src/stores-v2-inventory-inventory.context.ts
|
|
776
535
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
777
536
|
var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
|
|
778
|
-
var getInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(getInventoryVariants3);
|
|
779
|
-
var queryInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(queryInventory3);
|
|
780
537
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
781
538
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
782
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);
|
|
783
542
|
var onInventoryItemChanged2 = (0, import_event_definition_modules.createEventModule)(
|
|
784
543
|
onInventoryItemChanged
|
|
785
544
|
);
|