@wix/auto_sdk_stores_inventory 1.0.64 → 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 +15 -5
- package/build/cjs/index.js +256 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.js +246 -5
- package/build/cjs/index.typings.js.map +1 -1
- package/build/es/index.d.mts +15 -5
- package/build/es/index.mjs +246 -15
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.mjs +236 -5
- package/build/es/index.typings.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +15 -5
- package/build/internal/cjs/index.js +256 -15
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.js +246 -5
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/es/index.d.mts +15 -5
- package/build/internal/es/index.mjs +246 -15
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.mjs +236 -5
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/package.json +2 -2
package/build/es/index.mjs
CHANGED
|
@@ -286,6 +286,222 @@ function incrementInventory(payload) {
|
|
|
286
286
|
return __incrementInventory;
|
|
287
287
|
}
|
|
288
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()
|
|
300
|
+
}),
|
|
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
|
+
})
|
|
471
|
+
])
|
|
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()
|
|
485
|
+
}),
|
|
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
|
+
})
|
|
499
|
+
])
|
|
500
|
+
)
|
|
501
|
+
).min(1).max(300)
|
|
502
|
+
});
|
|
503
|
+
var IncrementInventoryResponse = z.object({});
|
|
504
|
+
|
|
289
505
|
// src/stores-v2-inventory-inventory.universal.ts
|
|
290
506
|
var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
|
|
291
507
|
ReasonType2["UNKNOWN"] = "UNKNOWN";
|
|
@@ -303,7 +519,10 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
303
519
|
return WebhookIdentityType2;
|
|
304
520
|
})(WebhookIdentityType || {});
|
|
305
521
|
async function getInventoryVariants2(inventoryId, options) {
|
|
306
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
522
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
523
|
+
if (validateRequestSchema) {
|
|
524
|
+
GetInventoryVariantsRequest.parse({ inventoryId, options });
|
|
525
|
+
}
|
|
307
526
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
308
527
|
inventoryId,
|
|
309
528
|
externalId: options?.externalId,
|
|
@@ -336,7 +555,10 @@ async function getInventoryVariants2(inventoryId, options) {
|
|
|
336
555
|
}
|
|
337
556
|
}
|
|
338
557
|
async function queryInventory2(options) {
|
|
339
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
558
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
559
|
+
if (validateRequestSchema) {
|
|
560
|
+
QueryInventoryRequest.parse({ options });
|
|
561
|
+
}
|
|
340
562
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
341
563
|
query: options?.query
|
|
342
564
|
});
|
|
@@ -361,7 +583,10 @@ async function queryInventory2(options) {
|
|
|
361
583
|
}
|
|
362
584
|
}
|
|
363
585
|
async function updateInventoryVariants2(productId, inventoryItem) {
|
|
364
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
586
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
|
|
587
|
+
if (validateRequestSchema) {
|
|
588
|
+
UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
|
|
589
|
+
}
|
|
365
590
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
366
591
|
inventoryItem: { ...inventoryItem, productId }
|
|
367
592
|
});
|
|
@@ -385,7 +610,10 @@ async function updateInventoryVariants2(productId, inventoryItem) {
|
|
|
385
610
|
}
|
|
386
611
|
}
|
|
387
612
|
async function decrementInventory2(decrementData) {
|
|
388
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
613
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
614
|
+
if (validateRequestSchema) {
|
|
615
|
+
DecrementInventoryRequest.parse({ decrementData });
|
|
616
|
+
}
|
|
389
617
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
390
618
|
decrementData
|
|
391
619
|
});
|
|
@@ -409,7 +637,10 @@ async function decrementInventory2(decrementData) {
|
|
|
409
637
|
}
|
|
410
638
|
}
|
|
411
639
|
async function incrementInventory2(incrementData) {
|
|
412
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
640
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
641
|
+
if (validateRequestSchema) {
|
|
642
|
+
IncrementInventoryRequest.parse({ incrementData });
|
|
643
|
+
}
|
|
413
644
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
414
645
|
incrementData
|
|
415
646
|
});
|
|
@@ -434,41 +665,41 @@ async function incrementInventory2(incrementData) {
|
|
|
434
665
|
}
|
|
435
666
|
|
|
436
667
|
// src/stores-v2-inventory-inventory.public.ts
|
|
437
|
-
function getInventoryVariants3(httpClient) {
|
|
668
|
+
function getInventoryVariants3(httpClient, __options) {
|
|
438
669
|
return (inventoryId, options) => getInventoryVariants2(
|
|
439
670
|
inventoryId,
|
|
440
671
|
options,
|
|
441
672
|
// @ts-ignore
|
|
442
|
-
{ httpClient }
|
|
673
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
443
674
|
);
|
|
444
675
|
}
|
|
445
|
-
function queryInventory3(httpClient) {
|
|
676
|
+
function queryInventory3(httpClient, __options) {
|
|
446
677
|
return (options) => queryInventory2(
|
|
447
678
|
options,
|
|
448
679
|
// @ts-ignore
|
|
449
|
-
{ httpClient }
|
|
680
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
450
681
|
);
|
|
451
682
|
}
|
|
452
|
-
function updateInventoryVariants3(httpClient) {
|
|
683
|
+
function updateInventoryVariants3(httpClient, __options) {
|
|
453
684
|
return (productId, inventoryItem) => updateInventoryVariants2(
|
|
454
685
|
productId,
|
|
455
686
|
inventoryItem,
|
|
456
687
|
// @ts-ignore
|
|
457
|
-
{ httpClient }
|
|
688
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
458
689
|
);
|
|
459
690
|
}
|
|
460
|
-
function decrementInventory3(httpClient) {
|
|
691
|
+
function decrementInventory3(httpClient, __options) {
|
|
461
692
|
return (decrementData) => decrementInventory2(
|
|
462
693
|
decrementData,
|
|
463
694
|
// @ts-ignore
|
|
464
|
-
{ httpClient }
|
|
695
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
465
696
|
);
|
|
466
697
|
}
|
|
467
|
-
function incrementInventory3(httpClient) {
|
|
698
|
+
function incrementInventory3(httpClient, __options) {
|
|
468
699
|
return (incrementData) => incrementInventory2(
|
|
469
700
|
incrementData,
|
|
470
701
|
// @ts-ignore
|
|
471
|
-
{ httpClient }
|
|
702
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
472
703
|
);
|
|
473
704
|
}
|
|
474
705
|
var onInventoryItemChanged = EventDefinition(
|