@zyacreatives/shared 2.5.22 → 2.5.24

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.
@@ -184,7 +184,7 @@ export declare const UpdateProjectInputSchema: z.ZodObject<{
184
184
  title: z.ZodOptional<z.ZodString>;
185
185
  description: z.ZodOptional<z.ZodString>;
186
186
  overview: z.ZodOptional<z.ZodString>;
187
- url: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodLiteral<"">]>>;
187
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>>;
188
188
  imagePlaceholderUrl: z.ZodOptional<z.ZodURL>;
189
189
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
190
  projectCreatorType: z.ZodOptional<z.ZodEnum<{
@@ -193,7 +193,7 @@ export declare const UpdateProjectInputSchema: z.ZodObject<{
193
193
  readonly INVESTOR: "INVESTOR";
194
194
  readonly ADMIN: "ADMIN";
195
195
  }>>;
196
- clientId: z.ZodOptional<z.ZodCUID2>;
196
+ clientId: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>;
197
197
  clientType: z.ZodOptional<z.ZodEnum<{
198
198
  readonly CREATIVE: "CREATIVE";
199
199
  readonly BRAND: "BRAND";
@@ -548,13 +548,13 @@ export declare const ProjectSearchDocumentSchema: z.ZodObject<{
548
548
  export type ProjectSearchDocument = z.infer<typeof ProjectSearchDocumentSchema>;
549
549
  export declare const SearchProjectsInputSchema: z.ZodObject<{
550
550
  query: z.ZodOptional<z.ZodString>;
551
- limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
551
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
552
552
  cursor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
553
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
554
- isOpenToInvestment: z.ZodOptional<z.ZodBoolean>;
555
- minCapital: z.ZodOptional<z.ZodNumber>;
556
- maxCapital: z.ZodOptional<z.ZodNumber>;
557
- ventureStages: z.ZodOptional<z.ZodArray<z.ZodEnum<{
553
+ tags: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodString>>>;
554
+ isOpenToInvestment: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
555
+ minCapital: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
556
+ maxCapital: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
557
+ ventureStages: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodEnum<{
558
558
  readonly IDEA: "Idea";
559
559
  readonly PRE_SEED: "Pre Seed";
560
560
  readonly MVP: "MVP";
@@ -564,18 +564,18 @@ export declare const SearchProjectsInputSchema: z.ZodObject<{
564
564
  readonly SERIES_C: "Series C";
565
565
  readonly GROWTH: "Growth";
566
566
  readonly EXIT: "Exit";
567
- }>>>;
568
- projectCreatorTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
567
+ }>>>>;
568
+ projectCreatorTypes: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodEnum<{
569
569
  readonly CREATIVE: "CREATIVE";
570
570
  readonly BRAND: "BRAND";
571
571
  readonly INVESTOR: "INVESTOR";
572
572
  readonly ADMIN: "ADMIN";
573
- }>>>;
574
- clientTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
573
+ }>>>>;
574
+ clientTypes: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodEnum<{
575
575
  readonly CREATIVE: "CREATIVE";
576
576
  readonly BRAND: "BRAND";
577
577
  readonly NONE: "NONE";
578
- }>>>;
578
+ }>>>>;
579
579
  }, z.core.$strip>;
580
580
  export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
581
581
  export declare const SearchProjectsOutputSchema: z.ZodObject<{
@@ -72,23 +72,51 @@ exports.UpdateProjectInputSchema = zod_openapi_1.z
72
72
  .object({
73
73
  id: zod_openapi_1.z.cuid2(),
74
74
  title: zod_openapi_1.z.string().optional(),
75
- description: zod_openapi_1.z.string().optional(),
75
+ description: zod_openapi_1.z
76
+ .string()
77
+ .min(10, "Add a bit more detail to your description.")
78
+ .optional(),
76
79
  overview: zod_openapi_1.z.string().optional(),
77
- url: zod_openapi_1.z.url().or(zod_openapi_1.z.literal("")).optional(),
80
+ url: zod_openapi_1.z
81
+ .string()
82
+ .transform((val) => {
83
+ if (!val)
84
+ return val;
85
+ if (val.startsWith("http://") || val.startsWith("https://"))
86
+ return val;
87
+ return `https://${val}`;
88
+ })
89
+ .pipe(zod_openapi_1.z.string().url("Check your link.").or(zod_openapi_1.z.literal("")))
90
+ .optional(),
78
91
  imagePlaceholderUrl: zod_openapi_1.z.url().optional(),
79
92
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
80
93
  projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).optional(),
81
- clientId: zod_openapi_1.z.cuid2().optional(),
94
+ clientId: zod_openapi_1.z
95
+ .string()
96
+ .transform((val) => (val === "" ? undefined : val))
97
+ .pipe(zod_openapi_1.z.string().cuid2().optional()),
82
98
  clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).optional(),
83
99
  clientName: zod_openapi_1.z.string().optional(),
84
100
  isFeatured: zod_openapi_1.z.boolean().optional(),
85
101
  status: zod_openapi_1.z.enum(constants_1.PROJECT_STATUS).optional(),
86
- problemBeingSolved: zod_openapi_1.z.string().max(600).optional(),
87
- whoItsFor: zod_openapi_1.z.string().max(600).optional(),
102
+ problemBeingSolved: zod_openapi_1.z
103
+ .string()
104
+ .min(20, "Describe the problem you're solving.")
105
+ .max(600)
106
+ .optional(),
107
+ whoItsFor: zod_openapi_1.z
108
+ .string()
109
+ .min(5, "Tell us who this is for.")
110
+ .max(600)
111
+ .optional(),
88
112
  ventureStage: zod_openapi_1.z.enum(constants_1.VENTURE_STAGES).optional(),
89
113
  capitalLookingToRaise: zod_openapi_1.z.number().optional(),
90
114
  capitalLookingToRaiseCurrency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY).optional(),
91
- currentTraction: zod_openapi_1.z.string().max(600).optional(),
115
+ currentTraction: zod_openapi_1.z
116
+ .string()
117
+ .min(10, "Share your current traction.")
118
+ .max(600)
119
+ .optional(),
92
120
  isOpenToInvestment: zod_openapi_1.z.boolean().default(false),
93
121
  startDate: zod_openapi_1.z.coerce.date().optional(),
94
122
  endDate: zod_openapi_1.z.coerce.date().optional(),
@@ -101,14 +129,14 @@ exports.UpdateProjectInputSchema = zod_openapi_1.z
101
129
  ctx.addIssue({
102
130
  path: ["startDate"],
103
131
  code: "custom",
104
- message: "Start date cannot be in the future",
132
+ message: "Start date cannot be in the future.",
105
133
  });
106
134
  }
107
135
  if (startDate && endDate && startDate > endDate) {
108
136
  ctx.addIssue({
109
- path: ["startDate"],
137
+ path: ["endDate"],
110
138
  code: "custom",
111
- message: "Start date cannot be after end date",
139
+ message: "End date must follow the start date.",
112
140
  });
113
141
  }
114
142
  })
