@zyacreatives/shared 2.2.90 → 2.2.91

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.
@@ -112,15 +112,12 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
112
112
  agreesToTerms: z.ZodOptional<z.ZodLiteral<true>>;
113
113
  id: z.ZodCUID2;
114
114
  }, 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
115
  export declare const ProductEntitySchema: z.ZodObject<{
122
116
  id: z.ZodCUID2;
123
- userId: z.ZodCUID2;
117
+ sellerId: z.ZodCUID2;
118
+ sellerUsername: z.ZodString;
119
+ sellerName: z.ZodString;
120
+ sellerImageUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
124
121
  title: z.ZodString;
125
122
  description: z.ZodString;
126
123
  keyFeatures: z.ZodString;
@@ -158,8 +155,6 @@ export declare const ProductEntitySchema: z.ZodObject<{
158
155
  additionalServices: z.ZodDefault<z.ZodArray<z.ZodObject<{
159
156
  title: z.ZodString;
160
157
  price: z.ZodNumber;
161
- id: z.ZodCUID2;
162
- productId: z.ZodCUID2;
163
158
  }, z.core.$strip>>>;
164
159
  createdAt: z.ZodCoercedDate<unknown>;
165
160
  updatedAt: z.ZodCoercedDate<unknown>;
@@ -169,7 +164,6 @@ export type ProductCoverImageEntity = z.infer<typeof ProductCoverImageEntitySche
169
164
  export type ProductDeliveryFileEntity = z.infer<typeof ProductDeliveryFileEntitySchema>;
170
165
  export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
171
166
  export type ProductAdditionalService = z.infer<typeof ProductAdditionalServiceSchema>;
172
- export type ProductAdditionalServiceEntity = z.infer<typeof ProductAdditionalServiceEntitySchema>;
173
167
  export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
174
168
  export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServiceAndComplianceInputSchema>;
175
169
  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.ProductAdditionalServiceSchema = 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()
@@ -29,7 +28,6 @@ exports.ProductAdditionalServiceSchema = zod_openapi_1.z.object({
29
28
  title: zod_openapi_1.z.string().min(1, "Service title is required"),
30
29
  price: zod_openapi_1.z.number().int("Price must be in cents").min(0),
31
30
  });
32
- // --- Base Core Schema (Reusable shape) ---
33
31
  const ProductCoreInputSchema = zod_openapi_1.z.object({
34
32
  title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
35
33
  description: zod_openapi_1.z.string().min(1, "Description is required"),
@@ -51,7 +49,6 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
51
49
  suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
52
50
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
53
51
  });
54
- // --- 1. Create Product Input (Step 1 - Strict) ---
55
52
  exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx) => {
56
53
  if (data.pricingModel === constants_1.PRICING_MODELS.FIXED &&
57
54
  (!data.price || data.price <= 0)) {
@@ -97,7 +94,6 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
97
94
  });
98
95
  }
99
96
  });
