@wix/auto_sdk_stores_inventory 1.0.65 → 1.0.66

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.
@@ -2,9 +2,7 @@ import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTF
2
2
  import { GetInventoryVariantsOptions, GetInventoryVariantsResponse, QueryInventoryOptions, QueryInventoryResponse, UpdateInventoryVariantsInventoryItem, DecrementData, IncrementData, InventoryItemChangedEnvelope, InventoryVariantsChangedEnvelope } from './index.typings.js';
3
3
  export { AccountInfo, BaseEventMetadata, BulkUpdateInventoryItemsRequest, BulkUpdateInventoryItemsResponse, BulkUpdateInventoryVariantsRequest, BulkUpdateInventoryVariantsRequestActionOneOf, BulkUpdateInventoryVariantsResponse, ChangedInventoryVariant, ChangedInventoryVariantData, DecrementDataIdOneOf, DecrementInventoryRequest, DecrementInventoryResponse, GetInventoryItemsRequest, GetInventoryItemsResponse, GetInventoryVariantsOptionsIdOneOf, GetInventoryVariantsRequest, GetInventoryVariantsRequestIdOneOf, IdentificationData, IdentificationDataIdOneOf, IncrementDataIdOneOf, IncrementInventoryRequest, IncrementInventoryResponse, InventoryItemChanged, InventoryItemV2, InventoryVariantV2, InventoryVariantsChanged, MessageEnvelope, Paging, PagingMetadata, PreorderInfo, Query, QueryInventoryRequest, ReasonType, ReasonTypeWithLiterals, UpdateInventoryVariantsRequest, UpdateInventoryVariantsResponse, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
4
4
 
5
- declare function getInventoryVariants$1(httpClient: HttpClient, __options?: {
6
- validateRequestSchema?: boolean;
7
- }): GetInventoryVariantsSignature;
5
+ declare function getInventoryVariants$1(httpClient: HttpClient): GetInventoryVariantsSignature;
8
6
  interface GetInventoryVariantsSignature {
9
7
  /**
10
8
  * Gets inventory variant information based on the specified option choices.
@@ -15,18 +13,14 @@ interface GetInventoryVariantsSignature {
15
13
  */
16
14
  (inventoryId: string, options?: GetInventoryVariantsOptions): Promise<NonNullablePaths<GetInventoryVariantsResponse, `inventoryItem.variants` | `inventoryItem.variants.${number}.variantId` | `inventoryItem.variants.${number}.availableForPreorder` | `inventoryItem.numericId` | `inventoryItem.preorderInfo.enabled`, 5>>;
17
15
  }
18
- declare function queryInventory$1(httpClient: HttpClient, __options?: {
19
- validateRequestSchema?: boolean;
20
- }): QueryInventorySignature;
16
+ declare function queryInventory$1(httpClient: HttpClient): QueryInventorySignature;
21
17
  interface QueryInventorySignature {
22
18
  /**
23
19
  * Returns a list of inventory items, given the provided paging, sorting and filtering.
24
20
  */
25
21
  (options?: QueryInventoryOptions): Promise<NonNullablePaths<QueryInventoryResponse, `inventoryItems` | `inventoryItems.${number}.numericId` | `inventoryItems.${number}.preorderInfo.enabled` | `metadata.items` | `metadata.offset` | `totalResults`, 5>>;
26
22
  }
27
- declare function updateInventoryVariants$1(httpClient: HttpClient, __options?: {
28
- validateRequestSchema?: boolean;
29
- }): UpdateInventoryVariantsSignature;
23
+ declare function updateInventoryVariants$1(httpClient: HttpClient): UpdateInventoryVariantsSignature;
30
24
  interface UpdateInventoryVariantsSignature {
31
25
  /**
32
26
  * Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.
@@ -38,9 +32,7 @@ interface UpdateInventoryVariantsSignature {
38
32
  */
39
33
  (productId: string, inventoryItem: UpdateInventoryVariantsInventoryItem): Promise<void>;
40
34
  }
41
- declare function decrementInventory$1(httpClient: HttpClient, __options?: {
42
- validateRequestSchema?: boolean;
43
- }): DecrementInventorySignature;
35
+ declare function decrementInventory$1(httpClient: HttpClient): DecrementInventorySignature;
44
36
  interface DecrementInventorySignature {
45
37
  /**
46
38
  * Subtracts a set number of items from inventory.
@@ -51,9 +43,7 @@ interface DecrementInventorySignature {
51
43
  */
52
44
  (decrementData: DecrementData[]): Promise<void>;
53
45
  }
54
- declare function incrementInventory$1(httpClient: HttpClient, __options?: {
55
- validateRequestSchema?: boolean;
56
- }): IncrementInventorySignature;
46
+ declare function incrementInventory$1(httpClient: HttpClient): IncrementInventorySignature;
57
47
  interface IncrementInventorySignature {
58
48
  /**
59
49
  * Adds a set number of items to inventory.
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // index.ts
@@ -327,222 +317,6 @@ function incrementInventory(payload) {
327
317
  return __incrementInventory;
328
318
  }
329
319
 
330
- // src/stores-v2-inventory-inventory.schemas.ts
331
- var z = __toESM(require("zod"));
332
- var GetInventoryVariantsRequest = z.object({
333
- inventoryId: z.string().describe("Inventory item ID."),
334
- options: z.intersection(
335
- z.object({ variantIds: z.array(z.string()).optional() }),
336
- z.xor([
337
- z.object({
338
- inventoryId: z.never().optional(),
339
- externalId: z.never().optional(),
340
- productId: z.never().optional()
341
- }),
342
- z.object({
343
- externalId: z.never().optional(),
344
- productId: z.never().optional(),
345
- inventoryId: z.string().describe("Inventory item ID.")
346
- }),
347
- z.object({
348
- inventoryId: z.never().optional(),
349
- productId: z.never().optional(),
350
- externalId: z.string().describe("Deprecated (use productID instead).")
351
- }),
352
- z.object({
353
- inventoryId: z.never().optional(),
354
- externalId: z.never().optional(),
355
- productId: z.string().describe("Product ID.")
356
- })
357
- ])
358
- ).optional()
359
- });
360
- var GetInventoryVariantsResponse = z.object({
361
- inventoryItem: z.object({
362
- _id: z.string().describe("Inventory item ID.").optional().nullable(),
363
- externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
364
- productId: z.string().describe("Product ID.").optional().nullable(),
365
- trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
366
- variants: z.array(
367
- z.object({
368
- variantId: z.string().describe("Variant ID.").optional(),
369
- inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
370
- quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
371
- availableForPreorder: z.boolean().describe(
372
- "Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
373
- ).optional()
374
- })
375
- ).optional(),
376
- lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
377
- numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
378
- "Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
379
- ).optional(),
380
- preorderInfo: z.object({
381
- enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
382
- message: z.string().describe(
383
- "A message the buyer will see when the item is out of stock and preorder is enabled."
384
- ).min(1).max(250).optional().nullable(),
385
- limit: z.number().int().describe(
386
- "Number of products that can be preordered after stock reaches zero."
387
- ).min(0).max(1e5).optional().nullable()
388
- }).describe("Preorder information.").optional()
389
- }).describe("Inventory item.").optional()
390
- });
391
- var QueryInventoryRequest = z.object({
392
- options: z.object({
393
- query: z.object({
394
- paging: z.object({
395
- limit: z.number().int().describe("Amount of items to load per page").min(0).max(100).optional().nullable(),
396
- offset: z.number().int().describe(
397
- "Number of items to skip in the display (relevant for all pages after the first)"
398
- ).min(0).optional().nullable()
399
- }).optional(),
400
- filter: z.string().describe("Filter string").optional().nullable(),
401
- sort: z.string().describe("Sort string").optional().nullable()
402
- }).optional()
403
- }).optional()
404
- });
405
- var QueryInventoryResponse = z.object({
406
- inventoryItems: z.array(
407
- z.object({
408
- _id: z.string().describe("Inventory item ID.").optional().nullable(),
409
- externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
410
- productId: z.string().describe("Product ID.").optional().nullable(),
411
- trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
412
- variants: z.array(
413
- z.object({
414
- variantId: z.string().describe("Variant ID.").optional(),
415
- inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
416
- quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
417
- availableForPreorder: z.boolean().describe(
418
- "Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
419
- ).optional()
420
- })
421
- ).optional(),
422
- lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
423
- numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
424
- "Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
425
- ).optional(),
426
- preorderInfo: z.object({
427
- enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
428
- message: z.string().describe(
429
- "A message the buyer will see when the item is out of stock and preorder is enabled."
430
- ).min(1).max(250).optional().nullable(),
431
- limit: z.number().int().describe(
432
- "Number of products that can be preordered after stock reaches zero."
433
- ).min(0).max(1e5).optional().nullable()
434
- }).describe("Preorder information.").optional()
435
- })
436
- ).optional(),
437
- metadata: z.object({
438
- items: z.number().int().describe("Amount of items to load per page").optional(),
439
- offset: z.number().int().describe(
440
- "Number of items to skip in the display (relevant for all pages after the first)"
441
- ).optional()
442
- }).describe("Display metadata.").optional(),
443
- totalResults: z.number().int().describe("Number of total results.").optional()
444
- });
445
- var UpdateInventoryVariantsRequest = z.object({
446
- productId: z.string().describe("Product ID."),
447
- inventoryItem: z.object({
448
- _id: z.string().describe("Inventory item ID.").optional().nullable(),
449
- externalId: z.string().describe("Deprecated: use productId.").optional().nullable(),
450
- productId: z.string().describe("Product ID.").optional().nullable(),
451
- trackQuantity: z.boolean().describe("Whether quantity is being tracked.").optional().nullable(),
452
- variants: z.array(
453
- z.object({
454
- variantId: z.string().describe("Variant ID.").optional(),
455
- inStock: z.boolean().describe("Whether the product is listed as in stock.").optional().nullable(),
456
- quantity: z.number().int().describe("Quantity currently left in inventory.").min(0).optional().nullable(),
457
- availableForPreorder: z.boolean().describe(
458
- "Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level."
459
- ).optional()
460
- })
461
- ).optional(),
462
- lastUpdated: z.date().describe("Last updated timestamp.").optional().nullable(),
463
- numericId: z.string().regex(/^\d+$/, "Must be a valid UInt64 string").describe(
464
- "Inventory\u2019s unique numeric ID (assigned in ascending order).\nPrimarily for sorting and filtering when crawling all inventories."
465
- ).optional(),
466
- preorderInfo: z.object({
467
- enabled: z.boolean().describe("Whether the item is available for preorder.").optional(),
468
- message: z.string().describe(
469
- "A message the buyer will see when the item is out of stock and preorder is enabled."
470
- ).min(1).max(250).optional().nullable(),
471
- limit: z.number().int().describe(
472
- "Number of products that can be preordered after stock reaches zero."
473
- ).min(0).max(1e5).optional().nullable()
474
- }).describe("Preorder information.").optional()
475
- }).describe("Inventory item to update.")
476
- });
477
- var UpdateInventoryVariantsResponse = z.object({});
478
- var DecrementInventoryRequest = z.object({
479
- decrementData: z.array(
480
- z.intersection(
481
- z.object({
482
- variantId: z.string().describe("Variant ID.").regex(
483
- /^[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}$/,
484
- "Must be a valid GUID"
485
- ).optional(),
486
- decrementBy: z.number().int().describe("Number to decrement inventory by.").min(1).optional(),
487
- preorderRequest: z.boolean().describe(
488
- "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)."
489
- ).optional()
490
- }),
491
- z.xor([
492
- z.object({
493
- inventoryId: z.never().optional(),
494
- externalId: z.never().optional(),
495
- productId: z.never().optional()
496
- }),
497
- z.object({
498
- externalId: z.never().optional(),
499
- productId: z.never().optional(),
500
- inventoryId: z.string().describe("Inventory item ID.").max(36)
501
- }),
502
- z.object({
503
- inventoryId: z.never().optional(),
504
- productId: z.never().optional(),
505
- externalId: z.string().describe("Deprecated: use productId.").max(36)
506
- }),
507
- z.object({
508
- inventoryId: z.never().optional(),
509
- externalId: z.never().optional(),
510
- productId: z.string().describe("Product ID.").max(36)
511
- })
512
- ])
513
- )
514
- ).min(1).max(300)
515
- });
516
- var DecrementInventoryResponse = z.object({});
517
- var IncrementInventoryRequest = z.object({
518
- incrementData: z.array(
519
- z.intersection(
520
- z.object({
521
- variantId: z.string().describe("Variant ID.").regex(
522
- /^[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}$/,
523
- "Must be a valid GUID"
524
- ).optional(),
525
- incrementBy: z.number().int().describe("Number to increment inventory by.").min(1).optional()
526
- }),
527
- z.xor([
528
- z.object({
529
- inventoryId: z.never().optional(),
530
- productId: z.never().optional()
531
- }),
532
- z.object({
533
- productId: z.never().optional(),
534
- inventoryId: z.string().describe("Inventory item ID.").max(36)
535
- }),
536
- z.object({
537
- inventoryId: z.never().optional(),
538
- productId: z.string().describe("Product ID.").max(36)
539
- })
540
- ])
541
- )
542
- ).min(1).max(300)
543
- });
544
- var IncrementInventoryResponse = z.object({});
545
-
546
320
  // src/stores-v2-inventory-inventory.universal.ts
547
321
  var ReasonType = /* @__PURE__ */ ((ReasonType2) => {
548
322
  ReasonType2["UNKNOWN"] = "UNKNOWN";
@@ -560,10 +334,7 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
560
334
  return WebhookIdentityType2;
561
335
  })(WebhookIdentityType || {});
562
336
  async function getInventoryVariants2(inventoryId, options) {
563
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
564
- if (validateRequestSchema) {
565
- GetInventoryVariantsRequest.parse({ inventoryId, options });
566
- }
337
+ const { httpClient, sideEffects } = arguments[2];
567
338
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
568
339
  inventoryId,
569
340
  externalId: options?.externalId,
@@ -596,10 +367,7 @@ async function getInventoryVariants2(inventoryId, options) {
596
367
  }
597
368
  }
598
369
  async function queryInventory2(options) {
599
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
600
- if (validateRequestSchema) {
601
- QueryInventoryRequest.parse({ options });
602
- }
370
+ const { httpClient, sideEffects } = arguments[1];
603
371
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
604
372
  query: options?.query
605
373
  });
@@ -624,10 +392,7 @@ async function queryInventory2(options) {
624
392
  }
625
393
  }