@@ -150,18 +178,36 @@ exports.ProjectSearchDocumentSchema = zod_openapi_1.z
150
178
  files: zod_openapi_1.z.array(file_1.FileEntitySchema).optional(),
151
179
  })
152
180
  .openapi("ProjectSearchDocument");
181
+ const coerceArray = (val) => {
182
+ if (typeof val === "string")
183
+ return val === "" ? [] : val.split(",");
184
+ return val;
185
+ };
186
+ const coerceBoolean = (val) => {
187
+ if (val === "true")
188
+ return true;
189
+ if (val === "false")
190
+ return false;
191
+ return val;
192
+ };
153
193
  exports.SearchProjectsInputSchema = zod_openapi_1.z
154
194
  .object({
155
195
  query: zod_openapi_1.z.string().optional(),
156
- limit: zod_openapi_1.z.number().optional().default(40),
196
+ limit: zod_openapi_1.z.coerce.number().optional().default(40),
157
197
  cursor: zod_openapi_1.z.string().optional().nullable(),
158
- tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
159
- isOpenToInvestment: zod_openapi_1.z.boolean().optional(),
160
- minCapital: zod_openapi_1.z.number().optional(),
161
- maxCapital: zod_openapi_1.z.number().optional(),
162
- ventureStages: zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.VENTURE_STAGES)).optional(),
163
- projectCreatorTypes: zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.ROLES)).optional(),
164
- clientTypes: zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.CLIENT_TYPES)).optional(),
198
+ tags: zod_openapi_1.z.preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.string())).optional(),
199
+ isOpenToInvestment: zod_openapi_1.z.preprocess(coerceBoolean, zod_openapi_1.z.boolean()).optional(),
200
+ minCapital: zod_openapi_1.z.coerce.number().optional(),
201
+ maxCapital: zod_openapi_1.z.coerce.number().optional(),
202
+ ventureStages: zod_openapi_1.z
203
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.VENTURE_STAGES)))
204
+ .optional(),
205
+ projectCreatorTypes: zod_openapi_1.z
206
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.ROLES)))
207
+ .optional(),
208
+ clientTypes: zod_openapi_1.z
209
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.CLIENT_TYPES)))
210
+ .optional(),
165
211
  })
166
212
  .openapi("SearchProjectsInput");
167
213
  exports.SearchProjectsOutputSchema = zod_openapi_1.z
