@zyacreatives/shared 2.2.90 → 2.2.92

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.
@@ -16,10 +16,6 @@ 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 ProductAdditionalServiceSchema: z.ZodObject<{
20
- title: z.ZodString;
21
- price: z.ZodNumber;
22
- }, z.core.$strip>;
23
19
  export declare const CreateProductInputSchema: z.ZodObject<{
24
20
  title: z.ZodString;
25
21
  description: z.ZodString;
@@ -58,10 +54,6 @@ export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
58
54
  id: z.ZodCUID2;
59
55
  supportEmail: z.ZodEmail;
60
56
  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
57
  ownsRights: z.ZodLiteral<true>;
66
58
  noHarmfulContent: z.ZodLiteral<true>;
67
59
  providesSupport: z.ZodBoolean;
@@ -102,25 +94,18 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
102
94
  }, z.core.$strip>>>>;
103
95
  supportEmail: z.ZodOptional<z.ZodEmail>;
104
96
  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
97
  ownsRights: z.ZodOptional<z.ZodLiteral<true>>;
110
98
  noHarmfulContent: z.ZodOptional<z.ZodLiteral<true>>;
111
99
  providesSupport: z.ZodOptional<z.ZodBoolean>;
112
100
  agreesToTerms: z.ZodOptional<z.ZodLiteral<true>>;
113
101
  id: z.ZodCUID2;
114
102
  }, z.core.$strip>;
115
- export declare const ProductAdditionalServiceEntitySchema: z.ZodObject<{
116
- title: z.ZodString;
117
- price: z.ZodNumber;
118
- id: z.ZodCUID2;
119
- productId: z.ZodCUID2;
120
- }, z.core.$strip>;
121
103
  export declare const ProductEntitySchema: z.ZodObject<{
122
104
  id: z.ZodCUID2;
123
- userId: z.ZodCUID2;
105
+ sellerId: z.ZodCUID2;
106
+ sellerUsername: z.ZodString;
107
+ sellerName: z.ZodString;
108
+ sellerImageUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
124
109
  title: z.ZodString;
125
110
  description: z.ZodString;
126
111
  keyFeatures: z.ZodString;
@@ -155,12 +140,6 @@ export declare const ProductEntitySchema: z.ZodObject<{
155
140
  }, z.core.$strip>>>;
156
141
  supportEmail: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
157
142
  supportPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
158
- additionalServices: z.ZodDefault<z.ZodArray<z.ZodObject<{
159
- title: z.ZodString;
160
- price: z.ZodNumber;
161
- id: z.ZodCUID2;
162
- productId: z.ZodCUID2;
163
- }, z.core.$strip>>>;
164
143
  createdAt: z.ZodCoercedDate<unknown>;
165
144
  updatedAt: z.ZodCoercedDate<unknown>;
166
145
  deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
@@ -168,8 +147,6 @@ export declare const ProductEntitySchema: z.ZodObject<{
168
147
  export type ProductCoverImageEntity = z.infer<typeof ProductCoverImageEntitySchema>;
169
148
  export type ProductDeliveryFileEntity = z.infer<typeof ProductDeliveryFileEntitySchema>;
170
149
  export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
171
- export type ProductAdditionalService = z.infer<typeof ProductAdditionalServiceSchema>;
172
- export type ProductAdditionalServiceEntity = z.infer<typeof ProductAdditionalServiceEntitySchema>;
173
150
  export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
174
151
  export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServiceAndComplianceInputSchema>;
175
152
  export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProductEntitySchema = exports.ProductAdditionalServiceEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.ProductAdditionalServiceSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = void 0;
3
+ exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = 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
- // --- Sub-Entity Schemas ---
7
6
  exports.ProductCoverImageEntitySchema = zod_openapi_1.z.object({
8
7
  fileId: zod_openapi_1.z
9
8
  .cuid2()
@@ -25,11 +24,6 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
25
24
  .min(0, "Discount amount cannot be negative"),
26
25
  discountCode: zod_openapi_1.z.string().optional(),
27
26
  });
28
- exports.ProductAdditionalServiceSchema = zod_openapi_1.z.object({
29
- title: zod_openapi_1.z.string().min(1, "Service title is required"),
30
- price: zod_openapi_1.z.number().int("Price must be in cents").min(0),
31
- });
32
- // --- Base Core Schema (Reusable shape) ---
33
27
  const ProductCoreInputSchema = zod_openapi_1.z.object({
34
28
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
35
29
  description: zod_openapi_1.z.string().min(1, "Description is required"),
@@ -51,7 +45,6 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
51
45
  suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
52
46
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
53
47
  });
54
- // --- 1. Create Product Input (Step 1 - Strict) ---
55
48
  exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx) => {
56
49
  if (data.pricingModel === constants_1.PRICING_MODELS.FIXED &&
57
50
  (!data.price || data.price <= 0)) {
@@ -97,12 +90,10 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
97
90
  });
98
91
  }
