@ecomiq/core 0.1.5 → 0.1.7

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.
Files changed (59) hide show
  1. package/dist/client.cjs +46 -39
  2. package/dist/client.cjs.map +1 -1
  3. package/dist/client.d.cts +1 -0
  4. package/dist/client.d.ts +1 -0
  5. package/dist/client.js +46 -39
  6. package/dist/client.js.map +1 -1
  7. package/dist/index.cjs +49 -39
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +1 -0
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js +47 -40
  12. package/dist/index.js.map +1 -1
  13. package/dist/models/geo.cjs +10 -2
  14. package/dist/models/geo.cjs.map +1 -1
  15. package/dist/models/geo.d.cts +14 -14
  16. package/dist/models/geo.d.ts +14 -14
  17. package/dist/models/geo.js +10 -2
  18. package/dist/models/geo.js.map +1 -1
  19. package/dist/models/ids.cjs +17 -0
  20. package/dist/models/ids.cjs.map +1 -0
  21. package/dist/models/ids.d.cts +12 -0
  22. package/dist/models/ids.d.ts +12 -0
  23. package/dist/models/ids.js +13 -0
  24. package/dist/models/ids.js.map +1 -0
  25. package/dist/models/products.cjs +12 -4
  26. package/dist/models/products.cjs.map +1 -1
  27. package/dist/models/products.d.cts +4 -4
  28. package/dist/models/products.d.ts +4 -4
  29. package/dist/models/products.js +12 -4
  30. package/dist/models/products.js.map +1 -1
  31. package/dist/models/search.cjs +11 -5
  32. package/dist/models/search.cjs.map +1 -1
  33. package/dist/models/search.d.cts +1 -1
  34. package/dist/models/search.d.ts +1 -1
  35. package/dist/models/search.js +11 -5
  36. package/dist/models/search.js.map +1 -1
  37. package/dist/models/settings.cjs +20 -10
  38. package/dist/models/settings.cjs.map +1 -1
  39. package/dist/models/settings.d.cts +64 -63
  40. package/dist/models/settings.d.ts +64 -63
  41. package/dist/models/settings.js +18 -11
  42. package/dist/models/settings.js.map +1 -1
  43. package/dist/models/storefront-cart.cjs +23 -15
  44. package/dist/models/storefront-cart.cjs.map +1 -1
  45. package/dist/models/storefront-cart.d.cts +23 -23
  46. package/dist/models/storefront-cart.d.ts +23 -23
  47. package/dist/models/storefront-cart.js +23 -15
  48. package/dist/models/storefront-cart.js.map +1 -1
  49. package/dist/models/storefront-checkout.cjs +28 -22
  50. package/dist/models/storefront-checkout.cjs.map +1 -1
  51. package/dist/models/storefront-checkout.d.cts +43 -43
  52. package/dist/models/storefront-checkout.d.ts +43 -43
  53. package/dist/models/storefront-checkout.js +28 -22
  54. package/dist/models/storefront-checkout.js.map +1 -1
  55. package/dist/models/storefront-reviews.cjs +12 -4
  56. package/dist/models/storefront-reviews.cjs.map +1 -1
  57. package/dist/models/storefront-reviews.js +12 -4
  58. package/dist/models/storefront-reviews.js.map +1 -1
  59. package/package.json +6 -1
package/dist/client.cjs CHANGED
@@ -115,6 +115,14 @@ var CollectionSchema = zod.z.object({
115
115
  productCount: zod.z.number().optional()
116
116
  });
117
117
  var CollectionsSchema = zod.z.array(CollectionSchema);