@@ -1736,14 +1736,14 @@ export declare const GetUserActivityOutputSchema: z.ZodArray<z.ZodObject<{
1736
1736
  export type GetUserActivityOutput = z.infer<typeof GetUserActivityOutputSchema>;
1737
1737
  export declare const SearchUsersInputSchema: z.ZodObject<{
1738
1738
  query: z.ZodDefault<z.ZodString>;
1739
- roles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1739
+ roles: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodEnum<{
1740
1740
  CREATIVE: "CREATIVE";
1741
1741
  BRAND: "BRAND";
1742
1742
  INVESTOR: "INVESTOR";
1743
1743
  ADMIN: "ADMIN";
1744
- }>>>;
1745
- disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
1746
- locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
1744
+ }>>>>;
1745
+ disciplines: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodString>>>;
1746
+ locations: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodString>>>;
1747
1747
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1748
1748
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1749
1749
  }, z.core.$strip>;
@@ -240,21 +240,26 @@ exports.GetUserActivityOutputSchema = zod_openapi_1.z
240
240
  .openapi({ example: "POST" }),
241
241
  }))
242
242
  .openapi({ example: [] });
243
+ const coerceArray = (val) => {
244
+ if (typeof val === "string")
245
+ return val === "" ? [] : val.split(",");
246
+ return val;
247
+ };
243
248
  exports.SearchUsersInputSchema = zod_openapi_1.z.object({
244
249
  query: zod_openapi_1.z.string().default("").openapi({
245
250
  example: "john",
246
251
  description: "Search by name, email, username, or discipline",
247
252
  }),
248
253
  roles: zod_openapi_1.z
249
- .array(zod_openapi_1.z.enum(Object.values(constants_1.ROLES)))
254
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.enum(Object.values(constants_1.ROLES))))
250
255
  .optional()
251
256
  .openapi({ example: ["CREATIVE", "BRAND"] }),
252
257
  disciplines: zod_openapi_1.z
253
- .array(zod_openapi_1.z.string())
258
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.string()))
254
259
  .optional()
255
260
  .openapi({ example: ["Design Systems", "Web Development"] }),
256
261
  locations: zod_openapi_1.z
257
- .array(zod_openapi_1.z.string())
262
+ .preprocess(coerceArray, zod_openapi_1.z.array(zod_openapi_1.z.string()))
258
263
  .optional()
259
264
  .openapi({ example: ["Lagos, Nigeria", "London, UK"] }),
260
265
  limit: zod_openapi_1.z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.22",
3
+ "version": "2.5.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -92,23 +92,49 @@ export const UpdateProjectInputSchema = z
92
92
  .object({
93
93
  id: z.cuid2(),
94
94
  title: z.string().optional(),
95
- description: z.string().optional(),
95
+ description: z
96
+ .string()
97
+ .min(10, "Add a bit more detail to your description.")
98
+ .optional(),
96
99
  overview: z.string().optional(),
97
- url: z.url().or(z.literal("")).optional(),
100
+ url: z
101
+ .string()
102
+ .transform((val) => {
103
+ if (!val) return val;
104
+ if (val.startsWith("http://") || val.startsWith("https://")) return val;
105
+ return `https://${val}`;
106
+ })
107
+ .pipe(z.string().url("Check your link.").or(z.literal("")))
108
+ .optional(),
98
109
  imagePlaceholderUrl: z.url().optional(),
99
110
  tags: z.array(z.string()).optional(),
100
111
  projectCreatorType: z.enum(ROLES).optional(),
101
- clientId: z.cuid2().optional(),
112
+ clientId: z
113
+ .string()
114
+ .transform((val) => (val === "" ? undefined : val))
115
+ .pipe(z.string().cuid2().optional()),
102
116
  clientType: z.enum(CLIENT_TYPES).optional(),
103
117
  clientName: z.string().optional(),
104
118
  isFeatured: z.boolean().optional(),
105
119
  status: z.enum(PROJECT_STATUS).optional(),
106
- problemBeingSolved: z.string().max(600).optional(),
107
- whoItsFor: z.string().max(600).optional(),
120
+ problemBeingSolved: z
121
+ .string()
122
+ .min(20, "Describe the problem you're solving.")
123
+ .max(600)
124
+ .optional(),
125
+ whoItsFor: z
126
+ .string()
127
+ .min(5, "Tell us who this is for.")
128
+ .max(600)
129
+ .optional(),
108
130
  ventureStage: z.enum(VENTURE_STAGES).optional(),
109
131
  capitalLookingToRaise: z.number().optional(),
110
132
  capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
111
- currentTraction: z.string().max(600).optional(),
133
+ currentTraction: z
134
+ .string()
135
+ .min(10, "Share your current traction.")
136
+ .max(600)
137
+ .optional(),
112
138
  isOpenToInvestment: z.boolean().default(false),
113
139
  startDate: z.coerce.date().optional(),
114
140
  endDate: z.coerce.date().optional(),
@@ -121,19 +147,19 @@ export const UpdateProjectInputSchema = z
121
147
  ctx.addIssue({
122
148
  path: ["startDate"],
123
149
  code: "custom",
124
- message: "Start date cannot be in the future",
150
+ message: "Start date cannot be in the future.",
125
151
  });
126
152
  }
127
153
  if (startDate && endDate && startDate > endDate) {
128
154
  ctx.addIssue({
129
- path: ["startDate"],
155
+ path: ["endDate"],
130
156
  code: "custom",
131
- message: "Start date cannot be after end date",
157
+ message: "End date must follow the start date.",
132
158
  });
133
159
  }
134
160
  })