99
92
  });
100
- // --- 2. Service & Compliance Input (Step 2 - Strict) ---
101
93
  exports.ProductServiceAndComplianceInputSchema = zod_openapi_1.z.object({
102
94
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product" }),
103
95
  supportEmail: zod_openapi_1.z.email("A valid support email is required"),
104
96
  supportPhone: zod_openapi_1.z.string().optional(),
105
- additionalServices: zod_openapi_1.z.array(exports.ProductAdditionalServiceSchema).default([]),
106
97
  ownsRights: zod_openapi_1.z.literal(true, "You must confirm you own the rights to this product."),
107
98
  noHarmfulContent: zod_openapi_1.z.literal(true, "You must confirm no harmful content."),
108
99
  providesSupport: zod_openapi_1.z.boolean(),
@@ -113,14 +104,13 @@ exports.UpdateProductInputSchema = ProductCoreInputSchema.extend(exports.Product
113
104
  .extend({
114
105
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product being updated" }),
115
106
  });
116
- exports.ProductAdditionalServiceEntitySchema = exports.ProductAdditionalServiceSchema.extend({
117
- id: zod_openapi_1.z.cuid2(),
118
- productId: zod_openapi_1.z.cuid2(),
119
- });
120
107
  exports.ProductEntitySchema = zod_openapi_1.z
121
108
  .object({
122
109
  id: zod_openapi_1.z.cuid2(),
123
- userId: zod_openapi_1.z.cuid2().openapi({ description: "ID of the creator/seller" }),
110
+ sellerId: zod_openapi_1.z.cuid2().openapi({ description: "ID of the creator/seller" }),
111
+ sellerUsername: zod_openapi_1.z.string(),
112
+ sellerName: zod_openapi_1.z.string(),
113
+ sellerImageUrl: zod_openapi_1.z.string().url().optional().nullable(),
124
114
  title: zod_openapi_1.z.string(),
125
115
  description: zod_openapi_1.z.string(),
126
116
  keyFeatures: zod_openapi_1.z.string(),
@@ -137,9 +127,6 @@ exports.ProductEntitySchema = zod_openapi_1.z
137
127
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
138
128
  supportEmail: zod_openapi_1.z.email().optional().nullable(),
139
129
  supportPhone: zod_openapi_1.z.string().optional().nullable(),
140
- additionalServices: zod_openapi_1.z
141
- .array(exports.ProductAdditionalServiceEntitySchema)
142
- .default([]),
143
130
  createdAt: zod_openapi_1.z.coerce.date(),
144
131
  updatedAt: zod_openapi_1.z.coerce.date(),
145
132
  deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.90",
3
+ "version": "2.2.92",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,8 +1,6 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import { DISCOUNT_TYPES, PRICING_MODELS } from "../constants";
3
3
 
4
- // --- Sub-Entity Schemas ---
5
-
6
4
  export const ProductCoverImageEntitySchema = z.object({
7
5
  fileId: z
8
6
  .cuid2()
@@ -27,12 +25,7 @@ export const ProductDiscountEntitySchema = z.object({
27
25
  discountCode: z.string().optional(),
28
26
  });
29
27
 
30
- export const ProductAdditionalServiceSchema = z.object({
31
- title: z.string().min(1, "Service title is required"),
32
- price: z.number().int("Price must be in cents").min(0),
33
- });
34
28
 
35
- // --- Base Core Schema (Reusable shape) ---
36
29
  const ProductCoreInputSchema = z.object({
37
30
  title: z.string().min(1, "Title is required").max(255),
38
31
  description: z.string().min(1, "Description is required"),
@@ -61,7 +54,6 @@ const ProductCoreInputSchema = z.object({
61
54
  discounts: z.array(ProductDiscountEntitySchema).default([]),
62
55
  });
63
56
 
64
- // --- 1. Create Product Input (Step 1 - Strict) ---
65
57
  export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
66
58
  (data, ctx) => {
67
59
  if (
@@ -119,19 +111,17 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
119
111
  },
120
112
  );
121
113
 
122
- // --- 2. Service & Compliance Input (Step 2 - Strict) ---
123
114
  export const ProductServiceAndComplianceInputSchema = z.object({
124
115
  id: z.cuid2().openapi({ description: "ID of the product" }),
125
116
 
126
117
  supportEmail: z.email("A valid support email is required"),
127
118
  supportPhone: z.string().optional(),
128
119
 
129
- additionalServices: z.array(ProductAdditionalServiceSchema).default([]),
130
-
131
120
  ownsRights: z.literal(
132
121
  true,
133
122
  "You must confirm you own the rights to this product.",
134
123
  ),
124
+
135
125
  noHarmfulContent: z.literal(true, "You must confirm no harmful content."),
136
126
 
137
127
  providesSupport: z.boolean(),
@@ -146,16 +136,14 @@ export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
146
136
  id: z.cuid2().openapi({ description: "ID of the product being updated" }),
147
137
  });
148
138
 
149
- export const ProductAdditionalServiceEntitySchema =
150
- ProductAdditionalServiceSchema.extend({
151
- id: z.cuid2(),
152
- productId: z.cuid2(),
153
- });
154
-
155
139
  export const ProductEntitySchema = z
156
140
  .object({
157
141
  id: z.cuid2(),
158
- userId: z.cuid2().openapi({ description: "ID of the creator/seller" }),
142
+
143
+ sellerId: z.cuid2().openapi({ description: "ID of the creator/seller" }),
144
+ sellerUsername: z.string(),
145
+ sellerName: z.string(),
146
+ sellerImageUrl: z.string().url().optional().nullable(),
159
147
 
160
148
  title: z.string(),
161
149
  description: z.string(),
@@ -178,10 +166,6 @@ export const ProductEntitySchema = z
178
166
 
179
167
  supportEmail: z.email().optional().nullable(),
180
168
  supportPhone: z.string().optional().nullable(),
181
- additionalServices: z
182
- .array(ProductAdditionalServiceEntitySchema)
183
- .default([]),
184
-
185
169
  createdAt: z.coerce.date(),
186
170
  updatedAt: z.coerce.date(),
187
171
  deletedAt: z.coerce.date().optional().nullable(),
@@ -195,12 +179,6 @@ export type ProductDeliveryFileEntity = z.infer<
195
179
  typeof ProductDeliveryFileEntitySchema
196
180
  >;
197
181
  export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
198
- export type ProductAdditionalService = z.infer<
199
- typeof ProductAdditionalServiceSchema
200
- >;
201
- export type ProductAdditionalServiceEntity = z.infer<
202
- typeof ProductAdditionalServiceEntitySchema
203
- >;
204
182
 
205
183
  export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
206
184
  export type ProductServiceAndComplianceInputEntity = z.infer<