@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
|
@@ -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.typings.ts
|
|
@@ -39,67 +49,6 @@ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
|
39
49
|
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
40
50
|
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
41
51
|
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
42
|
-
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
43
|
-
const domainToMappings = {
|
|
44
|
-
"api._api_base_domain_": [
|
|
45
|
-
{
|
|
46
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
47
|
-
destPath: ""
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"manage._base_domain_": [
|
|
51
|
-
{
|
|
52
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
53
|
-
destPath: ""
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"www.wixapis.com": [
|
|
57
|
-
{
|
|
58
|
-
srcPath: "/stores-reader/v2/collections",
|
|
59
|
-
destPath: "/v2/collections"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
63
|
-
destPath: "/v2/inventoryItems"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"www._base_domain_": [
|
|
67
|
-
{
|
|
68
|
-
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
69
|
-
destPath: ""
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"editor._base_domain_": [
|
|
73
|
-
{
|
|
74
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
75
|
-
destPath: ""
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
"blocks._base_domain_": [
|
|
79
|
-
{
|
|
80
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
81
|
-
destPath: ""
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"create.editorx": [
|
|
85
|
-
{
|
|
86
|
-
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
87
|
-
destPath: ""
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
_: [
|
|
91
|
-
{
|
|
92
|
-
srcPath: "/stores-reader/v2/inventoryItems",
|
|
93
|
-
destPath: "/v2/inventoryItems"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
srcPath: "/stores-reader/v2/collections",
|
|
97
|
-
destPath: "/v2/collections"
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
};
|
|
101
|
-
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
102
|
-
}
|
|
103
52
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
104
53
|
const domainToMappings = {
|
|
105
54
|
"api._api_base_domain_": [
|
|
@@ -183,7 +132,122 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
183
132
|
};
|
|
184
133
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
185
134
|
}
|
|
135
|
+
function resolveWixInventoryApiV1InventoryReadApiUrl(opts) {
|
|
136
|
+
const domainToMappings = {
|
|
137
|
+
"api._api_base_domain_": [
|
|
138
|
+
{
|
|
139
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
140
|
+
destPath: ""
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"manage._base_domain_": [
|
|
144
|
+
{
|
|
145
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
146
|
+
destPath: ""
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"www.wixapis.com": [
|
|
150
|
+
{
|
|
151
|
+
srcPath: "/stores-reader/v2/collections",
|
|
152
|
+
destPath: "/v2/collections"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
156
|
+
destPath: "/v2/inventoryItems"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"www._base_domain_": [
|
|
160
|
+
{
|
|
161
|
+
srcPath: "/wix-ecommerce-catalog-reader-web",
|
|
162
|
+
destPath: ""
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"editor._base_domain_": [
|
|
166
|
+
{
|
|
167
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
168
|
+
destPath: ""
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"blocks._base_domain_": [
|
|
172
|
+
{
|
|
173
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
174
|
+
destPath: ""
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"create.editorx": [
|
|
178
|
+
{
|
|
179
|
+
srcPath: "/_api/wix-ecommerce-catalog-reader-web",
|
|
180
|
+
destPath: ""
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
_: [
|
|
184
|
+
{
|
|
185
|
+
srcPath: "/stores-reader/v2/inventoryItems",
|
|
186
|
+
destPath: "/v2/inventoryItems"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
srcPath: "/stores-reader/v2/collections",
|
|
190
|
+
destPath: "/v2/collections"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
};
|
|
194
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
195
|
+
}
|
|
186
196
|
var PACKAGE_NAME = "@wix/auto_sdk_stores_inventory";
|
|
197
|
+
function getInventoryVariants(payload) {
|
|
198
|
+
function __getInventoryVariants({ host }) {
|
|
199
|
+
const metadata = {
|
|
200
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
201
|
+
method: "POST",
|
|
202
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
203
|
+
packageName: PACKAGE_NAME,
|
|
204
|
+
migrationOptions: {
|
|
205
|
+
optInTransformResponse: true
|
|
206
|
+
},
|
|
207
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
208
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
209
|
+
data: payload,
|
|
210
|
+
host
|
|
211
|
+
}),
|
|
212
|
+
data: payload,
|
|
213
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
214
|
+
{
|
|
215
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
216
|
+
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
217
|
+
}
|
|
218
|
+
])
|
|
219
|
+
};
|
|
220
|
+
return metadata;
|
|
221
|
+
}
|
|
222
|
+
return __getInventoryVariants;
|
|
223
|
+
}
|
|
224
|
+
function queryInventory(payload) {
|
|
225
|
+
function __queryInventory({ host }) {
|
|
226
|
+
const metadata = {
|
|
227
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
228
|
+
method: "POST",
|
|
229
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
230
|
+
packageName: PACKAGE_NAME,
|
|
231
|
+
migrationOptions: {
|
|
232
|
+
optInTransformResponse: true
|
|
233
|
+
},
|
|
234
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
235
|
+
protoPath: "/v2/inventoryItems/query",
|
|
236
|
+
data: payload,
|
|
237
|
+
host
|
|
238
|
+
}),
|
|
239
|
+
data: payload,
|
|
240
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
241
|
+
{
|
|
242
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
243
|
+
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
244
|
+
}
|
|
245
|
+
])
|
|
246
|
+
};
|
|
247
|
+
return metadata;
|
|
248
|
+
}
|
|
249
|
+
return __queryInventory;
|
|
250
|
+
}
|
|
187
251
|
function updateInventoryVariants(payload) {
|
|
188
252
|
function __updateInventoryVariants({ host }) {
|
|
189
253
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -253,60 +317,222 @@ function incrementInventory(payload) {
|
|
|
253
317
|
}
|
|
254
318
|
return __incrementInventory;
|
|
255
319
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
data: payload,
|
|
269
|
-
host
|
|
320
|
+
|
|
321
|
+
// src/stores-v2-inventory-inventory.schemas.ts
|
|
322
|
+
var z = __toESM(require("zod"));
|
|
323
|
+
var GetInventoryVariantsRequest = z.object({
|
|
324
|
+
inventoryId: z.string().describe("Inventory item ID."),
|
|
325
|
+
options: z.intersection(
|
|
326
|
+
z.object({ variantIds: z.array(z.string()).optional() }),
|
|
327
|
+
z.xor([
|
|
328
|
+
z.object({
|
|
329
|
+
inventoryId: z.never().optional(),
|
|
330
|
+
externalId: z.never().optional(),
|
|
331
|
+
productId: z.never().optional()
|
|
270
332
|
}),
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
333
|
+
z.object({
|
|
334
|
+
externalId: z.never().optional(),
|
|
335
|
+
productId: z.never().optional(),
|
|
336
|
+
inventoryId: z.string().describe("Inventory item ID.")
|
|
337
|
+
}),
|
|
338
|
+
z.object({
|
|
339
|
+
inventoryId: z.never().optional(),
|
|
340
|
+
productId: z.never().optional(),
|
|
341
|
+
externalId: z.string().describe("Deprecated (use productID instead).")
|
|
342
|
+
}),
|
|
343
|
+
z.object({
|
|
344
|
+
inventoryId: z.never().optional(),
|
|
345
|
+
externalId: z.never().optional(),
|
|
346
|
+
productId: z.string().describe("Product ID.")
|
|
347
|
+
})
|
|
348
|
+
])
|
|
349
|
+
).optional()
|
|
350
|
+
});
|
|
351
|
+
var GetInventoryVariantsResponse = z.object({
|
|
352
|
+
inventoryItem: z.object({
|
|
353
|
+
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
354
|
+
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
355
|
+
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
356
|
+
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
357
|
+
variants: z.array(
|
|
358
|
+
z.object({
|
|
359
|
+
variantId: z.string().describe("Variant ID.").optional(),
|
|
360
|
+
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
361
|
+
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
362
|
+
availableForPreorder: z.boolean().describe(
|
|
363
|
+
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
364
|
+
).optional()
|
|
365
|
+
})
|
|
366
|
+
).optional(),
|
|
367
|
+
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
368
|
+
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
369
|
+
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
370
|
+
).optional(),
|
|
371
|
+
preorderInfo: z.object({
|
|
372
|
+
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
373
|
+
message: z.string().describe(
|
|
374
|
+
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
375
|
+
).min(1).max(250).optional().nullable(),
|
|
376
|
+
limit: z.number().int().describe(
|
|
377
|
+
"Number of products that can be preordered after stock reaches zero."
|
|
378
|
+
).min(0).max(1e5).optional().nullable()
|
|
379
|
+
}).describe("Preorder information.").optional()
|
|
380
|
+
}).describe("Inventory item.").optional()
|
|
381
|
+
});
|
|
382
|
+
var QueryInventoryRequest = z.object({
|
|
383
|
+
options: z.object({
|
|
384
|
+
query: z.object({
|
|
385
|
+
paging: z.object({
|
|
386
|
+
limit: z.number().int().describe("Amount of items to load per page").min(0).max(100).optional().nullable(),
|
|
387
|
+
offset: z.number().int().describe(
|
|
388
|
+
"Number of items to skip in the display (relevant for all pages after the first)"
|
|
389
|
+
).min(0).optional().nullable()
|
|
390
|
+
}).optional(),
|
|
391
|
+
filter: z.string().describe("Filter string").optional().nullable(),
|
|
392
|
+
sort: z.string().describe("Sort string").optional().nullable()
|
|
393
|
+
}).optional()
|
|
394
|
+
}).optional()
|
|
395
|
+
});
|
|
396
|
+
var QueryInventoryResponse = z.object({
|
|
397
|
+
inventoryItems: z.array(
|
|
398
|
+
z.object({
|
|
399
|
+
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
400
|
+
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
401
|
+
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
402
|
+
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
403
|
+
variants: z.array(
|
|
404
|
+
z.object({
|
|
405
|
+
variantId: z.string().describe("Variant ID.").optional(),
|
|
406
|
+
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
407
|
+
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
408
|
+
availableForPreorder: z.boolean().describe(
|
|
409
|
+
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
410
|
+
).optional()
|
|
411
|
+
})
|
|
412
|
+
).optional(),
|
|
413
|
+
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
414
|
+
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
415
|
+
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
416
|
+
).optional(),
|
|
417
|
+
preorderInfo: z.object({
|
|
418
|
+
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
419
|
+
message: z.string().describe(
|
|
420
|
+
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
421
|
+
).min(1).max(250).optional().nullable(),
|
|
422
|
+
limit: z.number().int().describe(
|
|
423
|
+
"Number of products that can be preordered after stock reaches zero."
|
|
424
|
+
).min(0).max(1e5).optional().nullable()
|
|
425
|
+
}).describe("Preorder information.").optional()
|
|
426
|
+
})
|
|
427
|
+
).optional(),
|
|
428
|
+
metadata: z.object({
|
|
429
|
+
items: z.number().int().describe("Amount of items to load per page").optional(),
|
|
430
|
+
offset: z.number().int().describe(
|
|
431
|
+
"Number of items to skip in the display (relevant for all pages after the first)"
|
|
432
|
+
).optional()
|
|
433
|
+
}).describe("Display metadata.").optional(),
|
|
434
|
+
totalResults: z.number().int().describe("Number of total results.").optional()
|
|
435
|
+
});
|
|
436
|
+
var UpdateInventoryVariantsRequest = z.object({
|
|
437
|
+
productId: z.string().describe("Product ID."),
|
|
438
|
+
inventoryItem: z.object({
|
|
439
|
+
_id: z.string().describe("Inventory item ID.").optional().nullable(),
|
|
440
|
+
externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
|
|
441
|
+
productId: z.string().describe("Product ID.").optional().nullable(),
|
|
442
|
+
trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
|
|
443
|
+
variants: z.array(
|
|
444
|
+
z.object({
|
|
445
|
+
variantId: z.string().describe("Variant ID.").optional(),
|
|
446
|
+
inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
|
|
447
|
+
quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
|
|
448
|
+
availableForPreorder: z.boolean().describe(
|
|
449
|
+
"Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
|
|
450
|
+
).optional()
|
|
451
|
+
})
|
|
452
|
+
).optional(),
|
|
453
|
+
lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
|
|
454
|
+
numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
|
|
455
|
+
"Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
|
|
456
|
+
).optional(),
|
|
457
|
+
preorderInfo: z.object({
|
|
458
|
+
enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
|
|
459
|
+
message: z.string().describe(
|
|
460
|
+
"A message the buyer will see when the item is out of stock and preorder is enabled."
|
|
461
|
+
).min(1).max(250).optional().nullable(),
|
|
462
|
+
limit: z.number().int().describe(
|
|
463
|
+
"Number of products that can be preordered after stock reaches zero."
|
|
464
|
+
).min(0).max(1e5).optional().nullable()
|
|
465
|
+
}).describe("Preorder information.").optional()
|
|
466
|
+
}).describe("Inventory item to update.")
|
|
467
|
+
});
|
|
468
|
+
var UpdateInventoryVariantsResponse = z.object({});
|
|
469
|
+
var DecrementInventoryRequest = z.object({
|
|
470
|
+
decrementData: z.array(
|
|
471
|
+
z.intersection(
|
|
472
|
+
z.object({
|
|
473
|
+
variantId: z.string().describe("Variant ID.").regex(
|
|
474
|
+
/^[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}$/,
|
|
475
|
+
"Must be a valid GUID"
|
|
476
|
+
).optional(),
|
|
477
|
+
decrementBy: z.number().int().describe("Number to decrement inventory by.").min(1).optional(),
|
|
478
|
+
preorderRequest: z.boolean().describe(
|
|
479
|
+
"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)."
|
|
480
|
+
).optional()
|
|
481
|
+
}),
|
|
482
|
+
z.xor([
|
|
483
|
+
z.object({
|
|
484
|
+
inventoryId: z.never().optional(),
|
|
485
|
+
externalId: z.never().optional(),
|
|
486
|
+
productId: z.never().optional()
|
|
487
|
+
}),
|
|
488
|
+
z.object({
|
|
489
|
+
externalId: z.never().optional(),
|
|
490
|
+
productId: z.never().optional(),
|
|
491
|
+
inventoryId: z.string().describe("Inventory item ID.").max(36)
|
|
492
|
+
}),
|
|
493
|
+
z.object({
|
|
494
|
+
inventoryId: z.never().optional(),
|
|
495
|
+
productId: z.never().optional(),
|
|
496
|
+
externalId: z.string().describe("Deprecated: use productId.").max(36)
|
|
497
|
+
}),
|
|
498
|
+
z.object({
|
|
499
|
+
inventoryId: z.never().optional(),
|
|
500
|
+
externalId: z.never().optional(),
|
|
501
|
+
productId: z.string().describe("Product ID.").max(36)
|
|
502
|
+
})
|
|
277
503
|
])
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
optInTransformResponse: true
|
|
292
|
-
},
|
|
293
|
-
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
294
|
-
protoPath: "/v2/inventoryItems/query",
|
|
295
|
-
data: payload,
|
|
296
|
-
host
|
|
504
|
+
)
|
|
505
|
+
).min(1).max(300)
|
|
506
|
+
});
|
|
507
|
+
var DecrementInventoryResponse = z.object({});
|
|
508
|
+
var IncrementInventoryRequest = z.object({
|
|
509
|
+
incrementData: z.array(
|
|
510
|
+
z.intersection(
|
|
511
|
+
z.object({
|
|
512
|
+
variantId: z.string().describe("Variant ID.").regex(
|
|
513
|
+
/^[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}$/,
|
|
514
|
+
"Must be a valid GUID"
|
|
515
|
+
).optional(),
|
|
516
|
+
incrementBy: z.number().int().describe("Number to increment inventory by.").min(1).optional()
|
|
297
517
|
}),
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
518
|
+
z.xor([
|
|
519
|
+
z.object({
|
|
520
|
+
inventoryId: z.never().optional(),
|
|
521
|
+
productId: z.never().optional()
|
|
522
|
+
}),
|
|
523
|
+
z.object({
|
|
524
|
+
productId: z.never().optional(),
|
|
525
|
+
inventoryId: z.string().describe("Inventory item ID.").max(36)
|
|
526
|
+
}),
|
|
527
|
+
z.object({
|
|
528
|
+
inventoryId: z.never().optional(),
|
|
529
|
+
productId: z.string().describe("Product ID.").max(36)
|
|
530
|
+
})
|
|
304
531
|
])
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
532
|
+
)
|
|
533
|
+
).min(1).max(300)
|
|
534
|
+
});
|
|
535
|
+
var IncrementInventoryResponse = z.object({});
|
|
310
536
|
|
|
311
537
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
312
538
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -324,60 +550,79 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
324
550
|
WebhookIdentityType2["APP"] = "APP";
|
|
325
551
|
return WebhookIdentityType2;
|
|
326
552
|
})(WebhookIdentityType || {});
|
|
327
|
-
async function
|
|
328
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
553
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
554
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
555
|
+
if (validateRequestSchema) {
|
|
556
|
+
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
557
|
+
}
|
|
329
558
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
330
|
-
|
|
559
|
+
inventoryId,
|
|
560
|
+
externalId: options?.externalId,
|
|
561
|
+
productId: options?.productId,
|
|
562
|
+
variantIds: options?.variantIds
|
|
331
563
|
});
|
|
332
|
-
const reqOpts =
|
|
564
|
+
const reqOpts = getInventoryVariants(payload);
|
|
333
565
|
sideEffects?.onSiteCall?.();
|
|
334
566
|
try {
|
|
335
567
|
const result = await httpClient.request(reqOpts);
|
|
336
568
|
sideEffects?.onSuccess?.(result);
|
|
569
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
337
570
|
} catch (err) {
|
|
338
571
|
const transformedError = (0, import_transform_error.transformError)(
|
|
339
572
|
err,
|
|
340
573
|
{
|
|
341
|
-
spreadPathsToArguments: {
|
|
342
|
-
explicitPathsToArguments: {
|
|
574
|
+
spreadPathsToArguments: {},
|
|
575
|
+
explicitPathsToArguments: {
|
|
576
|
+
inventoryId: "$[0]",
|
|
577
|
+
externalId: "$[1].externalId",
|
|
578
|
+
productId: "$[1].productId",
|
|
579
|
+
variantIds: "$[1].variantIds"
|
|
580
|
+
},
|
|
343
581
|
singleArgumentUnchanged: false
|
|
344
582
|
},
|
|
345
|
-
["
|
|
583
|
+
["inventoryId", "options"]
|
|
346
584
|
);
|
|
347
585
|
sideEffects?.onError?.(err);
|
|
348
586
|
throw transformedError;
|
|
349
587
|
}
|
|
350
588
|
}
|
|
351
|
-
async function
|
|
352
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
589
|
+
async function queryInventory2(options) {
|
|
590
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
591
|
+
if (validateRequestSchema) {
|
|
592
|
+
QueryInventoryRequest.parse({ options });
|
|
593
|
+
}
|
|
353
594
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
354
|
-
|
|
595
|
+
query: options?.query
|
|
355
596
|
});
|
|
356
|
-
const reqOpts =
|
|
597
|
+
const reqOpts = queryInventory(payload);
|
|
357
598
|
sideEffects?.onSiteCall?.();
|
|
358
599
|
try {
|
|
359
600
|
const result = await httpClient.request(reqOpts);
|
|
360
601
|
sideEffects?.onSuccess?.(result);
|
|
602
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
361
603
|
} catch (err) {
|
|
362
604
|
const transformedError = (0, import_transform_error.transformError)(
|
|
363
605
|
err,
|
|
364
606
|
{
|
|
365
607
|
spreadPathsToArguments: {},
|
|
366
|
-
explicitPathsToArguments: {
|
|
608
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
367
609
|
singleArgumentUnchanged: false
|
|
368
610
|
},
|
|
369
|
-
["
|
|
611
|
+
["options"]
|
|
370
612
|
);
|
|
371
613
|
sideEffects?.onError?.(err);
|
|
372
614
|
throw transformedError;
|
|
373
615
|
}
|
|
374
616
|
}
|
|
375
|
-
async function
|
|
376
|
-
const { httpClient, sideEffects } = arguments[
|
|
617
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
618
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
619
|
+
if (validateRequestSchema) {
|
|
620
|
+
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
621
|
+
}
|
|
377
622
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
378
|
-
|
|
623
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
379
624
|
});
|
|
380
|
-
const reqOpts =
|
|
625
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
381
626
|
sideEffects?.onSiteCall?.();
|
|
382
627
|
try {
|
|
383
628
|
const result = await httpClient.request(reqOpts);
|
|
@@ -386,69 +631,65 @@ async function incrementInventory2(incrementData) {
|
|
|
386
631
|
const transformedError = (0, import_transform_error.transformError)(
|
|
387
632
|
err,
|
|
388
633
|
{
|
|
389
|
-
spreadPathsToArguments: {},
|
|
390
|
-
explicitPathsToArguments: {
|
|
634
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
635
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
391
636
|
singleArgumentUnchanged: false
|
|
392
637
|
},
|
|
393
|
-
["
|
|
638
|
+
["productId", "inventoryItem"]
|
|
394
639
|
);
|
|
395
640
|
sideEffects?.onError?.(err);
|
|
396
641
|
throw transformedError;
|
|
397
642
|
}
|
|
398
643
|
}
|
|
399
|
-
async function
|
|
400
|
-
const { httpClient, sideEffects } = arguments[
|
|
644
|
+
async function decrementInventory2(decrementData) {
|
|
645
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
646
|
+
if (validateRequestSchema) {
|
|
647
|
+
DecrementInventoryRequest.parse({ decrementData });
|
|
648
|
+
}
|
|
401
649
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
402
|
-
|
|
403
|
-
externalId: options?.externalId,
|
|
404
|
-
productId: options?.productId,
|
|
405
|
-
variantIds: options?.variantIds
|
|
650
|
+
decrementData
|
|
406
651
|
});
|
|
407
|
-
const reqOpts =
|
|
652
|
+
const reqOpts = decrementInventory(payload);
|
|
408
653
|
sideEffects?.onSiteCall?.();
|
|
409
654
|
try {
|
|
410
655
|
const result = await httpClient.request(reqOpts);
|
|
411
656
|
sideEffects?.onSuccess?.(result);
|
|
412
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
413
657
|
} catch (err) {
|
|
414
658
|
const transformedError = (0, import_transform_error.transformError)(
|
|
415
659
|
err,
|
|
416
660
|
{
|
|
417
661
|
spreadPathsToArguments: {},
|
|
418
|
-
explicitPathsToArguments: {
|
|
419
|
-
inventoryId: "$[0]",
|
|
420
|
-
externalId: "$[1].externalId",
|
|
421
|
-
productId: "$[1].productId",
|
|
422
|
-
variantIds: "$[1].variantIds"
|
|
423
|
-
},
|
|
662
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
424
663
|
singleArgumentUnchanged: false
|
|
425
664
|
},
|
|
426
|
-
["
|
|
665
|
+
["decrementData"]
|
|
427
666
|
);
|
|
428
667
|
sideEffects?.onError?.(err);
|
|
429
668
|
throw transformedError;
|
|
430
669
|
}
|
|
431
670
|
}
|
|
432
|
-
async function
|
|
433
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
671
|
+
async function incrementInventory2(incrementData) {
|
|
672
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
673
|
+
if (validateRequestSchema) {
|
|
674
|
+
IncrementInventoryRequest.parse({ incrementData });
|
|
675
|
+
}
|
|
434
676
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
435
|
-
|
|
677
|
+
incrementData
|
|
436
678
|
});
|
|
437
|
-
const reqOpts =
|
|
679
|
+
const reqOpts = incrementInventory(payload);
|
|
438
680
|
sideEffects?.onSiteCall?.();
|
|
439
681
|
try {
|
|
440
682
|
const result = await httpClient.request(reqOpts);
|
|
441
683
|
sideEffects?.onSuccess?.(result);
|
|
442
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
443
684
|
} catch (err) {
|
|
444
685
|
const transformedError = (0, import_transform_error.transformError)(
|
|
445
686
|
err,
|
|
446
687
|
{
|
|
447
688
|
spreadPathsToArguments: {},
|
|
448
|
-
explicitPathsToArguments: {
|
|
689
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
449
690
|
singleArgumentUnchanged: false
|
|
450
691
|
},
|
|
451
|
-
["
|
|
692
|
+
["incrementData"]
|
|
452
693
|
);
|
|
453
694
|
sideEffects?.onError?.(err);
|
|
454
695
|
throw transformedError;
|