@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/client.js CHANGED
@@ -103,8 +103,16 @@ function createApi(options = {}) {
103
103
  postForm: (path, body, schema, opts) => request("POST", path, schema, { ...opts, body })
104
104
  };
105
105
  }
106
+ var EntityIdSchema = z.union([
107
+ z.string().uuid(),
108
+ z.string().regex(/^\d+$/, "Expected numeric id")
109
+ ]);
110
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
111
+ var OptionalEntityIdSchema = EntityIdSchema.optional();
112
+
113
+ // src/models/collections.ts
106
114
  var CollectionSchema = z.object({
107
- id: z.number(),
115
+ id: EntityIdSchema,
108
116
  slug: z.string(),
109
117
  name: z.string(),
110
118
  description: z.string().nullable().optional(),
@@ -113,14 +121,6 @@ var CollectionSchema = z.object({
113
121
  productCount: z.number().optional()
114
122
  });
115
123
  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
124
124
  var ProductPublicIdSchema = z.union([
125
125
  z.string().regex(/^[1-9]\d*$/),
126
126
  z.number().int().safe().positive()
@@ -843,6 +843,16 @@ async function getCollectionBySlug(api, collectionSlug) {
843
843
  async function getPageBySlug(api, pageSlug) {
844
844
  return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
845
845
  }
846
+ var CheckoutMetadataValueSchema = z.lazy(
847
+ () => z.union([
848
+ z.string(),
849
+ z.number(),
850
+ z.boolean(),
851
+ z.null(),
852
+ z.array(CheckoutMetadataValueSchema),
853
+ z.record(z.string(), CheckoutMetadataValueSchema)
854
+ ])
855
+ );
846
856
  var CartBuyerParamsSchema = z.object({
847
857
  cartId: EntityIdSchema,
848
858
  email: z.string().email(),
@@ -919,13 +929,13 @@ var CartCheckoutPaymentActionSchema = z.object({
919
929
  phoneNumber: z.string().nullable().optional(),
920
930
  accountHolder: z.string().nullable().optional(),
921
931
  qrImageUrl: z.string().nullable().optional()
922
- }).passthrough().nullable().optional(),
932
+ }).strip().nullable().optional(),
923
933
  url: z.string().nullable().optional(),
924
934
  html: z.string().nullable().optional(),
925
935
  clientSecret: z.string().nullable().optional(),
926
936
  qrCode: z.string().nullable().optional(),
927
937
  expiresAt: z.string().nullable().optional()
928
- }).passthrough();
938
+ }).strip();
929
939
  var CartCheckoutPaymentSchema = z.object({
930
940
  transactionId: z.string(),
931
941
  paymentMethodCode: z.string(),
@@ -936,7 +946,7 @@ var CartCheckoutPaymentSchema = z.object({
936
946
  actionType: z.string(),
937
947
  receiptUrl: z.string().nullable().optional(),
938
948
  action: CartCheckoutPaymentActionSchema.nullable().optional()
939
- }).passthrough();
949
+ }).strip();
940
950
  var CartCheckoutResponseSchema = z.object({
941
951
  publicKey: z.string().optional(),
942
952
  publishableKey: z.string().optional(),
@@ -948,7 +958,7 @@ var CartCheckoutResponseSchema = z.object({
948
958
  orderIds: z.array(z.coerce.string()).optional(),
949
959
  payment: CartCheckoutPaymentSchema.optional(),
950
960
  cart: StorefrontCartSchema.optional()
951
- }).passthrough();
961
+ }).strip();
952
962
  var CartCheckoutParamsSchema = z.object({
953
963
  cartId: EntityIdSchema,
954
964
  paymentMethodCode: z.string().min(1),
@@ -969,8 +979,8 @@ var ShippingRateSchema = z.object({
969
979
  deliveryLocationName: z.string().nullable().optional(),
970
980
  estimatedDeliveryDays: z.number().nullable().optional(),
971
981
  serviceCode: z.string().nullable().optional(),
972
- metadata: z.record(z.string(), z.unknown()).optional()
973
- }).passthrough();
982
+ metadata: z.record(z.string(), CheckoutMetadataValueSchema).optional()
983
+ }).strip();
974
984
  var ShippingOptionGroupSchema = z.object({
975
985
  sellerId: z.string(),
976
986
  shippingProfileId: z.string().nullable().optional(),
@@ -978,7 +988,7 @@ var ShippingOptionGroupSchema = z.object({
978
988
  totalWeight: z.number().optional(),
979
989
  itemIds: z.array(z.string()).optional(),
980
990
  rates: z.array(ShippingRateSchema)
981
- }).passthrough();
991
+ }).strip();
982
992
  var ShippingOptionsResponseSchema = z.object({
983
993
  groups: z.array(ShippingOptionGroupSchema)
984
994
  });