@wix/auto_sdk_stores_inventory 1.0.63 → 1.0.65
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 +34 -24
- package/build/cjs/index.js +417 -176
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +394 -153
- 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 +34 -24
- package/build/es/index.mjs +407 -176
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +384 -153
- 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 +34 -24
- package/build/internal/cjs/index.js +417 -176
- 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 +394 -153
- 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 +34 -24
- package/build/internal/es/index.mjs +407 -176
- 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 +384 -153
- 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,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// index.ts
|
|
@@ -48,67 +58,6 @@ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
|
48
58
|
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
49
59
|
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
50
60
|
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
|
-
}
|
|
112
61
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
113
62
|
const domainToMappings = {
|
|
114
63
|
"api._api_base_domain_": [
|
|
@@ -192,7 +141,122 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
192
141
|
};
|
|
193
142
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
194
143
|
}
|
|
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
|
+
}
|
|
195
205
|
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
|
+
}
|
|
196
260
|
function updateInventoryVariants(payload) {
|
|
197
261
|
function __updateInventoryVariants({ host }) {
|
|
198
262
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -262,60 +326,222 @@ function incrementInventory(payload) {
|
|
|
262
326
|
}
|
|
263
327
|
return __incrementInventory;
|
|
264
328
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
data: payload,
|
|
278
|
-
host
|
|
329
|
+
|
|
330
|
+
// src/stores-v2-inventory-inventory.schemas.ts
|
|
331
|
+
var z = __toESM(require("zod"));
|
|
332
|
+
var GetInventoryVariantsRequest = z.object({
|
|
333
|
+
inventoryId: z.string().describe("Inventory item ID."),
|
|
334
|
+
options: z.intersection(
|
|
335
|
+
z.object({ variantIds: z.array(z.string()).optional() }),
|
|
336
|
+
z.xor([
|
|
337
|
+
z.object({
|
|
338
|
+
inventoryId: z.never().optional(),
|
|
339
|
+
externalId: z.never().optional(),
|
|
340
|
+
productId: z.never().optional()
|
|
279
341
|
}),
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
342
|
+
z.object({
|
|
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()
|
|
490
|
+
}),
|
|
491
|
+
z.xor([
|
|
492
|
+
z.object({
|
|
493
|
+
inventoryId: z.never().optional(),
|
|
494
|
+
externalId: z.never().optional(),
|
|
495
|
+
productId: z.never().optional()
|
|
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
|
+
})
|
|
286
512
|
])
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
optInTransformResponse: true
|
|
301
|
-
},
|
|
302
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
303
|
-
protoPath: "/v2/inventoryItems/query",
|
|
304
|
-
data: payload,
|
|
305
|
-
host
|
|
513
|
+
)
|
|
514
|
+
).min(1).max(300)
|
|
515
|
+
});
|
|
516
|
+
var DecrementInventoryResponse = z.object({});
|
|
517
|
+
var IncrementInventoryRequest = z.object({
|
|
518
|
+
incrementData: z.array(
|
|
519
|
+
z.intersection(
|
|
520
|
+
z.object({
|
|
521
|
+
variantId: z.string().describe("Variant ID.").regex(
|
|
522
|
+
/^[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}$/,
|
|
523
|
+
"Must be a valid GUID"
|
|
524
|
+
).optional(),
|
|
525
|
+
incrementBy: z.number().int().describe("Number to increment inventory by.").min(1).optional()
|
|
306
526
|
}),
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
527
|
+
z.xor([
|
|
528
|
+
z.object({
|
|
529
|
+
inventoryId: z.never().optional(),
|
|
530
|
+
productId: z.never().optional()
|
|
531
|
+
}),
|
|
532
|
+
z.object({
|
|
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
|
+
})
|
|
313
540
|
])
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
541
|
+
)
|
|
542
|
+
).min(1).max(300)
|
|
543
|
+
});
|
|
544
|
+
var IncrementInventoryResponse = z.object({});
|
|
319
545
|
|
|
320
546
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
321
547
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -333,60 +559,79 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
333
559
|
WebhookIdentityType2["APP"] = "APP";
|
|
334
560
|
return WebhookIdentityType2;
|
|
335
561
|
})(WebhookIdentityType || {});
|
|
336
|
-
async function
|
|
337
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
562
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
563
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
564
|
+
if (validateRequestSchema) {
|
|
565
|
+
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
566
|
+
}
|
|
338
567
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
339
|
-
|
|
568
|
+
inventoryId,
|
|
569
|
+
externalId: options?.externalId,
|
|
570
|
+
productId: options?.productId,
|
|
571
|
+
variantIds: options?.variantIds
|
|
340
572
|
});
|
|
341
|
-
const reqOpts =
|
|
573
|
+
const reqOpts = getInventoryVariants(payload);
|
|
342
574
|
sideEffects?.onSiteCall?.();
|
|
343
575
|
try {
|
|
344
576
|
const result = await httpClient.request(reqOpts);
|
|
345
577
|
sideEffects?.onSuccess?.(result);
|
|
578
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
346
579
|
} catch (err) {
|
|
347
580
|
const transformedError = (0, import_transform_error.transformError)(
|
|
348
581
|
err,
|
|
349
582
|
{
|
|
350
|
-
spreadPathsToArguments: {
|
|
351
|
-
explicitPathsToArguments: {
|
|
583
|
+
spreadPathsToArguments: {},
|
|
584
|
+
explicitPathsToArguments: {
|
|
585
|
+
inventoryId: "$[0]",
|
|
586
|
+
externalId: "$[1].externalId",
|
|
587
|
+
productId: "$[1].productId",
|
|
588
|
+
variantIds: "$[1].variantIds"
|
|
589
|
+
},
|
|
352
590
|
singleArgumentUnchanged: false
|
|
353
591
|
},
|
|
354
|
-
["
|
|
592
|
+
["inventoryId", "options"]
|
|
355
593
|
);
|
|
356
594
|
sideEffects?.onError?.(err);
|
|
357
595
|
throw transformedError;
|
|
358
596
|
}
|
|
359
597
|
}
|
|
360
|
-
async function
|
|
361
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
598
|
+
async function queryInventory2(options) {
|
|
599
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
600
|
+
if (validateRequestSchema) {
|
|
601
|
+
QueryInventoryRequest.parse({ options });
|
|
602
|
+
}
|
|
362
603
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
363
|
-
|
|
604
|
+
query: options?.query
|
|
364
605
|
});
|
|
365
|
-
const reqOpts =
|
|
606
|
+
const reqOpts = queryInventory(payload);
|
|
366
607
|
sideEffects?.onSiteCall?.();
|
|
367
608
|
try {
|
|
368
609
|
const result = await httpClient.request(reqOpts);
|
|
369
610
|
sideEffects?.onSuccess?.(result);
|
|
611
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
370
612
|
} catch (err) {
|
|
371
613
|
const transformedError = (0, import_transform_error.transformError)(
|
|
372
614
|
err,
|
|
373
615
|
{
|
|
374
616
|
spreadPathsToArguments: {},
|
|
375
|
-
explicitPathsToArguments: {
|
|
617
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
376
618
|
singleArgumentUnchanged: false
|
|
377
619
|
},
|
|
378
|
-
["
|
|
620
|
+
["options"]
|
|
379
621
|
);
|
|
380
622
|
sideEffects?.onError?.(err);
|
|
381
623
|
throw transformedError;
|
|
382
624
|
}
|
|
383
625
|
}
|
|
384
|
-
async function
|
|
385
|
-
const { httpClient, sideEffects } = arguments[
|
|
626
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
627
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
628
|
+
if (validateRequestSchema) {
|
|
629
|
+
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
630
|
+
}
|
|
386
631
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
387
|
-
|
|
632
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
388
633
|
});
|
|
389
|
-
const reqOpts =
|
|
634
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
390
635
|
sideEffects?.onSiteCall?.();
|
|
391
636
|
try {
|
|
392
637
|
const result = await httpClient.request(reqOpts);
|
|
@@ -395,69 +640,65 @@ async function incrementInventory2(incrementData) {
|
|
|
395
640
|
const transformedError = (0, import_transform_error.transformError)(
|
|
396
641
|
err,
|
|
397
642
|
{
|
|
398
|
-
spreadPathsToArguments: {},
|
|
399
|
-
explicitPathsToArguments: {
|
|
643
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
644
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
400
645
|
singleArgumentUnchanged: false
|
|
401
646
|
},
|
|
402
|
-
["
|
|
647
|
+
["productId", "inventoryItem"]
|
|
403
648
|
);
|
|
404
649
|
sideEffects?.onError?.(err);
|
|
405
650
|
throw transformedError;
|
|
406
651
|
}
|
|
407
652
|
}
|
|
408
|
-
async function
|
|
409
|
-
const { httpClient, sideEffects } = arguments[
|
|
653
|
+
async function decrementInventory2(decrementData) {
|
|
654
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
655
|
+
if (validateRequestSchema) {
|
|
656
|
+
DecrementInventoryRequest.parse({ decrementData });
|
|
657
|
+
}
|
|
410
658
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
411
|
-
|
|
412
|
-
externalId: options?.externalId,
|
|
413
|
-
productId: options?.productId,
|
|
414
|
-
variantIds: options?.variantIds
|
|
659
|
+
decrementData
|
|
415
660
|
});
|
|
416
|
-
const reqOpts =
|
|
661
|
+
const reqOpts = decrementInventory(payload);
|
|
417
662
|
sideEffects?.onSiteCall?.();
|
|
418
663
|
try {
|
|
419
664
|
const result = await httpClient.request(reqOpts);
|
|
420
665
|
sideEffects?.onSuccess?.(result);
|
|
421
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
422
666
|
} catch (err) {
|
|
423
667
|
const transformedError = (0, import_transform_error.transformError)(
|
|
424
668
|
err,
|
|
425
669
|
{
|
|
426
670
|
spreadPathsToArguments: {},
|
|
427
|
-
explicitPathsToArguments: {
|
|
428
|
-
inventoryId: "$[0]",
|
|
429
|
-
externalId: "$[1].externalId",
|
|
430
|
-
productId: "$[1].productId",
|
|
431
|
-
variantIds: "$[1].variantIds"
|
|
432
|
-
},
|
|
671
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
433
672
|
singleArgumentUnchanged: false
|
|
434
673
|
},
|
|
435
|
-
["
|
|
674
|
+
["decrementData"]
|
|
436
675
|
);
|
|
437
676
|
sideEffects?.onError?.(err);
|
|
438
677
|
throw transformedError;
|
|
439
678
|
}
|
|
440
679
|
}
|
|
441
|
-
async function
|
|
442
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
680
|
+
async function incrementInventory2(incrementData) {
|
|
681
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
682
|
+
if (validateRequestSchema) {
|
|
683
|
+
IncrementInventoryRequest.parse({ incrementData });
|
|
684
|
+
}
|
|
443
685
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
444
|
-
|
|
686
|
+
incrementData
|
|
445
687
|
});
|
|
446
|
-
const reqOpts =
|
|
688
|
+
const reqOpts = incrementInventory(payload);
|
|
447
689
|
sideEffects?.onSiteCall?.();
|
|
448
690
|
try {
|
|
449
691
|
const result = await httpClient.request(reqOpts);
|
|
450
692
|
sideEffects?.onSuccess?.(result);
|
|
451
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
452
693
|
} catch (err) {
|
|
453
694
|
const transformedError = (0, import_transform_error.transformError)(
|
|
454
695
|
err,
|
|
455
696
|
{
|
|
456
697
|
spreadPathsToArguments: {},
|
|
457
|
-
explicitPathsToArguments: {
|
|
698
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
458
699
|
singleArgumentUnchanged: false
|
|
459
700
|
},
|
|
460
|
-
["
|
|
701
|
+
["incrementData"]
|
|
461
702
|
);
|
|
462
703
|
sideEffects?.onError?.(err);
|
|
463
704
|
throw transformedError;
|
|
@@ -465,41 +706,41 @@ async function queryInventory2(options) {
|
|
|
465
706
|
}
|
|
466
707
|
|
|
467
708
|
// src/stores-v2-inventory-inventory.public.ts
|
|
468
|
-
function
|
|
709
|
+
function getInventoryVariants3(httpClient, __options) {
|
|
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) {
|
|
469
725
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
470
726
|
productId,
|
|
471
727
|
inventoryItem,
|
|
472
728
|
// @ts-ignore
|
|
473
|
-
{ httpClient }
|
|
729
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
474
730
|
);
|
|
475
731
|
}
|
|
476
|
-
function decrementInventory3(httpClient) {
|
|
732
|
+
function decrementInventory3(httpClient, __options) {
|
|
477
733
|
return (decrementData) => decrementInventory2(
|
|
478
734
|
decrementData,
|
|
479
735
|
// @ts-ignore
|
|
480
|
-
{ httpClient }
|
|
736
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
481
737
|
);
|
|
482
738
|
}
|
|
483
|
-
function incrementInventory3(httpClient) {
|
|
739
|
+
function incrementInventory3(httpClient, __options) {
|
|
484
740
|
return (incrementData) => incrementInventory2(
|
|
485
741
|
incrementData,
|
|
486
742
|
// @ts-ignore
|
|
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 }
|
|
743
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
503
744
|
);
|
|
504
745
|
}
|
|
505
746
|
var onInventoryItemChanged = (0, import_sdk_types.EventDefinition)(
|
|
@@ -534,11 +775,11 @@ var onInventoryVariantsChanged = (0, import_sdk_types.EventDefinition)(
|
|
|
534
775
|
// src/stores-v2-inventory-inventory.context.ts
|
|
535
776
|
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
536
777
|
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);
|
|
537
780
|
var updateInventoryVariants4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(updateInventoryVariants3);
|
|
538
781
|
var decrementInventory4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(decrementInventory3);
|
|
539
782
|
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
783
|
var onInventoryItemChanged2 = (0, import_event_definition_modules.createEventModule)(
|
|
543
784
|
onInventoryItemChanged
|
|
544
785
|
);
|