626
394
  async function updateInventoryVariants2(productId, inventoryItem) {
627
- const { httpClient, sideEffects, validateRequestSchema } = arguments[2];
628
- if (validateRequestSchema) {
629
- UpdateInventoryVariantsRequest.parse({ productId, inventoryItem });
630
- }
395
+ const { httpClient, sideEffects } = arguments[2];
631
396
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
632
397
  inventoryItem: { ...inventoryItem, productId }
633
398
  });
@@ -651,10 +416,7 @@ async function updateInventoryVariants2(productId, inventoryItem) {
651
416
  }
652
417
  }
653
418
  async function decrementInventory2(decrementData) {
654
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
655
- if (validateRequestSchema) {
656
- DecrementInventoryRequest.parse({ decrementData });
657
- }
419
+ const { httpClient, sideEffects } = arguments[1];
658
420
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
659
421
  decrementData
660
422
  });
@@ -678,10 +440,7 @@ async function decrementInventory2(decrementData) {
678
440
  }
679
441
  }
680
442
  async function incrementInventory2(incrementData) {
681
- const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
682
- if (validateRequestSchema) {
683
- IncrementInventoryRequest.parse({ incrementData });
684
- }
443
+ const { httpClient, sideEffects } = arguments[1];
685
444
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
686
445
  incrementData
687
446
  });
