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