@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
|
@@ -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.typings.ts
|
|
@@ -49,6 +39,67 @@ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
|
49
39
|
var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
50
40
|
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
51
41
|
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
|
+
}
|
|
52
103
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
53
104
|
const domainToMappings = {
|
|
54
105
|
"api._api_base_domain_": [
|
|
@@ -132,122 +183,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
132
183
|
};
|
|
133
184
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
134
185
|
}
|
|
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
|
-
}
|
|
196
186
|
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
|
-
}
|
|
251
187
|
function updateInventoryVariants(payload) {
|
|
252
188
|
function __updateInventoryVariants({ host }) {
|
|
253
189
|
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
@@ -317,222 +253,60 @@ function incrementInventory(payload) {
|
|
|
317
253
|
}
|
|
318
254
|
return __incrementInventory;
|
|
319
255
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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()
|
|
256
|
+
function getInventoryVariants(payload) {
|
|
257
|
+
function __getInventoryVariants({ host }) {
|
|
258
|
+
const metadata = {
|
|
259
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
260
|
+
method: "POST",
|
|
261
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
262
|
+
packageName: PACKAGE_NAME,
|
|
263
|
+
migrationOptions: {
|
|
264
|
+
optInTransformResponse: true
|
|
265
|
+
},
|
|
266
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
267
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
268
|
+
data: payload,
|
|
269
|
+
host
|
|
481
270
|
}),
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
-
})
|
|
271
|
+
data: payload,
|
|
272
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
273
|
+
{
|
|
274
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
275
|
+
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
276
|
+
}
|
|
503
277
|
])
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
278
|
+
};
|
|
279
|
+
return metadata;
|
|
280
|
+
}
|
|
281
|
+
return __getInventoryVariants;
|
|
282
|
+
}
|
|
283
|
+
function queryInventory(payload) {
|
|
284
|
+
function __queryInventory({ host }) {
|
|
285
|
+
const metadata = {
|
|
286
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
287
|
+
method: "POST",
|
|
288
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
289
|
+
packageName: PACKAGE_NAME,
|
|
290
|
+
migrationOptions: {
|
|
291
|
+
optInTransformResponse: true
|
|
292
|
+
},
|
|
293
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
294
|
+
protoPath: "/v2/inventoryItems/query",
|
|
295
|
+
data: payload,
|
|
296
|
+
host
|
|
517
297
|
}),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
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
|
-
})
|
|
298
|
+
data: payload,
|
|
299
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
300
|
+
{
|
|
301
|
+
transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
|
|
302
|
+
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
303
|
+
}
|
|
531
304
|
])
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
|
|
305
|
+
};
|
|
306
|
+
return metadata;
|
|
307
|
+
}
|
|
308
|
+
return __queryInventory;
|
|
309
|
+
}
|
|
536
310
|
|
|
537
311
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
538
312
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -550,79 +324,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
550
324
|
WebhookIdentityType2["APP"] = "APP";
|
|
551
325
|
return WebhookIdentityType2;
|
|
552
326
|
})(WebhookIdentityType || {});
|
|
553
|
-
async function
|
|
554
|
-
const { httpClient, sideEffects
|
|
555
|
-
if (validateRequestSchema) {
|
|
556
|
-
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
557
|
-
}
|
|
327
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
328
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
558
329
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
559
|
-
|
|
560
|
-
externalId: options?.externalId,
|
|
561
|
-
productId: options?.productId,
|
|
562
|
-
variantIds: options?.variantIds
|
|
330
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
563
331
|
});
|
|
564
|
-
const reqOpts =
|
|
332
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
565
333
|
sideEffects?.onSiteCall?.();
|
|
566
334
|
try {
|
|
567
335
|
const result = await httpClient.request(reqOpts);
|
|
568
336
|
sideEffects?.onSuccess?.(result);
|
|
569
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
570
337
|
} catch (err) {
|
|
571
338
|
const transformedError = (0, import_transform_error.transformError)(
|
|
572
339
|
err,
|
|
573
340
|
{
|
|
574
|
-
spreadPathsToArguments: {},
|
|
575
|
-
explicitPathsToArguments: {
|
|
576
|
-
inventoryId: "$[0]",
|
|
577
|
-
externalId: "$[1].externalId",
|
|
578
|
-
productId: "$[1].productId",
|
|
579
|
-
variantIds: "$[1].variantIds"
|
|
580
|
-
},
|
|
341
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
342
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
581
343
|
singleArgumentUnchanged: false
|
|
582
344
|
},
|
|
583
|
-
["
|
|
345
|
+
["productId", "inventoryItem"]
|
|
584
346
|
);
|
|
585
347
|
sideEffects?.onError?.(err);
|
|
586
348
|
throw transformedError;
|
|
587
349
|
}
|
|
588
350
|
}
|
|
589
|
-
async function
|
|
590
|
-
const { httpClient, sideEffects
|
|
591
|
-
if (validateRequestSchema) {
|
|
592
|
-
QueryInventoryRequest.parse({ options });
|
|
593
|
-
}
|
|
351
|
+
async function decrementInventory2(decrementData) {
|
|
352
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
594
353
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
595
|
-
|
|
354
|
+
decrementData
|
|
596
355
|
});
|
|
597
|
-
const reqOpts =
|
|
356
|
+
const reqOpts = decrementInventory(payload);
|
|
598
357
|
sideEffects?.onSiteCall?.();
|
|
599
358
|
try {
|
|
600
359
|
const result = await httpClient.request(reqOpts);
|
|
601
360
|
sideEffects?.onSuccess?.(result);
|
|
602
|
-
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
603
361
|
} catch (err) {
|
|
604
362
|
const transformedError = (0, import_transform_error.transformError)(
|
|
605
363
|
err,
|
|
606
364
|
{
|
|
607
365
|
spreadPathsToArguments: {},
|
|
608
|
-
explicitPathsToArguments: {
|
|
366
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
609
367
|
singleArgumentUnchanged: false
|
|
610
368
|
},
|
|
611
|
-
["
|
|
369
|
+
["decrementData"]
|
|
612
370
|
);
|
|
613
371
|
sideEffects?.onError?.(err);
|
|
614
372
|
throw transformedError;
|
|
615
373
|
}
|
|
616
374
|
}
|
|
617
|
-
async function
|
|
618
|
-
const { httpClient, sideEffects
|
|
619
|
-
if (validateRequestSchema) {
|
|
620
|
-
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
621
|
-
}
|
|
375
|
+
async function incrementInventory2(incrementData) {
|
|
376
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
622
377
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
623
|
-
|
|
378
|
+
incrementData
|
|
624
379
|
});
|
|
625
|
-
const reqOpts =
|
|
380
|
+
const reqOpts = incrementInventory(payload);
|
|
626
381
|
sideEffects?.onSiteCall?.();
|
|
627
382
|
try {
|
|
628
383
|
const result = await httpClient.request(reqOpts);
|
|
@@ -631,65 +386,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
631
386
|
const transformedError = (0, import_transform_error.transformError)(
|
|
632
387
|
err,
|
|
633
388
|
{
|
|
634
|
-
spreadPathsToArguments: {
|
|
635
|
-
explicitPathsToArguments: {
|
|
389
|
+
spreadPathsToArguments: {},
|
|
390
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
636
391
|
singleArgumentUnchanged: false
|
|
637
392
|
},
|
|
638
|
-
["
|
|
393
|
+
["incrementData"]
|
|
639
394
|
);
|
|
640
395
|
sideEffects?.onError?.(err);
|
|
641
396
|
throw transformedError;
|
|
642
397
|
}
|
|
643
398
|
}
|
|
644
|
-
async function
|
|
645
|
-
const { httpClient, sideEffects
|
|
646
|
-
if (validateRequestSchema) {
|
|
647
|
-
DecrementInventoryRequest.parse({ decrementData });
|
|
648
|
-
}
|
|
399
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
400
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
649
401
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
650
|
-
|
|
402
|
+
inventoryId,
|
|
403
|
+
externalId: options?.externalId,
|
|
404
|
+
productId: options?.productId,
|
|
405
|
+
variantIds: options?.variantIds
|
|
651
406
|
});
|
|
652
|
-
const reqOpts =
|
|
407
|
+
const reqOpts = getInventoryVariants(payload);
|
|
653
408
|
sideEffects?.onSiteCall?.();
|
|
654
409
|
try {
|
|
655
410
|
const result = await httpClient.request(reqOpts);
|
|
656
411
|
sideEffects?.onSuccess?.(result);
|
|
412
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
657
413
|
} catch (err) {
|
|
658
414
|
const transformedError = (0, import_transform_error.transformError)(
|
|
659
415
|
err,
|
|
660
416
|
{
|
|
661
417
|
spreadPathsToArguments: {},
|
|
662
|
-
explicitPathsToArguments: {
|
|
418
|
+
explicitPathsToArguments: {
|
|
419
|
+
inventoryId: "$[0]",
|
|
420
|
+
externalId: "$[1].externalId",
|
|
421
|
+
productId: "$[1].productId",
|
|
422
|
+
variantIds: "$[1].variantIds"
|
|
423
|
+
},
|
|
663
424
|
singleArgumentUnchanged: false
|
|
664
425
|
},
|
|
665
|
-
["
|
|
426
|
+
["inventoryId", "options"]
|
|
666
427
|
);
|
|
667
428
|
sideEffects?.onError?.(err);
|
|
668
429
|
throw transformedError;
|
|
669
430
|
}
|
|
670
431
|
}
|
|
671
|
-
async function
|
|
672
|
-
const { httpClient, sideEffects
|
|
673
|
-
if (validateRequestSchema) {
|
|
674
|
-
IncrementInventoryRequest.parse({ incrementData });
|
|
675
|
-
}
|
|
432
|
+
async function queryInventory2(options) {
|
|
433
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
676
434
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
677
|
-
|
|
435
|
+
query: options?.query
|
|
678
436
|
});
|
|
679
|
-
const reqOpts =
|
|
437
|
+
const reqOpts = queryInventory(payload);
|
|
680
438
|
sideEffects?.onSiteCall?.();
|
|
681
439
|
try {
|
|
682
440
|
const result = await httpClient.request(reqOpts);
|
|
683
441
|
sideEffects?.onSuccess?.(result);
|
|
442
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
684
443
|
} catch (err) {
|
|
685
444
|
const transformedError = (0, import_transform_error.transformError)(
|
|
686
445
|
err,
|
|
687
446
|
{
|
|
688
447
|
spreadPathsToArguments: {},
|
|
689
|
-
explicitPathsToArguments: {
|
|
448
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
690
449
|
singleArgumentUnchanged: false
|
|
691
450
|
},
|
|
692
|
-
["
|
|
451
|
+
["options"]
|
|
693
452
|
);
|
|
694
453
|
sideEffects?.onError?.(err);
|
|
695
454
|
throw transformedError;
|