@zyacreatives/shared 2.2.91 → 2.2.93
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/schemas/post.js +1 -3
- package/dist/schemas/product.d.ts +31 -15
- package/dist/schemas/product.js +27 -6
- package/package.json +1 -1
- package/src/schemas/post.ts +7 -6
- package/src/schemas/product.ts +35 -10
package/dist/schemas/post.js
CHANGED
|
@@ -89,9 +89,7 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
|
|
|
89
89
|
});
|
|
90
90
|
exports.PostFileEntitySchema = zod_openapi_1.z
|
|
91
91
|
.object({
|
|
92
|
-
id: zod_openapi_1.z
|
|
93
|
-
.cuid2()
|
|
94
|
-
.openapi({
|
|
92
|
+
id: zod_openapi_1.z.cuid2().openapi({
|
|
95
93
|
description: "CUID2 of the project file record.",
|
|
96
94
|
example: "cxy1a2b3c0000qwe",
|
|
97
95
|
}),
|
|
@@ -16,9 +16,37 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
|
|
|
16
16
|
amount: z.ZodNumber;
|
|
17
17
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const BaseProductSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodCUID2;
|
|
21
|
+
createdAt: z.ZodDate;
|
|
22
|
+
updatedAt: z.ZodDate;
|
|
23
|
+
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
24
|
+
sellerId: z.ZodCUID2;
|
|
20
25
|
title: z.ZodString;
|
|
21
|
-
|
|
26
|
+
description: z.ZodString;
|
|
27
|
+
keyFeatures: z.ZodString;
|
|
28
|
+
category: z.ZodString;
|
|
29
|
+
subcategory: z.ZodNullable<z.ZodString>;
|
|
30
|
+
tags: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
31
|
+
productLinks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
32
|
+
pricingModel: z.ZodEnum<{
|
|
33
|
+
readonly FREE: "Free";
|
|
34
|
+
readonly FIXED: "Fixed";
|
|
35
|
+
readonly PWYW: "Pay What You Want";
|
|
36
|
+
}>;
|
|
37
|
+
currency: z.ZodString;
|
|
38
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
39
|
+
suggestedPrice: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
discounts: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
41
|
+
discountType: z.ZodEnum<{
|
|
42
|
+
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
43
|
+
readonly PERCENTAGE: "Percentage";
|
|
44
|
+
}>;
|
|
45
|
+
amount: z.ZodNumber;
|
|
46
|
+
discountCode: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
supportEmail: z.ZodNullable<z.ZodString>;
|
|
49
|
+
supportPhone: z.ZodNullable<z.ZodString>;
|
|
22
50
|
}, z.core.$strip>;
|
|
23
51
|
export declare const CreateProductInputSchema: z.ZodObject<{
|
|
24
52
|
title: z.ZodString;
|
|
@@ -58,10 +86,6 @@ export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
|
|
|
58
86
|
id: z.ZodCUID2;
|
|
59
87
|
supportEmail: z.ZodEmail;
|
|
60
88
|
supportPhone: z.ZodOptional<z.ZodString>;
|
|
61
|
-
additionalServices: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
62
|
-
title: z.ZodString;
|
|
63
|
-
price: z.ZodNumber;
|
|
64
|
-
}, z.core.$strip>>>;
|
|
65
89
|
ownsRights: z.ZodLiteral<true>;
|
|
66
90
|
noHarmfulContent: z.ZodLiteral<true>;
|
|
67
91
|
providesSupport: z.ZodBoolean;
|
|
@@ -102,10 +126,6 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
|
|
|
102
126
|
}, z.core.$strip>>>>;
|
|
103
127
|
supportEmail: z.ZodOptional<z.ZodEmail>;
|
|
104
128
|
supportPhone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
105
|
-
additionalServices: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
106
|
-
title: z.ZodString;
|
|
107
|
-
price: z.ZodNumber;
|
|
108
|
-
}, z.core.$strip>>>>;
|
|
109
129
|
ownsRights: z.ZodOptional<z.ZodLiteral<true>>;
|
|
110
130
|
noHarmfulContent: z.ZodOptional<z.ZodLiteral<true>>;
|
|
111
131
|
providesSupport: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -152,10 +172,6 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
152
172
|
}, z.core.$strip>>>;
|
|
153
173
|
supportEmail: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
|
|
154
174
|
supportPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
155
|
-
additionalServices: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
156
|
-
title: z.ZodString;
|
|
157
|
-
price: z.ZodNumber;
|
|
158
|
-
}, z.core.$strip>>>;
|
|
159
175
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
160
176
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
161
177
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -163,8 +179,8 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
163
179
|
export type ProductCoverImageEntity = z.infer<typeof ProductCoverImageEntitySchema>;
|
|
164
180
|
export type ProductDeliveryFileEntity = z.infer<typeof ProductDeliveryFileEntitySchema>;
|
|
165
181
|
export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
|
|
166
|
-
export type ProductAdditionalService = z.infer<typeof ProductAdditionalServiceSchema>;
|
|
167
182
|
export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
168
183
|
export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServiceAndComplianceInputSchema>;
|
|
169
184
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
170
185
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
186
|
+
export type BaseProductEntity = z.infer<typeof BaseProductSchema>;
|
package/dist/schemas/product.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.
|
|
3
|
+
exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.BaseProductSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
exports.ProductCoverImageEntitySchema = zod_openapi_1.z.object({
|
|
@@ -24,9 +24,32 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
|
|
|
24
24
|
.min(0, "Discount amount cannot be negative"),
|
|
25
25
|
discountCode: zod_openapi_1.z.string().optional(),
|
|
26
26
|
});
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
exports.BaseProductSchema = zod_openapi_1.z.object({
|
|
28
|
+
id: zod_openapi_1.z.cuid2(),
|
|
29
|
+
createdAt: zod_openapi_1.z.date(),
|
|
30
|
+
updatedAt: zod_openapi_1.z.date(),
|
|
31
|
+
deletedAt: zod_openapi_1.z.date().nullable(),
|
|
32
|
+
sellerId: zod_openapi_1.z.cuid2(),
|
|
33
|
+
title: zod_openapi_1.z.string(),
|
|
34
|
+
description: zod_openapi_1.z.string(),
|
|
35
|
+
keyFeatures: zod_openapi_1.z.string(),
|
|
36
|
+
category: zod_openapi_1.z.string(),
|
|
37
|
+
subcategory: zod_openapi_1.z.string().nullable(),
|
|
38
|
+
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
|
|
39
|
+
productLinks: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
|
|
40
|
+
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
|
|
41
|
+
currency: zod_openapi_1.z.string(),
|
|
42
|
+
price: zod_openapi_1.z.number().nullable(),
|
|
43
|
+
suggestedPrice: zod_openapi_1.z.number().nullable(),
|
|
44
|
+
discounts: zod_openapi_1.z
|
|
45
|
+
.array(zod_openapi_1.z.object({
|
|
46
|
+
discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
47
|
+
amount: zod_openapi_1.z.number(),
|
|
48
|
+
discountCode: zod_openapi_1.z.string().optional().nullable(),
|
|
49
|
+
}))
|
|
50
|
+
.nullable(),
|
|
51
|
+
supportEmail: zod_openapi_1.z.string().nullable(),
|
|
52
|
+
supportPhone: zod_openapi_1.z.string().nullable(),
|
|
30
53
|
});
|
|
31
54
|
const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
32
55
|
title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
|
|
@@ -98,7 +121,6 @@ exports.ProductServiceAndComplianceInputSchema = zod_openapi_1.z.object({
|
|
|
98
121
|
id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product" }),
|
|
99
122
|
supportEmail: zod_openapi_1.z.email("A valid support email is required"),
|
|
100
123
|
supportPhone: zod_openapi_1.z.string().optional(),
|
|
101
|
-
additionalServices: zod_openapi_1.z.array(exports.ProductAdditionalServiceSchema).default([]),
|
|
102
124
|
ownsRights: zod_openapi_1.z.literal(true, "You must confirm you own the rights to this product."),
|
|
103
125
|
noHarmfulContent: zod_openapi_1.z.literal(true, "You must confirm no harmful content."),
|
|
104
126
|
providesSupport: zod_openapi_1.z.boolean(),
|
|
@@ -132,7 +154,6 @@ exports.ProductEntitySchema = zod_openapi_1.z
|
|
|
132
154
|
discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
|
|
133
155
|
supportEmail: zod_openapi_1.z.email().optional().nullable(),
|
|
134
156
|
supportPhone: zod_openapi_1.z.string().optional().nullable(),
|
|
135
|
-
additionalServices: zod_openapi_1.z.array(exports.ProductAdditionalServiceSchema).default([]),
|
|
136
157
|
createdAt: zod_openapi_1.z.coerce.date(),
|
|
137
158
|
updatedAt: zod_openapi_1.z.coerce.date(),
|
|
138
159
|
deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
|
package/package.json
CHANGED
package/src/schemas/post.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ACTIVITY_PARENT_TYPES,
|
|
4
4
|
POST_BADGE_TYPES,
|
|
5
5
|
POST_TYPES,
|
|
6
|
+
|
|
6
7
|
} from "../constants";
|
|
7
8
|
import { CreateFileInputSchema } from "./file";
|
|
8
9
|
import { CommentEntitySchema } from "./comment";
|
|
@@ -10,6 +11,8 @@ import { EntityStatsSchema } from "./entity-stats";
|
|
|
10
11
|
import { ActivitySchema } from "./activity";
|
|
11
12
|
import { cleanHtml } from "../utils/clean-html";
|
|
12
13
|
|
|
14
|
+
|
|
15
|
+
|
|
13
16
|
export const PostEntitySchema = z.object({
|
|
14
17
|
id: z
|
|
15
18
|
.cuid2()
|
|
@@ -98,12 +101,10 @@ export const PostEntitySchema = z.object({
|
|
|
98
101
|
|
|
99
102
|
export const PostFileEntitySchema = z
|
|
100
103
|
.object({
|
|
101
|
-
id: z
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
example: "cxy1a2b3c0000qwe",
|
|
106
|
-
}),
|
|
104
|
+
id: z.cuid2().openapi({
|
|
105
|
+
description: "CUID2 of the project file record.",
|
|
106
|
+
example: "cxy1a2b3c0000qwe",
|
|
107
|
+
}),
|
|
107
108
|
postId: z.cuid2().openapi({
|
|
108
109
|
description: "CUID2 of the post this file belongs to.",
|
|
109
110
|
example: "ckj1a2b3c0000xyz",
|
package/src/schemas/product.ts
CHANGED
|
@@ -25,9 +25,39 @@ export const ProductDiscountEntitySchema = z.object({
|
|
|
25
25
|
discountCode: z.string().optional(),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
export const BaseProductSchema = z.object({
|
|
29
|
+
id: z.cuid2(),
|
|
30
|
+
createdAt: z.date(),
|
|
31
|
+
updatedAt: z.date(),
|
|
32
|
+
deletedAt: z.date().nullable(),
|
|
33
|
+
|
|
34
|
+
sellerId: z.cuid2(),
|
|
35
|
+
|
|
36
|
+
title: z.string(),
|
|
37
|
+
description: z.string(),
|
|
38
|
+
keyFeatures: z.string(),
|
|
39
|
+
|
|
40
|
+
category: z.string(),
|
|
41
|
+
subcategory: z.string().nullable(),
|
|
42
|
+
tags: z.array(z.string()).nullable(),
|
|
43
|
+
|
|
44
|
+
productLinks: z.array(z.string()).nullable(),
|
|
45
|
+
pricingModel: z.enum(PRICING_MODELS),
|
|
46
|
+
currency: z.string(),
|
|
47
|
+
price: z.number().nullable(),
|
|
48
|
+
suggestedPrice: z.number().nullable(),
|
|
49
|
+
|
|
50
|
+
discounts: z
|
|
51
|
+
.array(
|
|
52
|
+
z.object({
|
|
53
|
+
discountType: z.enum(DISCOUNT_TYPES),
|
|
54
|
+
amount: z.number(),
|
|
55
|
+
discountCode: z.string().optional().nullable(),
|
|
56
|
+
}),
|
|
57
|
+
)
|
|
58
|
+
.nullable(),
|
|
59
|
+
supportEmail: z.string().nullable(),
|
|
60
|
+
supportPhone: z.string().nullable(),
|
|
31
61
|
});
|
|
32
62
|
|
|
33
63
|
const ProductCoreInputSchema = z.object({
|
|
@@ -121,8 +151,6 @@ export const ProductServiceAndComplianceInputSchema = z.object({
|
|
|
121
151
|
supportEmail: z.email("A valid support email is required"),
|
|
122
152
|
supportPhone: z.string().optional(),
|
|
123
153
|
|
|
124
|
-
additionalServices: z.array(ProductAdditionalServiceSchema).default([]),
|
|
125
|
-
|
|
126
154
|
ownsRights: z.literal(
|
|
127
155
|
true,
|
|
128
156
|
"You must confirm you own the rights to this product.",
|
|
@@ -172,8 +200,6 @@ export const ProductEntitySchema = z
|
|
|
172
200
|
|
|
173
201
|
supportEmail: z.email().optional().nullable(),
|
|
174
202
|
supportPhone: z.string().optional().nullable(),
|
|
175
|
-
additionalServices: z.array(ProductAdditionalServiceSchema).default([]),
|
|
176
|
-
|
|
177
203
|
createdAt: z.coerce.date(),
|
|
178
204
|
updatedAt: z.coerce.date(),
|
|
179
205
|
deletedAt: z.coerce.date().optional().nullable(),
|
|
@@ -187,9 +213,6 @@ export type ProductDeliveryFileEntity = z.infer<
|
|
|
187
213
|
typeof ProductDeliveryFileEntitySchema
|
|
188
214
|
>;
|
|
189
215
|
export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
|
|
190
|
-
export type ProductAdditionalService = z.infer<
|
|
191
|
-
typeof ProductAdditionalServiceSchema
|
|
192
|
-
>;
|
|
193
216
|
|
|
194
217
|
export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
195
218
|
export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
@@ -197,3 +220,5 @@ export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
|
197
220
|
>;
|
|
198
221
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
199
222
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
223
|
+
|
|
224
|
+
export type BaseProductEntity = z.infer<typeof BaseProductSchema>;
|