@@ -706,41 +465,41 @@ async function incrementInventory2(incrementData) {
706
465
  }
707
466
 
708
467
  // src/stores-v2-inventory-inventory.public.ts
709
- function getInventoryVariants3(httpClient, __options) {
468
+ function getInventoryVariants3(httpClient) {
710
469
  return (inventoryId, options) => getInventoryVariants2(
711
470
  inventoryId,
712
471
  options,
713
472
  // @ts-ignore
714
- { httpClient, validateRequestSchema: __options?.validateRequestSchema }
473
+ { httpClient }
715
474
  );
716
475
  }
717
- function queryInventory3(httpClient, __options) {
476
+ function queryInventory3(httpClient) {
718
477
  return (options) => queryInventory2(
719
478
  options,
720
479
  // @ts-ignore
721
- { httpClient, validateRequestSchema: __options?.validateRequestSchema }
480
+ { httpClient }
722
481
  );
723
482
  }
724
- function updateInventoryVariants3(httpClient, __options) {
483
+ function updateInventoryVariants3(httpClient) {
725
484
  return (productId, inventoryItem) => updateInventoryVariants2(
726
485
  productId,
727
486
  inventoryItem,
728
487
  // @ts-ignore
729
- { httpClient, validateRequestSchema: __options?.validateRequestSchema }
488
+ { httpClient }
730
489
  );
731
490
  }
732
- function decrementInventory3(httpClient, __options) {
491
+ function decrementInventory3(httpClient) {
733
492
  return (decrementData) => decrementInventory2(
734
493
  decrementData,
735
494
  // @ts-ignore
736
- { httpClient, validateRequestSchema: __options?.validateRequestSchema }
495
+ { httpClient }
737
496
  );
738
497
  }
739
- function incrementInventory3(httpClient, __options) {
498
+ function incrementInventory3(httpClient) {
740
499
  return (incrementData) => incrementInventory2(
741
500
  incrementData,
742
501
  // @ts-ignore
743
- { httpClient, validateRequestSchema: __options?.validateRequestSchema }
502
+ { httpClient }
744
503
  );
745
504
  }
746
505
  var onInventoryItemChanged = (0, import_sdk_types.EventDefinition)(