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