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