@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/index.cjs CHANGED
@@ -120,6 +120,14 @@ var CollectionSchema = zod.z.object({
120
120
  productCount: zod.z.number().optional()
121
121
  });
122
122
  var CollectionsSchema = zod.z.array(CollectionSchema);
123
+ var EntityIdSchema = zod.z.union([
124
+ zod.z.string().uuid(),
125
+ zod.z.string().regex(/^\d+$/, "Expected numeric id")
126
+ ]);
127
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
128
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
129
+
130
+ // src/models/products.ts
123
131
  var ProductPublicIdSchema = zod.z.union([
124
132
  zod.z.string().regex(/^[1-9]\d*$/),
125
133
  zod.z.number().int().safe().positive()
@@ -180,7 +188,7 @@ var ProductsParamsSchema = zod.z.object({
180
188
  page: zod.z.number().int().positive().default(1),
181
189
  pageSize: zod.z.number().int().positive().max(100).default(24),
182
190
  sort: ProductSortSchema.optional(),
183
- sellerId: zod.z.string().uuid().optional(),
191
+ sellerId: OptionalEntityIdSchema,
184
192
  search: zod.z.string().optional(),
185
193
  collection: zod.z.string().optional(),
186
194
  collections: zod.z.array(zod.z.string()).optional(),
@@ -194,18 +202,18 @@ var ProductsParamsSchema = zod.z.object({
194
202
  tag: zod.z.string().optional(),
195
203
  tags: zod.z.array(zod.z.string()).optional(),
196
204
  filters: zod.z.array(zod.z.string()).optional(),
197
- locationId: zod.z.string().uuid().optional(),
205
+ locationId: OptionalEntityIdSchema,
198
206
  inStock: zod.z.boolean().optional(),
199
207
  minPrice: zod.z.number().nonnegative().optional(),
200
208
  maxPrice: zod.z.number().nonnegative().optional()
201
209
  });
202
210
  var ProductDetailParamsSchema = zod.z.object({
203
- sellerId: zod.z.string().uuid().optional()
211
+ sellerId: OptionalEntityIdSchema
204
212
  });
205
213
  var RelatedProductsParamsSchema = zod.z.object({
206
214
  productId: ProductPublicIdSchema,
207
215
  limit: zod.z.number().int().positive().max(12).default(8),
208
- sellerId: zod.z.string().uuid().optional()
216
+ sellerId: OptionalEntityIdSchema
209
217
  });
210
218
  var SpecItemSchema = zod.z.object({
211
219
  key: zod.z.string(),
@@ -312,7 +320,6 @@ var JsonElementSchema = zod.z.lazy(
312
320
  );
313
321
  var DateTimeOffsetSchema = zod.z.string().datetime({ offset: true });
314
322
  var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
315
- var NullableUuidSchema = zod.z.string().uuid().nullable();
316
323
  var StoreTypeSchema = zod.z.enum([
317
324
  "b2C",
318
325
  "marketplace",
@@ -375,9 +382,9 @@ var StoreCheckoutSettingsSchema = zod.z.object({
375
382
  ordersAndPayments: StoreCheckoutOrdersAndPaymentsSettingsSchema
376
383
  }).strict();
377
384
  var StorefrontStoreShape = {
378
- id: zod.z.string().uuid(),
379
- tenantId: zod.z.string().uuid(),
380
- sellerId: NullableUuidSchema,
385
+ id: EntityIdSchema,
386
+ tenantId: EntityIdSchema,
387
+ sellerId: NullableEntityIdSchema,
381
388
  type: StoreTypeSchema,
382
389
  isActive: zod.z.boolean(),
383
390
  name: zod.z.string(),
@@ -458,13 +465,13 @@ var CmsMenuDtoSchema = zod.z.object({
458
465
  items: zod.z.array(CmsMenuItemSchema)
459
466
  }).strict();
460
467
  var CmsBlockDtoSchema = zod.z.object({
461
- id: zod.z.string().uuid(),
468
+ id: EntityIdSchema,
462
469
  type: zod.z.string(),
463
470
  order: zod.z.number().int(),
464
471
  settings: JsonElementSchema
465
472
  }).strict();
466
473
  var CmsSectionDtoSchema = zod.z.object({
467
- id: zod.z.string().uuid(),
474
+ id: EntityIdSchema,
468
475
  type: zod.z.string(),
469
476
  order: zod.z.number().int(),
470
477
  settings: JsonElementSchema,
@@ -473,7 +480,7 @@ var CmsSectionDtoSchema = zod.z.object({
473
480
  var CmsContentChannelSchema = zod.z.enum(["storefront", "pos"]);
474
481
  var CmsPageStatusSchema = zod.z.enum(["draft", "published", "archived"]);
475
482
  var CmsPageDetailsDtoSchema = zod.z.object({
476
- id: zod.z.string().uuid(),
483
+ id: EntityIdSchema,
477
484
  name: zod.z.string(),
478
485
  slug: zod.z.string(),
479
486
  channel: CmsContentChannelSchema,
@@ -484,11 +491,11 @@ var CmsPageDetailsDtoSchema = zod.z.object({
484
491
  status: CmsPageStatusSchema,
485
492
  hasPublishedVersion: zod.z.boolean(),
486
493
  publishedOn: NullableDateTimeOffsetSchema,
487
- publishedBy: NullableUuidSchema,
494
+ publishedBy: NullableEntityIdSchema,
488
495
  createdOn: DateTimeOffsetSchema,
489
496
  updatedOn: NullableDateTimeOffsetSchema,
490
- createdBy: NullableUuidSchema,
491
- updatedBy: NullableUuidSchema,
497
+ createdBy: NullableEntityIdSchema,
498
+ updatedBy: NullableEntityIdSchema,
492
499
  lastModifiedBy: zod.z.string().nullable()
493
500
  }).strict();
494
501
  var CmsSnapshotDtoSchema = zod.z.object({
@@ -599,7 +606,7 @@ async function getRelatedProducts(api, params) {
599
606
  var ProductAutocompleteParamsSchema = zod.z.object({
600
607
  search: zod.z.string().min(2).max(80),
601
608
  limit: zod.z.number().int().positive().max(20).default(8),
602
- sellerId: zod.z.string().uuid().optional()
609
+ sellerId: OptionalEntityIdSchema
603
610
  });
604
611
  var ProductSuggestionSchema = zod.z.object({
605
612
  id: ProductPublicIdSchema,
@@ -723,7 +730,7 @@ var StorefrontCartBundleItemSchema = zod.z.object({
723
730
  quantity: zod.z.number().int().positive()
724
731
  });
725
732
  var StorefrontCartItemSchema = zod.z.object({
726
- id: zod.z.string().uuid(),
733
+ id: EntityIdSchema,
727
734
  productId: zod.z.number().int().safe().nonnegative(),
728
735
  title: zod.z.string(),
729
736
  variantLabel: zod.z.string().nullable(),
@@ -737,20 +744,20 @@ var StorefrontCartItemSchema = zod.z.object({
737
744
  bundleItems: zod.z.array(StorefrontCartBundleItemSchema)
738
745
  });
739
746
  var StorefrontCartShippingMethodSchema = zod.z.object({
740
- id: zod.z.string().uuid(),
741
- shippingMethodId: zod.z.string().uuid().nullable(),
742
- rateId: zod.z.string().uuid().nullable(),
747
+ id: EntityIdSchema,
748
+ shippingMethodId: NullableEntityIdSchema,
749
+ rateId: NullableEntityIdSchema,
743
750
  name: zod.z.string(),
744
751
  description: zod.z.string().nullable(),
745
752
  total: zod.z.number(),
746
- locationId: zod.z.string().uuid().nullable(),
753
+ locationId: NullableEntityIdSchema,
747
754
  estimatedDays: zod.z.number().int().nullable(),
748
- pickupPointId: zod.z.string().uuid().nullable(),
755
+ pickupPointId: NullableEntityIdSchema,
749
756
  scheduledDate: zod.z.string().nullable(),
750
757
  scheduledTime: zod.z.string().nullable(),
751
758
  serviceCode: zod.z.string().nullable(),
752
- sellerId: zod.z.string().uuid().nullable(),
753
- shippingProfileId: zod.z.string().uuid().nullable()
759
+ sellerId: NullableEntityIdSchema,
760
+ shippingProfileId: NullableEntityIdSchema
754
761
  });
755
762
  var StorefrontCartTotalsSchema = zod.z.object({
756
763
  subtotal: zod.z.number(),
@@ -771,7 +778,7 @@ var StorefrontCartStatusSchema = zod.z.enum([
771
778
  "failed"
772
779
  ]);
773
780
  var StorefrontCartSchema = zod.z.object({
774
- id: zod.z.string().uuid(),
781
+ id: EntityIdSchema,
775
782
  cartNumber: zod.z.string(),
776
783
  email: zod.z.string().nullable(),
777
784
  phone: zod.z.string().nullable(),
@@ -793,26 +800,26 @@ var CreateCartParamsSchema = zod.z.object({
793
800
  email: zod.z.string().email().optional()
794
801
  });
795
802
  var GetCartParamsSchema = zod.z.object({
796
- cartId: zod.z.string().uuid()
803
+ cartId: EntityIdSchema
797
804
  });
798
805
  var CartItemModifierSchema = zod.z.object({
799
806
  modifierGroupId: zod.z.number().int().safe().positive(),
800
807
  optionIds: zod.z.array(zod.z.number().int().safe().positive()).min(1)
801
808
  });
802
809
  var AddCartItemParamsSchema = zod.z.object({
803
- cartId: zod.z.string().uuid(),
810
+ cartId: EntityIdSchema,
804
811
  variantId: zod.z.number().int().safe().positive(),
805
812
  quantity: zod.z.number().int().positive(),
806
813
  modifiers: zod.z.array(CartItemModifierSchema).optional()
807
814
  });
808
815
  var UpdateCartItemQuantityParamsSchema = zod.z.object({
809
- cartId: zod.z.string().uuid(),
810
- cartItemId: zod.z.string().uuid(),
816
+ cartId: EntityIdSchema,
817
+ cartItemId: EntityIdSchema,
811
818
  quantity: zod.z.number().int().nonnegative()
812
819
  });
813
820
  var RemoveCartItemParamsSchema = zod.z.object({
814
- cartId: zod.z.string().uuid(),
815
- cartItemId: zod.z.string().uuid()
821
+ cartId: EntityIdSchema,
822
+ cartItemId: EntityIdSchema
816
823
  });
817
824
 
818
825
  // src/services/cart.service.ts
@@ -878,7 +885,7 @@ async function getPageBySlug(api, pageSlug) {
878
885
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
879
886
  }
880
887
  var CartBuyerParamsSchema = zod.z.object({
881
- cartId: zod.z.string().uuid(),
888
+ cartId: EntityIdSchema,
882
889
  email: zod.z.string().email(),
883
890
  firstName: zod.z.string().min(1),
884
891
  lastName: zod.z.string().min(1),
@@ -904,7 +911,7 @@ var CartAddressWriteSchema = zod.z.object({
904
911
  }).nullable().optional()
905
912
  });
906
913
  var CartAddressesParamsSchema = zod.z.object({
907
- cartId: zod.z.string().uuid(),
914
+ cartId: EntityIdSchema,
908
915
  shippingAddress: CartAddressWriteSchema,
909
916
  billingAddress: CartAddressWriteSchema
910
917
  });
@@ -937,7 +944,7 @@ var StorefrontOrderBumpSchema = zod.z.object({
937
944
  description: zod.z.string().nullable().optional()
938
945
  });
939
946
  var CartCheckoutReadParamsSchema = zod.z.object({
940
- cartId: zod.z.string().uuid()
947
+ cartId: EntityIdSchema
941
948
  });
942
949
  var CartCheckoutReadResponseSchema = zod.z.object({
943
950
  cart: StorefrontCartSchema,
@@ -984,7 +991,7 @@ var CartCheckoutResponseSchema = zod.z.object({
984
991
  cart: StorefrontCartSchema.optional()
985
992
  }).passthrough();
986
993
  var CartCheckoutParamsSchema = zod.z.object({
987
- cartId: zod.z.string().uuid(),
994
+ cartId: EntityIdSchema,
988
995
  paymentMethodCode: zod.z.string().min(1),
989
996
  externalRef: zod.z.string().min(1),
990
997
  receiptUrl: zod.z.string().min(1).optional()
@@ -1017,11 +1024,11 @@ var ShippingOptionsResponseSchema = zod.z.object({
1017
1024
  groups: zod.z.array(ShippingOptionGroupSchema)
1018
1025
  });
1019
1026
  var GetShippingOptionsParamsSchema = zod.z.object({
1020
- cartId: zod.z.string().uuid(),
1027
+ cartId: EntityIdSchema,
1021
1028
  postalCode: zod.z.string().min(1)
1022
1029
  });
1023
1030
  var PutShippingMethodParamsSchema = zod.z.object({
1024
- cartId: zod.z.string().uuid(),
1031
+ cartId: EntityIdSchema,
1025
1032
  rateId: zod.z.string().min(1),
1026
1033
  shippingMethodId: zod.z.string().min(1),
1027
1034
  serviceCode: zod.z.string().nullable().optional(),
@@ -1037,7 +1044,7 @@ var CartPaymentReceiptResponseSchema = zod.z.object({
1037
1044
  url: zod.z.string()
1038
1045
  });
1039
1046
  var CartPromotionCodeParamsSchema = zod.z.object({
1040
- cartId: zod.z.string().uuid(),
1047
+ cartId: EntityIdSchema,
1041
1048
  code: zod.z.string().min(1)
1042
1049
  });
1043
1050
 
@@ -1133,12 +1140,12 @@ var CountrySchema = zod.z.object({
1133
1140
  var CountriesSchema = zod.z.array(CountrySchema);
1134
1141
  var GeoDivisionTypeSchema = zod.z.enum(["level1", "level2", "level3"]);
1135
1142
  var GeoDivisionSchema = zod.z.object({
1136
- id: zod.z.string().uuid(),
1143
+ id: EntityIdSchema,
1137
1144
  countryCode: zod.z.string().length(2),
1138
1145
  type: GeoDivisionTypeSchema,
1139
1146
  code: zod.z.string().min(1),
1140
1147
  name: zod.z.string().min(1),
1141
- parentId: zod.z.string().uuid().nullable(),
1148
+ parentId: NullableEntityIdSchema,
1142
1149
  source: zod.z.string().min(1)
1143
1150
  }).strict();
1144
1151
  var DepartmentSchema = GeoDivisionSchema;
@@ -1952,6 +1959,7 @@ exports.DepartmentSchema = DepartmentSchema;
1952
1959
  exports.DepartmentsSchema = DepartmentsSchema;
1953
1960
  exports.DistrictSchema = DistrictSchema;
1954
1961
  exports.DistrictsSchema = DistrictsSchema;
1962
+ exports.EntityIdSchema = EntityIdSchema;
1955
1963
  exports.FacetItemSchema = FacetItemSchema;
1956
1964
  exports.FacetSchema = FacetSchema;
1957
1965
  exports.GeoDivisionSchema = GeoDivisionSchema;
@@ -1963,6 +1971,8 @@ exports.GetProvincesParamsSchema = GetProvincesParamsSchema;
1963
1971
  exports.GetShippingOptionsParamsSchema = GetShippingOptionsParamsSchema;
1964
1972
  exports.JsonElementSchema = JsonElementSchema;
1965
1973
  exports.ListProductReviewsParamsSchema = ListProductReviewsParamsSchema;
1974
+ exports.NullableEntityIdSchema = NullableEntityIdSchema;
1975
+ exports.OptionalEntityIdSchema = OptionalEntityIdSchema;
1966
1976
  exports.PriceTierSchema = PriceTierSchema;
1967
1977
  exports.ProductAutocompleteParamsSchema = ProductAutocompleteParamsSchema;
1968
1978
  exports.ProductDetailParamsSchema = ProductDetailParamsSchema;