@wix/auto_sdk_stores_inventory 1.0.65 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +24 -34
- package/build/cjs/index.js +176 -417
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +197 -197
- package/build/cjs/index.typings.js +153 -394
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +178 -178
- package/build/cjs/meta.js +140 -140
- package/build/cjs/meta.js.map +1 -1
- package/build/cjs/schemas.d.ts +63 -63
- package/build/cjs/schemas.js +100 -100
- package/build/cjs/schemas.js.map +1 -1
- package/build/es/index.d.mts +24 -34
- package/build/es/index.mjs +176 -407
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +197 -197
- package/build/es/index.typings.mjs +153 -384
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +178 -178
- package/build/es/meta.mjs +140 -140
- package/build/es/meta.mjs.map +1 -1
- package/build/es/schemas.d.mts +63 -63
- package/build/es/schemas.mjs +100 -100
- package/build/es/schemas.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +24 -34
- package/build/internal/cjs/index.js +176 -417
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +230 -230
- package/build/internal/cjs/index.typings.js +153 -394
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +178 -178
- package/build/internal/cjs/meta.js +140 -140
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/cjs/schemas.d.ts +63 -63
- package/build/internal/cjs/schemas.js +100 -100
- package/build/internal/cjs/schemas.js.map +1 -1
- package/build/internal/es/index.d.mts +24 -34
- package/build/internal/es/index.mjs +176 -407
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +230 -230
- package/build/internal/es/index.typings.mjs +153 -384
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +178 -178
- package/build/internal/es/meta.mjs +140 -140
- package/build/internal/es/meta.mjs.map +1 -1
- package/build/internal/es/schemas.d.mts +63 -63
- package/build/internal/es/schemas.mjs +100 -100
- package/build/internal/es/schemas.mjs.map +1 -1
- package/package.json +2 -2
package/build/es/index.mjs
CHANGED
|
@@ -17,6 +17,67 @@ 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
|
+
}
|
|
20
81
|
function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
21
82
|
const domainToMappings = {
|
|
22
83
|
"api._api_base_domain_": [
|
|
@@ -100,122 +161,7 @@ function resolveWixInventoryApiV1InventoryWriteApiUrl(opts) {
|
|
|
100
161
|
};
|
|
101
162
|
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
102
163
|
}
|
|
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
|
-
}
|
|
219
165
|
function updateInventoryVariants(payload) {
|
|
220
166
|
function __updateInventoryVariants({ host }) {
|
|
221
167
|
const serializedData = transformPaths(payload, [
|
|
@@ -285,222 +231,60 @@ function incrementInventory(payload) {
|
|
|
285
231
|
}
|
|
286
232
|
return __incrementInventory;
|
|
287
233
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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()
|
|
234
|
+
function getInventoryVariants(payload) {
|
|
235
|
+
function __getInventoryVariants({ host }) {
|
|
236
|
+
const metadata = {
|
|
237
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
238
|
+
method: "POST",
|
|
239
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.GetInventoryVariants",
|
|
240
|
+
packageName: PACKAGE_NAME,
|
|
241
|
+
migrationOptions: {
|
|
242
|
+
optInTransformResponse: true
|
|
243
|
+
},
|
|
244
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
245
|
+
protoPath: "/v2/inventoryItems/{inventoryId}/getVariants",
|
|
246
|
+
data: payload,
|
|
247
|
+
host
|
|
449
248
|
}),
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
})
|
|
249
|
+
data: payload,
|
|
250
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
251
|
+
{
|
|
252
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
253
|
+
paths: [{ path: "inventoryItem.lastUpdated" }]
|
|
254
|
+
}
|
|
471
255
|
])
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
256
|
+
};
|
|
257
|
+
return metadata;
|
|
258
|
+
}
|
|
259
|
+
return __getInventoryVariants;
|
|
260
|
+
}
|
|
261
|
+
function queryInventory(payload) {
|
|
262
|
+
function __queryInventory({ host }) {
|
|
263
|
+
const metadata = {
|
|
264
|
+
entityFqdn: "wix.stores.v2.inventory",
|
|
265
|
+
method: "POST",
|
|
266
|
+
methodFqn: "wix.inventory.api.v1.InventoryReadApi.QueryInventory",
|
|
267
|
+
packageName: PACKAGE_NAME,
|
|
268
|
+
migrationOptions: {
|
|
269
|
+
optInTransformResponse: true
|
|
270
|
+
},
|
|
271
|
+
url: resolveWixInventoryApiV1InventoryReadApiUrl({
|
|
272
|
+
protoPath: "/v2/inventoryItems/query",
|
|
273
|
+
data: payload,
|
|
274
|
+
host
|
|
485
275
|
}),
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
-
})
|
|
276
|
+
data: payload,
|
|
277
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
278
|
+
{
|
|
279
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
280
|
+
paths: [{ path: "inventoryItems.lastUpdated" }]
|
|
281
|
+
}
|
|
499
282
|
])
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
283
|
+
};
|
|
284
|
+
return metadata;
|
|
285
|
+
}
|
|
286
|
+
return __queryInventory;
|
|
287
|
+
}
|
|
504
288
|
|
|
505
289
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
506
290
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
@@ -518,79 +302,60 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
518
302
|
WebhookIdentityType2["APP"] = "APP";
|
|
519
303
|
return WebhookIdentityType2;
|
|
520
304
|
})(WebhookIdentityType || {});
|
|
521
|
-
async function
|
|
522
|
-
const { httpClient, sideEffects
|
|
523
|
-
if (validateRequestSchema) {
|
|
524
|
-
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
525
|
-
}
|
|
305
|
+
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
306
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
526
307
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
527
|
-
|
|
528
|
-
externalId: options?.externalId,
|
|
529
|
-
productId: options?.productId,
|
|
530
|
-
variantIds: options?.variantIds
|
|
308
|
+
inventoryItem: { ...inventoryItem, productId }
|
|
531
309
|
});
|
|
532
|
-
const reqOpts =
|
|
310
|
+
const reqOpts = updateInventoryVariants(payload);
|
|
533
311
|
sideEffects?.onSiteCall?.();
|
|
534
312
|
try {
|
|
535
313
|
const result = await httpClient.request(reqOpts);
|
|
536
314
|
sideEffects?.onSuccess?.(result);
|
|
537
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
538
315
|
} catch (err) {
|
|
539
316
|
const transformedError = sdkTransformError(
|
|
540
317
|
err,
|
|
541
318
|
{
|
|
542
|
-
spreadPathsToArguments: {},
|
|
543
|
-
explicitPathsToArguments: {
|
|
544
|
-
inventoryId: "$[0]",
|
|
545
|
-
externalId: "$[1].externalId",
|
|
546
|
-
productId: "$[1].productId",
|
|
547
|
-
variantIds: "$[1].variantIds"
|
|
548
|
-
},
|
|
319
|
+
spreadPathsToArguments: { inventoryItem: "$[1]" },
|
|
320
|
+
explicitPathsToArguments: { "inventoryItem.productId": "$[0]" },
|
|
549
321
|
singleArgumentUnchanged: false
|
|
550
322
|
},
|
|
551
|
-
["
|
|
323
|
+
["productId", "inventoryItem"]
|
|
552
324
|
);
|
|
553
325
|
sideEffects?.onError?.(err);
|
|
554
326
|
throw transformedError;
|
|
555
327
|
}
|
|
556
328
|
}
|
|
557
|
-
async function
|
|
558
|
-
const { httpClient, sideEffects
|
|
559
|
-
if (validateRequestSchema) {
|
|
560
|
-
QueryInventoryRequest.parse({ options });
|
|
561
|
-
}
|
|
329
|
+
async function decrementInventory2(decrementData) {
|
|
330
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
562
331
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
563
|
-
|
|
332
|
+
decrementData
|
|
564
333
|
});
|
|
565
|
-
const reqOpts =
|
|
334
|
+
const reqOpts = decrementInventory(payload);
|
|
566
335
|
sideEffects?.onSiteCall?.();
|
|
567
336
|
try {
|
|
568
337
|
const result = await httpClient.request(reqOpts);
|
|
569
338
|
sideEffects?.onSuccess?.(result);
|
|
570
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
571
339
|
} catch (err) {
|
|
572
340
|
const transformedError = sdkTransformError(
|
|
573
341
|
err,
|
|
574
342
|
{
|
|
575
343
|
spreadPathsToArguments: {},
|
|
576
|
-
explicitPathsToArguments: {
|
|
344
|
+
explicitPathsToArguments: { decrementData: "$[0]" },
|
|
577
345
|
singleArgumentUnchanged: false
|
|
578
346
|
},
|
|
579
|
-
["
|
|
347
|
+
["decrementData"]
|
|
580
348
|
);
|
|
581
349
|
sideEffects?.onError?.(err);
|
|
582
350
|
throw transformedError;
|
|
583
351
|
}
|
|
584
352
|
}
|
|
585
|
-
async function
|
|
586
|
-
const { httpClient, sideEffects
|
|
587
|
-
if (validateRequestSchema) {
|
|
588
|
-
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
589
|
-
}
|
|
353
|
+
async function incrementInventory2(incrementData) {
|
|
354
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
590
355
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
591
|
-
|
|
356
|
+
incrementData
|
|
592
357
|
});
|
|
593
|
-
const reqOpts =
|
|
358
|
+
const reqOpts = incrementInventory(payload);
|
|
594
359
|
sideEffects?.onSiteCall?.();
|
|
595
360
|
try {
|
|
596
361
|
const result = await httpClient.request(reqOpts);
|
|
@@ -599,65 +364,69 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
599
364
|
const transformedError = sdkTransformError(
|
|
600
365
|
err,
|
|
601
366
|
{
|
|
602
|
-
spreadPathsToArguments: {
|
|
603
|
-
explicitPathsToArguments: {
|
|
367
|
+
spreadPathsToArguments: {},
|
|
368
|
+
explicitPathsToArguments: { incrementData: "$[0]" },
|
|
604
369
|
singleArgumentUnchanged: false
|
|
605
370
|
},
|
|
606
|
-
["
|
|
371
|
+
["incrementData"]
|
|
607
372
|
);
|
|
608
373
|
sideEffects?.onError?.(err);
|
|
609
374
|
throw transformedError;
|
|
610
375
|
}
|
|
611
376
|
}
|
|
612
|
-
async function
|
|
613
|
-
const { httpClient, sideEffects
|
|
614
|
-
if (validateRequestSchema) {
|
|
615
|
-
DecrementInventoryRequest.parse({ decrementData });
|
|
616
|
-
}
|
|
377
|
+
async function getInventoryVariants2(inventoryId, options) {
|
|
378
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
617
379
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
618
|
-
|
|
380
|
+
inventoryId,
|
|
381
|
+
externalId: options?.externalId,
|
|
382
|
+
productId: options?.productId,
|
|
383
|
+
variantIds: options?.variantIds
|
|
619
384
|
});
|
|
620
|
-
const reqOpts =
|
|
385
|
+
const reqOpts = getInventoryVariants(payload);
|
|
621
386
|
sideEffects?.onSiteCall?.();
|
|
622
387
|
try {
|
|
623
388
|
const result = await httpClient.request(reqOpts);
|
|
624
389
|
sideEffects?.onSuccess?.(result);
|
|
390
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
625
391
|
} catch (err) {
|
|
626
392
|
const transformedError = sdkTransformError(
|
|
627
393
|
err,
|
|
628
394
|
{
|
|
629
395
|
spreadPathsToArguments: {},
|
|
630
|
-
explicitPathsToArguments: {
|
|
396
|
+
explicitPathsToArguments: {
|
|
397
|
+
inventoryId: "$[0]",
|
|
398
|
+
externalId: "$[1].externalId",
|
|
399
|
+
productId: "$[1].productId",
|
|
400
|
+
variantIds: "$[1].variantIds"
|
|
401
|
+
},
|
|
631
402
|
singleArgumentUnchanged: false
|
|
632
403
|
},
|
|
633
|
-
["
|
|
404
|
+
["inventoryId", "options"]
|
|
634
405
|
);
|
|
635
406
|
sideEffects?.onError?.(err);
|
|
636
407
|
throw transformedError;
|
|
637
408
|
}
|
|
638
409
|
}
|
|
639
|
-
async function
|
|
640
|
-
const { httpClient, sideEffects
|
|
641
|
-
if (validateRequestSchema) {
|
|
642
|
-
IncrementInventoryRequest.parse({ incrementData });
|
|
643
|
-
}
|
|
410
|
+
async function queryInventory2(options) {
|
|
411
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
644
412
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
645
|
-
|
|
413
|
+
query: options?.query
|
|
646
414
|
});
|
|
647
|
-
const reqOpts =
|
|
415
|
+
const reqOpts = queryInventory(payload);
|
|
648
416
|
sideEffects?.onSiteCall?.();
|
|
649
417
|
try {
|
|
650
418
|
const result = await httpClient.request(reqOpts);
|
|
651
419
|
sideEffects?.onSuccess?.(result);
|
|
420
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
652
421
|
} catch (err) {
|
|
653
422
|
const transformedError = sdkTransformError(
|
|
654
423
|
err,
|
|
655
424
|
{
|
|
656
425
|
spreadPathsToArguments: {},
|
|
657
|
-
explicitPathsToArguments: {
|
|
426
|
+
explicitPathsToArguments: { query: "$[0].query" },
|
|
658
427
|
singleArgumentUnchanged: false
|
|
659
428
|
},
|
|
660
|
-
["
|
|
429
|
+
["options"]
|
|
661
430
|
);
|
|
662
431
|
sideEffects?.onError?.(err);
|
|
663
432
|
throw transformedError;
|
|
@@ -665,41 +434,41 @@ async function incrementInventory2(incrementData) {
|
|
|
665
434
|
}
|
|
666
435
|
|
|
667
436
|
// src/stores-v2-inventory-inventory.public.ts
|
|
668
|
-
function
|
|
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) {
|
|
437
|
+
function updateInventoryVariants3(httpClient) {
|
|
684
438
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
685
439
|
productId,
|
|
686
440
|
inventoryItem,
|
|
687
441
|
// @ts-ignore
|
|
688
|
-
{ httpClient
|
|
442
|
+
{ httpClient }
|
|
689
443
|
);
|
|
690
444
|
}
|
|
691
|
-
function decrementInventory3(httpClient
|
|
445
|
+
function decrementInventory3(httpClient) {
|
|
692
446
|
return (decrementData) => decrementInventory2(
|
|
693
447
|
decrementData,
|
|
694
448
|
// @ts-ignore
|
|
695
|
-
{ httpClient
|
|
449
|
+
{ httpClient }
|
|
696
450
|
);
|
|
697
451
|
}
|
|
698
|
-
function incrementInventory3(httpClient
|
|
452
|
+
function incrementInventory3(httpClient) {
|
|
699
453
|
return (incrementData) => incrementInventory2(
|
|
700
454
|
incrementData,
|
|
701
455
|
// @ts-ignore
|
|
702
|
-
{ httpClient
|
|
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 }
|
|
703
472
|
);
|
|
704
473
|
}
|
|
705
474
|
var onInventoryItemChanged = EventDefinition(
|
|
@@ -734,11 +503,11 @@ var onInventoryVariantsChanged = EventDefinition(
|
|
|
734
503
|
// src/stores-v2-inventory-inventory.context.ts
|
|
735
504
|
import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
|
|
736
505
|
import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
|
|
737
|
-
var getInventoryVariants4 = /* @__PURE__ */ createRESTModule(getInventoryVariants3);
|
|
738
|
-
var queryInventory4 = /* @__PURE__ */ createRESTModule(queryInventory3);
|
|
739
506
|
var updateInventoryVariants4 = /* @__PURE__ */ createRESTModule(updateInventoryVariants3);
|
|
740
507
|
var decrementInventory4 = /* @__PURE__ */ createRESTModule(decrementInventory3);
|
|
741
508
|
var incrementInventory4 = /* @__PURE__ */ createRESTModule(incrementInventory3);
|
|
509
|
+
var getInventoryVariants4 = /* @__PURE__ */ createRESTModule(getInventoryVariants3);
|
|
510
|
+
var queryInventory4 = /* @__PURE__ */ createRESTModule(queryInventory3);
|
|
742
511
|
var onInventoryItemChanged2 = createEventModule(
|
|
743
512
|
onInventoryItemChanged
|
|
744
513
|
);
|