@ecomiq/core 0.1.7 → 0.1.8

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/dist/index.cjs CHANGED
@@ -110,8 +110,16 @@ function createApi(options = {}) {
110
110
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
111
111
  };
112
112
  }
113
+ var EntityIdSchema = zod.z.union([
114
+ zod.z.string().uuid(),
115
+ zod.z.string().regex(/^\d+$/, "Expected numeric id")
116
+ ]);
117
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
118
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
119
+
120
+ // src/models/collections.ts
113
121
  var CollectionSchema = zod.z.object({
114
- id: zod.z.number(),
122
+ id: EntityIdSchema,
115
123
  slug: zod.z.string(),
116
124
  name: zod.z.string(),
117
125
  description: zod.z.string().nullable().optional(),
@@ -120,14 +128,6 @@ var CollectionSchema = zod.z.object({
120
128
  productCount: zod.z.number().optional()
121
129
  });
122
130
  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
131
131
  var ProductPublicIdSchema = zod.z.union([
132
132
  zod.z.string().regex(/^[1-9]\d*$/),
133
133
  zod.z.number().int().safe().positive()
@@ -884,6 +884,16 @@ async function getCollectionBySlug(api, collectionSlug) {
884
884
  async function getPageBySlug(api, pageSlug) {
885
885
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
886
886
  }
887
+ var CheckoutMetadataValueSchema = zod.z.lazy(
888
+ () => zod.z.union([
889
+ zod.z.string(),
890
+ zod.z.number(),
891
+ zod.z.boolean(),
892
+ zod.z.null(),
893
+ zod.z.array(CheckoutMetadataValueSchema),
894
+ zod.z.record(zod.z.string(), CheckoutMetadataValueSchema)
895
+ ])
896
+ );
887
897
  var CartBuyerParamsSchema = zod.z.object({
888
898
  cartId: EntityIdSchema,
889
899
  email: zod.z.string().email(),
@@ -960,13 +970,13 @@ var CartCheckoutPaymentActionSchema = zod.z.object({
960
970
  phoneNumber: zod.z.string().nullable().optional(),
961
971
  accountHolder: zod.z.string().nullable().optional(),
962
972
  qrImageUrl: zod.z.string().nullable().optional()
963
- }).passthrough().nullable().optional(),
973
+ }).strip().nullable().optional(),
964
974
  url: zod.z.string().nullable().optional(),
965
975
  html: zod.z.string().nullable().optional(),
966
976
  clientSecret: zod.z.string().nullable().optional(),
967
977
  qrCode: zod.z.string().nullable().optional(),
968
978
  expiresAt: zod.z.string().nullable().optional()
969
- }).passthrough();
979
+ }).strip();
970
980
  var CartCheckoutPaymentSchema = zod.z.object({
971
981
  transactionId: zod.z.string(),
972
982
  paymentMethodCode: zod.z.string(),
@@ -977,7 +987,7 @@ var CartCheckoutPaymentSchema = zod.z.object({
977
987
  actionType: zod.z.string(),
978
988
  receiptUrl: zod.z.string().nullable().optional(),
979
989
  action: CartCheckoutPaymentActionSchema.nullable().optional()
980
- }).passthrough();
990
+ }).strip();
981
991
  var CartCheckoutResponseSchema = zod.z.object({
982
992
  publicKey: zod.z.string().optional(),
983
993
  publishableKey: zod.z.string().optional(),
@@ -989,7 +999,7 @@ var CartCheckoutResponseSchema = zod.z.object({
989
999
  orderIds: zod.z.array(zod.z.coerce.string()).optional(),
990
1000
  payment: CartCheckoutPaymentSchema.optional(),
991
1001
  cart: StorefrontCartSchema.optional()
992
- }).passthrough();
1002
+ }).strip();
993
1003
  var CartCheckoutParamsSchema = zod.z.object({
994
1004
  cartId: EntityIdSchema,
995
1005
  paymentMethodCode: zod.z.string().min(1),
@@ -1010,8 +1020,8 @@ var ShippingRateSchema = zod.z.object({
1010
1020
  deliveryLocationName: zod.z.string().nullable().optional(),
1011
1021
  estimatedDeliveryDays: zod.z.number().nullable().optional(),
1012
1022
  serviceCode: zod.z.string().nullable().optional(),
1013
- metadata: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
1014
- }).passthrough();
1023
+ metadata: zod.z.record(zod.z.string(), CheckoutMetadataValueSchema).optional()
1024
+ }).strip();
1015
1025
  var ShippingOptionGroupSchema = zod.z.object({
1016
1026
  sellerId: zod.z.string(),
1017
1027
  shippingProfileId: zod.z.string().nullable().optional(),
@@ -1019,7 +1029,7 @@ var ShippingOptionGroupSchema = zod.z.object({
1019
1029
  totalWeight: zod.z.number().optional(),
1020
1030
  itemIds: zod.z.array(zod.z.string()).optional(),
1021
1031
  rates: zod.z.array(ShippingRateSchema)
1022
- }).passthrough();
1032
+ }).strip();
1023
1033
  var ShippingOptionsResponseSchema = zod.z.object({
1024
1034
  groups: zod.z.array(ShippingOptionGroupSchema)
1025
1035
  });
@@ -1917,6 +1927,7 @@ exports.CartItemModifierSchema = CartItemModifierSchema;
1917
1927
  exports.CartPaymentMethodSchema = CartPaymentMethodSchema;
1918
1928
  exports.CartPaymentReceiptResponseSchema = CartPaymentReceiptResponseSchema;
1919
1929
  exports.CartPromotionCodeParamsSchema = CartPromotionCodeParamsSchema;
1930
+ exports.CheckoutMetadataValueSchema = CheckoutMetadataValueSchema;
1920
1931
  exports.CmsBlockDtoSchema = CmsBlockDtoSchema;
1921
1932
  exports.CmsBrandingSettingsDtoSchema = CmsBrandingSettingsDtoSchema;
1922
1933
  exports.CmsContactSettingsDtoSchema = CmsContactSettingsDtoSchema;