@zyacreatives/shared 2.2.97 → 2.2.99
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.
|
@@ -80,6 +80,7 @@ export declare const BaseProductSchema: z.ZodObject<{
|
|
|
80
80
|
}>;
|
|
81
81
|
amount: z.ZodNumber;
|
|
82
82
|
discountCode: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
83
|
+
expiry: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
|
|
83
84
|
}, z.core.$strip>>>;
|
|
84
85
|
supportEmail: z.ZodNullable<z.ZodString>;
|
|
85
86
|
supportPhone: z.ZodNullable<z.ZodString>;
|
package/dist/schemas/product.js
CHANGED
|
@@ -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()
|
|
@@ -64,12 +62,12 @@ exports.BaseProductSchema = zod_openapi_1.z.object({
|
|
|
64
62
|
discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
65
63
|
amount: zod_openapi_1.z.number(),
|
|
66
64
|
discountCode: zod_openapi_1.z.string().optional().nullable(),
|
|
65
|
+
expiry: zod_openapi_1.z.iso.datetime().optional().nullable(),
|
|
67
66
|
}))
|
|
68
67
|
.nullable(),
|
|
69
68
|
supportEmail: zod_openapi_1.z.string().nullable(),
|
|
70
69
|
supportPhone: zod_openapi_1.z.string().nullable(),
|
|
71
70
|
});
|
|
72
|
-
// --- Core Input Schema ---
|
|
73
71
|
const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
74
72
|
id: zod_openapi_1.z.cuid2().openapi({ description: "Client-generated ID for the product" }),
|
|
75
73
|
title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
|
|
@@ -82,14 +80,14 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
|
82
80
|
coverImages: zod_openapi_1.z
|
|
83
81
|
.array(exports.CoverImageInputSchema)
|
|
84
82
|
.min(1, "At least one cover image is required")
|
|
85
|
-
.max(
|
|
83
|
+
.max(5, "Maximum of 5 cover images allowed"),
|
|
86
84
|
currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
|
|
87
85
|
productFiles: zod_openapi_1.z.array(exports.DeliveryFileInputSchema).default([]),
|
|
88
86
|
productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
|
|
89
87
|
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS).default(constants_1.PRICING_MODELS.FIXED),
|
|
90
|
-
price: zod_openapi_1.z.number().int("Must be
|
|
88
|
+
price: zod_openapi_1.z.number().int("Must be a whole number").min(0).optional(),
|
|
91
89
|
suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
|
|
92
|
-
discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
|
|
90
|
+
discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).max(3).default([]),
|
|
93
91
|
});
|
|
94
92
|
exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx) => {
|
|
95
93
|
if (data.pricingModel === constants_1.PRICING_MODELS.FIXED &&
|
package/package.json
CHANGED
package/src/schemas/product.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
WAGES_CURRENCY,
|
|
7
7
|
} from "../constants";
|
|
8
8
|
|
|
9
|
-
// --- File Input Schemas ---
|
|
10
9
|
|
|
11
10
|
export const CoverImageInputSchema = z.object({
|
|
12
11
|
key: z.string().openapi({ description: "Storage key of the uploaded file" }),
|
|
@@ -21,7 +20,6 @@ export const DeliveryFileInputSchema = z.object({
|
|
|
21
20
|
order: z.number().int().default(0),
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
// --- Entity Schemas ---
|
|
25
23
|
|
|
26
24
|
export const ProductCoverImageEntitySchema = z.object({
|
|
27
25
|
fileId: z
|
|
@@ -80,6 +78,7 @@ export const BaseProductSchema = z.object({
|
|
|
80
78
|
discountType: z.enum(DISCOUNT_TYPES),
|
|
81
79
|
amount: z.number(),
|
|
82
80
|
discountCode: z.string().optional().nullable(),
|
|
81
|
+
expiry: z.iso.datetime().optional().nullable(),
|
|
83
82
|
}),
|
|
84
83
|
)
|
|
85
84
|
.nullable(),
|
|
@@ -87,7 +86,6 @@ export const BaseProductSchema = z.object({
|
|
|
87
86
|
supportPhone: z.string().nullable(),
|
|
88
87
|
});
|
|
89
88
|
|
|
90
|
-
// --- Core Input Schema ---
|
|
91
89
|
|
|
92
90
|
const ProductCoreInputSchema = z.object({
|
|
93
91
|
id: z.cuid2().openapi({ description: "Client-generated ID for the product" }),
|
|
@@ -103,7 +101,7 @@ const ProductCoreInputSchema = z.object({
|
|
|
103
101
|
coverImages: z
|
|
104
102
|
.array(CoverImageInputSchema)
|
|
105
103
|
.min(1, "At least one cover image is required")
|
|
106
|
-
.max(
|
|
104
|
+
.max(5, "Maximum of 5 cover images allowed"),
|
|
107
105
|
currency: z.enum(WAGES_CURRENCY),
|
|
108
106
|
productFiles: z.array(DeliveryFileInputSchema).default([]),
|
|
109
107
|
|
|
@@ -111,10 +109,10 @@ const ProductCoreInputSchema = z.object({
|
|
|
111
109
|
|
|
112
110
|
pricingModel: z.enum(PRICING_MODELS).default(PRICING_MODELS.FIXED),
|
|
113
111
|
|
|
114
|
-
price: z.number().int("Must be
|
|
112
|
+
price: z.number().int("Must be a whole number").min(0).optional(),
|
|
115
113
|
suggestedPrice: z.number().int("Must be in cents").min(0).optional(),
|
|
116
114
|
|
|
117
|
-
discounts: z.array(ProductDiscountEntitySchema).default([]),
|
|
115
|
+
discounts: z.array(ProductDiscountEntitySchema).max(3).default([]),
|
|
118
116
|
});
|
|
119
117
|
|
|
120
118
|
export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|