100
- // --- 2. Service & Compliance Input (Step 2 - Strict) ---
101
97
  exports.ProductServiceAndComplianceInputSchema = zod_openapi_1.z.object({
102
98
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product" }),
103
99
  supportEmail: zod_openapi_1.z.email("A valid support email is required"),
@@ -113,14 +109,13 @@ exports.UpdateProductInputSchema = ProductCoreInputSchema.extend(exports.Product
113
109
  .extend({
114
110
  id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product being updated" }),
115
111
  });
116
- exports.ProductAdditionalServiceEntitySchema = exports.ProductAdditionalServiceSchema.extend({
117
- id: zod_openapi_1.z.cuid2(),
118
- productId: zod_openapi_1.z.cuid2(),
119
- });
120
112
  exports.ProductEntitySchema = zod_openapi_1.z
121
113
  .object({
122
114
  id: zod_openapi_1.z.cuid2(),
123
- userId: zod_openapi_1.z.cuid2().openapi({ description: "ID of the creator/seller" }),
115
+ sellerId: zod_openapi_1.z.cuid2().openapi({ description: "ID of the creator/seller" }),
116
+ sellerUsername: zod_openapi_1.z.string(),
117
+ sellerName: zod_openapi_1.z.string(),
118
+ sellerImageUrl: zod_openapi_1.z.string().url().optional().nullable(),
124
119
  title: zod_openapi_1.z.string(),
125
120
  description: zod_openapi_1.z.string(),
126
121
  keyFeatures: zod_openapi_1.z.string(),
@@ -137,9 +132,7 @@ exports.ProductEntitySchema = zod_openapi_1.z
137
132
  discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
138
133
  supportEmail: zod_openapi_1.z.email().optional().nullable(),
139
134
  supportPhone: zod_openapi_1.z.string().optional().nullable(),
140
- additionalServices: zod_openapi_1.z
141
- .array(exports.ProductAdditionalServiceEntitySchema)
142
- .default([]),
135
+ additionalServices: zod_openapi_1.z.array(exports.ProductAdditionalServiceSchema).default([]),
143
136
  createdAt: zod_openapi_1.z.coerce.date(),
144
137
  updatedAt: zod_openapi_1.z.coerce.date(),
145
138
  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.91",
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()
@@ -32,7 +30,6 @@ export const ProductAdditionalServiceSchema = z.object({
32
30
  price: z.number().int("Price must be in cents").min(0),
33
31
  });
34
32
 
35
- // --- Base Core Schema (Reusable shape) ---
36
33
  const ProductCoreInputSchema = z.object({
37
34
  title: z.string().min(1, "Title is required").max(255),
38
35
  description: z.string().min(1, "Description is required"),
@@ -61,7 +58,6 @@ const ProductCoreInputSchema = z.object({
61
58
  discounts: z.array(ProductDiscountEntitySchema).default([]),
62
59
  });
63
60
 
64
- // --- 1. Create Product Input (Step 1 - Strict) ---
65
61
  export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
66
62
  (data, ctx) => {
67
63
  if (
@@ -119,7 +115,6 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
119
115
  },
120
116
  );
121
117
 
122
- // --- 2. Service & Compliance Input (Step 2 - Strict) ---
123
118
  export const ProductServiceAndComplianceInputSchema = z.object({
124
119
  id: z.cuid2().openapi({ description: "ID of the product" }),
125
120
 
@@ -132,6 +127,7 @@ export const ProductServiceAndComplianceInputSchema = z.object({
132
127
  true,
133
128
  "You must confirm you own the rights to this product.",
134
129
  ),
130
+
135
131
  noHarmfulContent: z.literal(true, "You must confirm no harmful content."),
136
132
 
137
133
  providesSupport: z.boolean(),
@@ -146,16 +142,14 @@ export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
146
142
  id: z.cuid2().openapi({ description: "ID of the product being updated" }),
147
143
  });
148
144
 
149
- export const ProductAdditionalServiceEntitySchema =
150
- ProductAdditionalServiceSchema.extend({
151
- id: z.cuid2(),
152
- productId: z.cuid2(),
153
- });
154
-
155
145
  export const ProductEntitySchema = z
156
146
  .object({
157
147
  id: z.cuid2(),
158
- userId: z.cuid2().openapi({ description: "ID of the creator/seller" }),
148
+
149
+ sellerId: z.cuid2().openapi({ description: "ID of the creator/seller" }),
150
+ sellerUsername: z.string(),
151
+ sellerName: z.string(),
152
+ sellerImageUrl: z.string().url().optional().nullable(),
159
153
 
160
154
  title: z.string(),
161
155
  description: z.string(),
@@ -178,9 +172,7 @@ export const ProductEntitySchema = z
178
172
 
179
173
  supportEmail: z.email().optional().nullable(),
180
174
  supportPhone: z.string().optional().nullable(),
181
- additionalServices: z
182
- .array(ProductAdditionalServiceEntitySchema)
183
- .default([]),
175
+ additionalServices: z.array(ProductAdditionalServiceSchema).default([]),
184
176
 
185
177
  createdAt: z.coerce.date(),
186
178
  updatedAt: z.coerce.date(),
@@ -198,9 +190,6 @@ export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
198
190
  export type ProductAdditionalService = z.infer<
199
191
  typeof ProductAdditionalServiceSchema
200
192
  >;
201
- export type ProductAdditionalServiceEntity = z.infer<
202
- typeof ProductAdditionalServiceEntitySchema
203
- >;
204
193
 
205
194
  export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
206
195
  export type ProductServiceAndComplianceInputEntity = z.infer<