135
161
  .openapi("UpdateProjectInput");
136
-
162
+
137
163
  export type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
138
164
 
139
165
  export const CommentOnProjectInputSchema = CommentEntitySchema;
@@ -185,18 +211,42 @@ export const ProjectSearchDocumentSchema = z
185
211
 
186
212
  export type ProjectSearchDocument = z.infer<typeof ProjectSearchDocumentSchema>;
187
213
 
214
+ const coerceArray = (val: unknown) => {
215
+ if (typeof val === "string") return val === "" ? [] : val.split(",");
216
+ return val;
217
+ };
218
+
219
+ const coerceBoolean = (val: unknown) => {
220
+ if (val === "true") return true;
221
+ if (val === "false") return false;
222
+ return val;
223
+ };
224
+
188
225
  export const SearchProjectsInputSchema = z
189
226
  .object({
190
227
  query: z.string().optional(),
191
- limit: z.number().optional().default(40),
228
+
229
+ limit: z.coerce.number().optional().default(40),
192
230
  cursor: z.string().optional().nullable(),
193
- tags: z.array(z.string()).optional(),
194
- isOpenToInvestment: z.boolean().optional(),
195
- minCapital: z.number().optional(),
196
- maxCapital: z.number().optional(),
197
- ventureStages: z.array(z.enum(VENTURE_STAGES)).optional(),
198
- projectCreatorTypes: z.array(z.enum(ROLES)).optional(),
199
- clientTypes: z.array(z.enum(CLIENT_TYPES)).optional(),
231
+
232
+ tags: z.preprocess(coerceArray, z.array(z.string())).optional(),
233
+
234
+ isOpenToInvestment: z.preprocess(coerceBoolean, z.boolean()).optional(),
235
+
236
+ minCapital: z.coerce.number().optional(),
237
+ maxCapital: z.coerce.number().optional(),
238
+
239
+ ventureStages: z
240
+ .preprocess(coerceArray, z.array(z.enum(VENTURE_STAGES)))
241
+ .optional(),
242
+
243
+ projectCreatorTypes: z
244
+ .preprocess(coerceArray, z.array(z.enum(ROLES)))
245
+ .optional(),
246
+
247
+ clientTypes: z
248
+ .preprocess(coerceArray, z.array(z.enum(CLIENT_TYPES)))
249
+ .optional(),
200
250
  })
201
251
  .openapi("SearchProjectsInput");
202
252
 
@@ -452,21 +452,29 @@ export const GetUserActivityOutputSchema = z
452
452
 
453
453
  export type GetUserActivityOutput = z.infer<typeof GetUserActivityOutputSchema>;
454
454
 
455
+ const coerceArray = (val: unknown) => {
456
+ if (typeof val === "string") return val === "" ? [] : val.split(",");
457
+ return val;
458
+ };
459
+
455
460
  export const SearchUsersInputSchema = z.object({
456
461
  query: z.string().default("").openapi({
457
462
  example: "john",
458
463
  description: "Search by name, email, username, or discipline",
459
464
  }),
460
465
  roles: z
461
- .array(z.enum(Object.values(ROLES) as [Role, ...Role[]]))
466
+ .preprocess(
467
+ coerceArray,
468
+ z.array(z.enum(Object.values(ROLES) as [Role, ...Role[]])),
469
+ )
462
470
  .optional()
463
471
  .openapi({ example: ["CREATIVE", "BRAND"] }),
464
472
  disciplines: z
465
- .array(z.string())
473
+ .preprocess(coerceArray, z.array(z.string()))
466
474
  .optional()
467
475
  .openapi({ example: ["Design Systems", "Web Development"] }),
468
476
  locations: z
469
- .array(z.string())
477
+ .preprocess(coerceArray, z.array(z.string()))
470
478
  .optional()
471
479
  .openapi({ example: ["Lagos, Nigeria", "London, UK"] }),
472
480
  limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),