@zyacreatives/shared 2.5.6 → 2.5.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.
@@ -6,7 +6,7 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
6
6
  }>;
7
7
  amount: z.ZodNumber;
8
8
  discountCode: z.ZodOptional<z.ZodString>;
9
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
9
+ active: z.ZodDefault<z.ZodBoolean>;
10
10
  }, z.core.$strip>;
11
11
  export declare const ProductLinkSchema: z.ZodObject<{
12
12
  title: z.ZodNullable<z.ZodString>;
@@ -75,7 +75,7 @@ export declare const CreateProductInputSchema: z.ZodObject<{
75
75
  }>;
76
76
  amount: z.ZodNumber;
77
77
  discountCode: z.ZodOptional<z.ZodString>;
78
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
78
+ active: z.ZodDefault<z.ZodBoolean>;
79
79
  }, z.core.$strip>>>;
80
80
  }, z.core.$strip>;
81
81
  export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
@@ -149,7 +149,7 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
149
149
  }>;
150
150
  amount: z.ZodNumber;
151
151
  discountCode: z.ZodOptional<z.ZodString>;
152
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
152
+ active: z.ZodDefault<z.ZodBoolean>;
153
153
  }, z.core.$strip>>>>;
154
154
  supportEmail: z.ZodOptional<z.ZodEmail>;
155
155
  supportPhone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
@@ -231,7 +231,7 @@ export declare const ProductEntitySchema: z.ZodObject<{
231
231
  }>;
232
232
  amount: z.ZodNumber;
233
233
  discountCode: z.ZodOptional<z.ZodString>;
234
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
234
+ active: z.ZodDefault<z.ZodBoolean>;
235
235
  }, z.core.$strip>>>;
236
236
  ownsRights: z.ZodBoolean;
237
237
  noHarmfulContent: z.ZodBoolean;
@@ -11,13 +11,12 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
11
11
  .int("Amount must be a whole number")
12
12
  .min(0, "Discount amount cannot be negative"),
13
13
  discountCode: zod_openapi_1.z.string().optional(),
14
- expiry: zod_openapi_1.z.coerce.date().optional().nullable(),
14
+ active: zod_openapi_1.z.boolean().default(true),
15
15
  });
16
16
  exports.ProductLinkSchema = zod_openapi_1.z.object({
17
17
  title: zod_openapi_1.z.string().nullable(),
18
18
  url: zod_openapi_1.z.string(),
19
19
  });
20
- // --- 3. Input Validation Schemas ---
21
20
  const ProductCoreInputSchema = zod_openapi_1.z.object({
22
21
  id: zod_openapi_1.z.cuid2().openapi({ description: "Client-generated ID for the product" }),
23
22
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
@@ -36,7 +35,6 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
36
35
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).max(3).default([]),
37
36
  });
38
37
  exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx) => {
39
- // Pricing Validation
40
38
  if (data.pricingModel === constants_1.PRICING_MODELS.FIXED &&
41
39
  (!data.price || data.price <= 0)) {
42
40
  ctx.addIssue({
@@ -64,7 +62,6 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
64
62
  path: ["price"],
65
63
  });
66
64
  }
67
- // File Validation based on parentType
68
65
  const deliveryFiles = data.files.filter((f) => f.parentType === "PRODUCT_DELIVERY");
69
66
  const coverImages = data.files.filter((f) => f.parentType === "PRODUCT_COVER");
70
67
  if (deliveryFiles.length === 0 && data.productLinks.length === 0) {
@@ -126,7 +123,6 @@ exports.UpdateProductInputSchema = ProductCoreInputSchema.extend(exports.Product
126
123
  .extend({
127
124
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product being updated" }),
128
125
  });
129
- // --- 4. Entity & Output Schemas ---
130
126
  exports.ProductEntitySchema = zod_openapi_1.z
131
127
  .object({
132
128
  id: zod_openapi_1.z.cuid2(),
@@ -141,7 +137,6 @@ exports.ProductEntitySchema = zod_openapi_1.z
141
137
  category: zod_openapi_1.z.string(),
142
138
  subcategory: zod_openapi_1.z.string().optional().nullable(),
143
139
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()),
144
- // Unified files array for output
145
140
  files: zod_openapi_1.z.array(file_1.FileEntitySchema).default([]),
146
141
  productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
147
142
  pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
@@ -761,7 +761,7 @@ export declare const UserWithProductsEntitySchema: z.ZodObject<{
761
761
  }>;
762
762
  amount: z.ZodNumber;
763
763
  discountCode: z.ZodOptional<z.ZodString>;
764
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
764
+ active: z.ZodDefault<z.ZodBoolean>;
765
765
  }, z.core.$strip>>>;
766
766
  ownsRights: z.ZodBoolean;
767
767
  noHarmfulContent: z.ZodBoolean;
@@ -934,7 +934,7 @@ export declare const GetUserWithProductsOutputSchema: z.ZodObject<{
934
934
  }>;
935
935
  amount: z.ZodNumber;
936
936
  discountCode: z.ZodOptional<z.ZodString>;
937
- expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
937
+ active: z.ZodDefault<z.ZodBoolean>;
938
938
  }, z.core.$strip>>>;
939
939
  ownsRights: z.ZodBoolean;
940
940
  noHarmfulContent: z.ZodBoolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@ export const ProductDiscountEntitySchema = z.object({
15
15
  .int("Amount must be a whole number")
16
16
  .min(0, "Discount amount cannot be negative"),
17
17
  discountCode: z.string().optional(),
18
- expiry: z.coerce.date().optional().nullable(),
18
+ active: z.boolean().default(true),
19
19
  });
20
20
 
21
21
  export const ProductLinkSchema = z.object({
@@ -23,8 +23,6 @@ export const ProductLinkSchema = z.object({
23
23
  url: z.string(),
24
24
  });
25
25
 
26
- // --- 3. Input Validation Schemas ---
27
-
28
26
  const ProductCoreInputSchema = z.object({
29
27
  id: z.cuid2().openapi({ description: "Client-generated ID for the product" }),
30
28
 
@@ -47,7 +45,7 @@ const ProductCoreInputSchema = z.object({
47
45
 
48
46
  export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
49
47
  (data, ctx) => {
50
- // Pricing Validation
48
+
51
49
  if (
52
50
  data.pricingModel === PRICING_MODELS.FIXED &&
53
51
  (!data.price || data.price <= 0)
@@ -84,7 +82,6 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
84
82
  });
85
83
  }
86
84
 
87
- // File Validation based on parentType
88
85
  const deliveryFiles = data.files.filter(
89
86
  (f) => f.parentType === "PRODUCT_DELIVERY",
90
87
  );
@@ -168,7 +165,6 @@ export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
168
165
  id: z.cuid2().openapi({ description: "ID of the product being updated" }),
169
166
  });
170
167
 
171
- // --- 4. Entity & Output Schemas ---
172
168
 
173
169
  export const ProductEntitySchema = z
174
170
  .object({
@@ -186,7 +182,6 @@ export const ProductEntitySchema = z
186
182
  subcategory: z.string().optional().nullable(),
187
183
  tags: z.array(z.string()),
188
184
 
189
- // Unified files array for output
190
185
  files: z.array(FileEntitySchema).default([]),
191
186
  productLinks: z.array(ProductLinkSchema).default([]),
192
187