118
+ var EntityIdSchema = zod.z.union([
119
+ zod.z.string().uuid(),
120
+ zod.z.string().regex(/^\d+$/, "Expected numeric id")
121
+ ]);
122
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
123
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
124
+
125
+ // src/models/products.ts
118
126
  var ProductPublicIdSchema = zod.z.union([
119
127
  zod.z.string().regex(/^[1-9]\d*$/),
120
128
  zod.z.number().int().safe().positive()
@@ -173,7 +181,7 @@ var ProductsParamsSchema = zod.z.object({
173
181
  page: zod.z.number().int().positive().default(1),
174
182
  pageSize: zod.z.number().int().positive().max(100).default(24),
175
183
  sort: ProductSortSchema.optional(),
176
- sellerId: zod.z.string().uuid().optional(),
184
+ sellerId: OptionalEntityIdSchema,
177
185
  search: zod.z.string().optional(),
178
186
  collection: zod.z.string().optional(),
179
187
  collections: zod.z.array(zod.z.string()).optional(),
@@ -187,18 +195,18 @@ var ProductsParamsSchema = zod.z.object({
187
195
  tag: zod.z.string().optional(),
188
196
  tags: zod.z.array(zod.z.string()).optional(),
189
197
  filters: zod.z.array(zod.z.string()).optional(),
190
- locationId: zod.z.string().uuid().optional(),
198
+ locationId: OptionalEntityIdSchema,
191
199
  inStock: zod.z.boolean().optional(),
192
200
  minPrice: zod.z.number().nonnegative().optional(),
193
201
  maxPrice: zod.z.number().nonnegative().optional()
194
202
  });
195
203
  var ProductDetailParamsSchema = zod.z.object({
196
- sellerId: zod.z.string().uuid().optional()
204
+ sellerId: OptionalEntityIdSchema
197
205
  });
198
206
  var RelatedProductsParamsSchema = zod.z.object({
199
207
  productId: ProductPublicIdSchema,
200
208
  limit: zod.z.number().int().positive().max(12).default(8),
201
- sellerId: zod.z.string().uuid().optional()
209
+ sellerId: OptionalEntityIdSchema
202
210
  });
203
211
  var SpecItemSchema = zod.z.object({
204
212
  key: zod.z.string(),
@@ -302,7 +310,6 @@ var JsonElementSchema = zod.z.lazy(
302
310
  );
303
311
  var DateTimeOffsetSchema = zod.z.string().datetime({ offset: true });
304
312
  var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
305
- var NullableUuidSchema = zod.z.string().uuid().nullable();
306
313
  var StoreTypeSchema = zod.z.enum([
307
314
  "b2C",
308
315
  "marketplace",
@@ -365,9 +372,9 @@ var StoreCheckoutSettingsSchema = zod.z.object({
365
372
  ordersAndPayments: StoreCheckoutOrdersAndPaymentsSettingsSchema
366
373
  }).strict();
367
374
  var StorefrontStoreShape = {
368
- id: zod.z.string().uuid(),
369
- tenantId: zod.z.string().uuid(),
370
- sellerId: NullableUuidSchema,
375
+ id: EntityIdSchema,
376
+ tenantId: EntityIdSchema,
377
+ sellerId: NullableEntityIdSchema,
371
378
  type: StoreTypeSchema,
372
379
  isActive: zod.z.boolean(),
373
380
  name: zod.z.string(),
@@ -448,13 +455,13 @@ var CmsMenuDtoSchema = zod.z.object({
448
455
  items: zod.z.array(CmsMenuItemSchema)
449
456
  }).strict();
450
457
  var CmsBlockDtoSchema = zod.z.object({
451
- id: zod.z.string().uuid(),
458
+ id: EntityIdSchema,
452
459
  type: zod.z.string(),
453
460
  order: zod.z.number().int(),
454
461
  settings: JsonElementSchema
455
462
  }).strict();
456
463
  var CmsSectionDtoSchema = zod.z.object({
457
- id: zod.z.string().uuid(),
464
+ id: EntityIdSchema,
458
465
  type: zod.z.string(),
459
466
  order: zod.z.number().int(),
460
467
  settings: JsonElementSchema,
@@ -463,7 +470,7 @@ var CmsSectionDtoSchema = zod.z.object({
463
470
  var CmsContentChannelSchema = zod.z.enum(["storefront", "pos"]);
464
471
  var CmsPageStatusSchema = zod.z.enum(["draft", "published", "archived"]);
465
472
  var CmsPageDetailsDtoSchema = zod.z.object({
466
- id: zod.z.string().uuid(),
473
+ id: EntityIdSchema,
467
474
  name: zod.z.string(),
468
475
  slug: zod.z.string(),
469
476
  channel: CmsContentChannelSchema,
@@ -474,11 +481,11 @@ var CmsPageDetailsDtoSchema = zod.z.object({
474
481
  status: CmsPageStatusSchema,
475
482
  hasPublishedVersion: zod.z.boolean(),
476
483
  publishedOn: NullableDateTimeOffsetSchema,
477
- publishedBy: NullableUuidSchema,
484
+ publishedBy: NullableEntityIdSchema,
478
485
  createdOn: DateTimeOffsetSchema,
479
486
  updatedOn: NullableDateTimeOffsetSchema,
480
- createdBy: NullableUuidSchema,
481
- updatedBy: NullableUuidSchema,
487
+ createdBy: NullableEntityIdSchema,
488
+ updatedBy: NullableEntityIdSchema,
482
489
  lastModifiedBy: zod.z.string().nullable()
483
490
  }).strict();
484
491
  var CmsSnapshotDtoSchema = zod.z.object({
@@ -570,7 +577,7 @@ async function getRelatedProducts(api, params) {
570
577
  var ProductAutocompleteParamsSchema = zod.z.object({
571
578
  search: zod.z.string().min(2).max(80),
572
579
  limit: zod.z.number().int().positive().max(20).default(8),
573
- sellerId: zod.z.string().uuid().optional()
580
+ sellerId: OptionalEntityIdSchema
574
581
  });
575
582
  var ProductSuggestionSchema = zod.z.object({
576
583
  id: ProductPublicIdSchema,
@@ -684,7 +691,7 @@ var StorefrontCartBundleItemSchema = zod.z.object({
684
691
  quantity: zod.z.number().int().positive()
685
692
  });
686
693
  var StorefrontCartItemSchema = zod.z.object({
687
- id: zod.z.string().uuid(),
694
+ id: EntityIdSchema,
688
695
  productId: zod.z.number().int().safe().nonnegative(),
689
696
  title: zod.z.string(),
690
697
  variantLabel: zod.z.string().nullable(),
@@ -698,20 +705,20 @@ var StorefrontCartItemSchema = zod.z.object({
698
705
  bundleItems: zod.z.array(StorefrontCartBundleItemSchema)
699
706
  });
700
707
  var StorefrontCartShippingMethodSchema = zod.z.object({
701
- id: zod.z.string().uuid(),
702
- shippingMethodId: zod.z.string().uuid().nullable(),
703
- rateId: zod.z.string().uuid().nullable(),
708
+ id: EntityIdSchema,
709
+ shippingMethodId: NullableEntityIdSchema,
710
+ rateId: NullableEntityIdSchema,
704
711
  name: zod.z.string(),
705
712
  description: zod.z.string().nullable(),
706
713
  total: zod.z.number(),
707
- locationId: zod.z.string().uuid().nullable(),
714
+ locationId: NullableEntityIdSchema,
708
715
  estimatedDays: zod.z.number().int().nullable(),
709
- pickupPointId: zod.z.string().uuid().nullable(),
716
+ pickupPointId: NullableEntityIdSchema,
710
717
  scheduledDate: zod.z.string().nullable(),
711
718
  scheduledTime: zod.z.string().nullable(),
712
719
  serviceCode: zod.z.string().nullable(),
713
- sellerId: zod.z.string().uuid().nullable(),
714
- shippingProfileId: zod.z.string().uuid().nullable()
720
+ sellerId: NullableEntityIdSchema,
721
+ shippingProfileId: NullableEntityIdSchema
715
722
  });
716
723
  var StorefrontCartTotalsSchema = zod.z.object({
717
724
  subtotal: zod.z.number(),
@@ -732,7 +739,7 @@ var StorefrontCartStatusSchema = zod.z.enum([
732
739
  "failed"
733
740
  ]);
734
741
  var StorefrontCartSchema = zod.z.object({
735
- id: zod.z.string().uuid(),
742
+ id: EntityIdSchema,
736
743
  cartNumber: zod.z.string(),
737
744
  email: zod.z.string().nullable(),
738
745
  phone: zod.z.string().nullable(),
@@ -754,26 +761,26 @@ var CreateCartParamsSchema = zod.z.object({
754
761
  email: zod.z.string().email().optional()
755
762
  });
756
763
  var GetCartParamsSchema = zod.z.object({
757
- cartId: zod.z.string().uuid()
764
+ cartId: EntityIdSchema
758
765
  });
759
766
  var CartItemModifierSchema = zod.z.object({
760
767
  modifierGroupId: zod.z.number().int().safe().positive(),
761
768
  optionIds: zod.z.array(zod.z.number().int().safe().positive()).min(1)
762
769
  });
763
770
  var AddCartItemParamsSchema = zod.z.object({
764
- cartId: zod.z.string().uuid(),
771
+ cartId: EntityIdSchema,
765
772
  variantId: zod.z.number().int().safe().positive(),
766
773
  quantity: zod.z.number().int().positive(),
767
774
  modifiers: zod.z.array(CartItemModifierSchema).optional()
768
775
  });
769
776
  var UpdateCartItemQuantityParamsSchema = zod.z.object({
770
- cartId: zod.z.string().uuid(),
771
- cartItemId: zod.z.string().uuid(),
777
+ cartId: EntityIdSchema,
778
+ cartItemId: EntityIdSchema,
772
779
  quantity: zod.z.number().int().nonnegative()
773
780
  });
774
781
  var RemoveCartItemParamsSchema = zod.z.object({
775
- cartId: zod.z.string().uuid(),
776
- cartItemId: zod.z.string().uuid()
782
+ cartId: EntityIdSchema,
783
+ cartItemId: EntityIdSchema
777
784
  });
778
785
 
779
786
  // src/services/cart.service.ts
@@ -839,7 +846,7 @@ async function getPageBySlug(api, pageSlug) {
839
846
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
840
847
  }
841
848
  var CartBuyerParamsSchema = zod.z.object({
842
- cartId: zod.z.string().uuid(),
849
+ cartId: EntityIdSchema,
843
850
  email: zod.z.string().email(),
844
851
  firstName: zod.z.string().min(1),
845
852
  lastName: zod.z.string().min(1),
@@ -865,7 +872,7 @@ var CartAddressWriteSchema = zod.z.object({
865
872
  }).nullable().optional()
866
873
  });
867
874
  var CartAddressesParamsSchema = zod.z.object({
868
- cartId: zod.z.string().uuid(),
875
+ cartId: EntityIdSchema,
869
876
  shippingAddress: CartAddressWriteSchema,
870
877
  billingAddress: CartAddressWriteSchema
871
878
  });
@@ -898,7 +905,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
898
905
  description: zod.z.string().nullable().optional()
899
906
  });
900
907
  var CartCheckoutReadParamsSchema = zod.z.object({
901
- cartId: zod.z.string().uuid()
908
+ cartId: EntityIdSchema
902
909
  });
903
910
  var CartCheckoutReadResponseSchema = zod.z.object({
904
911
  cart: StorefrontCartSchema,
@@ -945,7 +952,7 @@ var CartCheckoutResponseSchema = zod.z.object({
945
952
  cart: StorefrontCartSchema.optional()
946
953
  }).passthrough();
947
954
  var CartCheckoutParamsSchema = zod.z.object({
948
- cartId: zod.z.string().uuid(),
955
+ cartId: EntityIdSchema,
949
956
  paymentMethodCode: zod.z.string().min(1),
950
957
  externalRef: zod.z.string().min(1),
951
958
  receiptUrl: zod.z.string().min(1).optional()
@@ -978,11 +985,11 @@ var ShippingOptionsResponseSchema = zod.z.object({
978
985
  groups: zod.z.array(ShippingOptionGroupSchema)
979
986
  });
980
987
  var GetShippingOptionsParamsSchema = zod.z.object({
981
- cartId: zod.z.string().uuid(),
988
+ cartId: EntityIdSchema,
982
989
  postalCode: zod.z.string().min(1)
983
990
  });
984
991
  var PutShippingMethodParamsSchema = zod.z.object({
985
- cartId: zod.z.string().uuid(),
992
+ cartId: EntityIdSchema,
986
993
  rateId: zod.z.string().min(1),
987
994
  shippingMethodId: zod.z.string().min(1),
988
995
  serviceCode: zod.z.string().nullable().optional(),
@@ -998,7 +1005,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
998
1005
  url: zod.z.string()
999
1006
  });
1000
1007
  var CartPromotionCodeParamsSchema = zod.z.object({
1001
- cartId: zod.z.string().uuid(),
1008
+ cartId: EntityIdSchema,
1002
1009
  code: zod.z.string().min(1)
1003
1010
  });
1004
1011
 
@@ -1094,12 +1101,12 @@ var CountrySchema = zod.z.object({
1094
1101
  var CountriesSchema = zod.z.array(CountrySchema);
1095
1102
  var GeoDivisionTypeSchema = zod.z.enum(["level1", "level2", "level3"]);
1096
1103
  var GeoDivisionSchema = zod.z.object({
1097
- id: zod.z.string().uuid(),
1104
+ id: EntityIdSchema,
1098
1105
  countryCode: zod.z.string().length(2),
1099
1106
  type: GeoDivisionTypeSchema,
1100
1107
  code: zod.z.string().min(1),
1101
1108
  name: zod.z.string().min(1),
1102
- parentId: zod.z.string().uuid().nullable(),
1109
+ parentId: NullableEntityIdSchema,
1103
1110
  source: zod.z.string().min(1)
1104
1111
  }).strict();
1105
1112
  var DepartmentSchema = GeoDivisionSchema;