@zyacreatives/shared 2.2.98 → 2.3.0

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.
@@ -26,6 +26,7 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
26
26
  }>;
27
27
  amount: z.ZodNumber;
28
28
  discountCode: z.ZodOptional<z.ZodString>;
29
+ expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
29
30
  }, z.core.$strip>;
30
31
  export declare const ProductLinkSchema: z.ZodObject<{
31
32
  title: z.ZodNullable<z.ZodString>;
@@ -80,7 +81,7 @@ export declare const BaseProductSchema: z.ZodObject<{
80
81
  }>;
81
82
  amount: z.ZodNumber;
82
83
  discountCode: z.ZodNullable<z.ZodOptional<z.ZodString>>;
83
- expiry: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
84
+ expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
84
85
  }, z.core.$strip>>>;
85
86
  supportEmail: z.ZodNullable<z.ZodString>;
86
87
  supportPhone: z.ZodNullable<z.ZodString>;
@@ -140,6 +141,7 @@ export declare const CreateProductInputSchema: z.ZodObject<{
140
141
  }>;
141
142
  amount: z.ZodNumber;
142
143
  discountCode: z.ZodOptional<z.ZodString>;
144
+ expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
143
145
  }, z.core.$strip>>>;
144
146
  }, z.core.$strip>;
145
147
  export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
@@ -205,6 +207,7 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
205
207
  }>;
206
208
  amount: z.ZodNumber;
207
209
  discountCode: z.ZodOptional<z.ZodString>;
210
+ expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
208
211
  }, z.core.$strip>>>>;
209
212
  supportEmail: z.ZodOptional<z.ZodEmail>;
210
213
  supportPhone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -268,6 +271,7 @@ export declare const ProductEntitySchema: z.ZodObject<{
268
271
  }>;
269
272
  amount: z.ZodNumber;
270
273
  discountCode: z.ZodOptional<z.ZodString>;
274
+ expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
271
275
  }, z.core.$strip>>>;
272
276
  supportEmail: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
273
277
  supportPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.BaseProductSchema = exports.ProductLinkSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = exports.DeliveryFileInputSchema = exports.CoverImageInputSchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
- // --- File Input Schemas ---
7
6
  exports.CoverImageInputSchema = zod_openapi_1.z.object({
8
7
  key: zod_openapi_1.z.string().openapi({ description: "Storage key of the uploaded file" }),
9
8
  mimeType: zod_openapi_1.z.string().openapi({ example: "image/jpeg" }),
@@ -15,7 +14,6 @@ exports.DeliveryFileInputSchema = zod_openapi_1.z.object({
15
14
  mimeType: zod_openapi_1.z.string().openapi({ example: "application/zip" }),
16
15
  order: zod_openapi_1.z.number().int().default(0),
17
16
  });
18
- // --- Entity Schemas ---
19
17
  exports.ProductCoverImageEntitySchema = zod_openapi_1.z.object({
20
18
  fileId: zod_openapi_1.z
21
19
  .cuid2()
@@ -36,6 +34,7 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
36
34
  .int("Amount must be a whole number")
37
35
  .min(0, "Discount amount cannot be negative"),
38
36
  discountCode: zod_openapi_1.z.string().optional(),
37
+ expiry: zod_openapi_1.z.coerce.date().optional().nullable(),
39
38
  });
40
39
  exports.ProductLinkSchema = zod_openapi_1.z.object({
41
40
  title: zod_openapi_1.z.string().nullable(),
@@ -64,13 +63,12 @@ exports.BaseProductSchema = zod_openapi_1.z.object({
64
63
  discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
65
64
  amount: zod_openapi_1.z.number(),
66
65
  discountCode: zod_openapi_1.z.string().optional().nullable(),
67
- expiry: zod_openapi_1.z.iso.datetime().optional().nullable(),
66
+ expiry: zod_openapi_1.z.coerce.date().optional().nullable(),
68
67
  }))
69
68
  .nullable(),
70
69
  supportEmail: zod_openapi_1.z.string().nullable(),
71
70
  supportPhone: zod_openapi_1.z.string().nullable(),
72
71
  });
73
- // --- Core Input Schema ---
74
72
  const ProductCoreInputSchema = zod_openapi_1.z.object({
75
73
  id: zod_openapi_1.z.cuid2().openapi({ description: "Client-generated ID for the product" }),
76
74
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
@@ -88,7 +86,7 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
88
86
  productFiles: zod_openapi_1.z.array(exports.DeliveryFileInputSchema).default([]),
89
87
  productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
90
88
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS).default(constants_1.PRICING_MODELS.FIXED),
91
- price: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
89
+ price: zod_openapi_1.z.number().int("Must be a whole number").min(0).optional(),
92
90
  suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
93
91
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).max(3).default([]),
94
92
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.98",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,8 +6,6 @@ import {
6
6
  WAGES_CURRENCY,
7
7
  } from "../constants";
8
8
 
9
- // --- File Input Schemas ---
10
-
11
9
  export const CoverImageInputSchema = z.object({
12
10
  key: z.string().openapi({ description: "Storage key of the uploaded file" }),
13
11
  mimeType: z.string().openapi({ example: "image/jpeg" }),
@@ -21,8 +19,6 @@ export const DeliveryFileInputSchema = z.object({
21
19
  order: z.number().int().default(0),
22
20
  });
23
21
 
24
- // --- Entity Schemas ---
25
-
26
22
  export const ProductCoverImageEntitySchema = z.object({
27
23
  fileId: z
28
24
  .cuid2()
@@ -45,6 +41,7 @@ export const ProductDiscountEntitySchema = z.object({
45
41
  .int("Amount must be a whole number")
46
42
  .min(0, "Discount amount cannot be negative"),
47
43
  discountCode: z.string().optional(),
44
+ expiry: z.coerce.date().optional().nullable(),
48
45
  });
49
46
 
50
47
  export const ProductLinkSchema = z.object({
@@ -73,14 +70,13 @@ export const BaseProductSchema = z.object({
73
70
  currency: z.enum(WAGES_CURRENCY),
74
71
  price: z.number().nullable(),
75
72
  suggestedPrice: z.number().nullable(),
76
-
77
73
  discounts: z
78
74
  .array(
79
75
  z.object({
80
76
  discountType: z.enum(DISCOUNT_TYPES),
81
77
  amount: z.number(),
82
78
  discountCode: z.string().optional().nullable(),
83
- expiry: z.iso.datetime().optional().nullable(),
79
+ expiry: z.coerce.date().optional().nullable(),
84
80
  }),
85
81
  )
86
82
  .nullable(),
@@ -88,8 +84,6 @@ export const BaseProductSchema = z.object({
88
84
  supportPhone: z.string().nullable(),
89
85
  });
90
86
 
91
- // --- Core Input Schema ---
92
-
93
87
  const ProductCoreInputSchema = z.object({
94
88
  id: z.cuid2().openapi({ description: "Client-generated ID for the product" }),
95
89
 
@@ -112,7 +106,7 @@ const ProductCoreInputSchema = z.object({
112
106
 
113
107
  pricingModel: z.enum(PRICING_MODELS).default(PRICING_MODELS.FIXED),
114
108
 
115
- price: z.number().int("Must be in cents").min(0).optional(),
109
+ price: z.number().int("Must be a whole number").min(0).optional(),
116
110
  suggestedPrice: z.number().int("Must be in cents").min(0).optional(),
117
111
 
118
112
  discounts: z.array(ProductDiscountEntitySchema).max(3).default([]),