@zyacreatives/shared 2.1.40 → 2.1.42

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.
@@ -4,255 +4,253 @@ import { ProfileIdentifierSchema } from "./common";
4
4
  import { MinimalUserSchema } from "./user";
5
5
 
6
6
  export const MinimalCreativeEntitySchema = z.object({
7
- id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
8
- userId: z.cuid2().openapi({ example: "user_abc123" }),
9
- bio: z.string().optional().openapi({
10
- example: "A multi-disciplinary designer specializing in brand identity.",
11
- }),
12
- role: z.string().optional().openapi({ example: "Designer" }),
13
- location: z.string().optional().openapi({ example: "London, UK" }),
14
- experienceLevel: z
15
- .enum(
16
- Object.values(EXPERIENCE_LEVELS) as [
17
- ExperienceLevel,
18
- ...ExperienceLevel[]
19
- ]
20
- )
21
- .optional()
22
- .openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
23
- tags: z
24
- .array(z.string())
25
- .optional()
26
- .openapi({ example: ["branding", "typography", "UX"] }),
27
- disciplines: z
28
- .array(z.string())
29
- .optional()
30
- .openapi({ example: ["Design", "Art Direction"] }),
31
- createdAt: z.coerce
32
- .date()
33
- .optional()
34
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
35
- updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
36
- });
37
-
38
- export const CreativeEntitySchema = z
39
- .object({
40
7
  id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
41
8
  userId: z.cuid2().openapi({ example: "user_abc123" }),
42
9
  bio: z.string().optional().openapi({
43
- example: "A multi-disciplinary designer specializing in brand identity.",
10
+ example:
11
+ "A multi-disciplinary designer specializing in brand identity.",
44
12
  }),
45
13
  role: z.string().optional().openapi({ example: "Designer" }),
46
14
  location: z.string().optional().openapi({ example: "London, UK" }),
47
15
  experienceLevel: z
48
- .enum(
49
- Object.values(EXPERIENCE_LEVELS) as [
50
- ExperienceLevel,
51
- ...ExperienceLevel[]
52
- ]
53
- )
54
- .optional()
55
- .openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
56
-
57
- tags: z
58
- .array(z.string())
59
- .optional()
60
- .openapi({ example: ["branding", "typography", "UX"] }),
16
+ .enum(
17
+ Object.values(EXPERIENCE_LEVELS) as [
18
+ ExperienceLevel,
19
+ ...ExperienceLevel[],
20
+ ],
21
+ )
22
+ .optional()
23
+ .openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
61
24
 
62
25
  disciplines: z
63
- .array(z.string())
64
- .optional()
65
- .openapi({ example: ["Design", "Art Direction"] }),
66
- workExperience: z
67
- .object({
68
- companyName: z.string(),
69
- position: z.string(),
70
- startDate: z.coerce.date().optional(),
71
- endDate: z.coerce.date().optional(),
72
- currentlyWorking: z.boolean().optional(),
73
- description: z.string(),
74
- })
75
- .array()
76
- .optional(),
77
- links: z
78
- .object({
79
- url: z
80
- .union([
81
- z.url({ message: "Please enter a valid URL" }),
82
- z.literal(""),
83
- ])
84
- .optional(),
85
- type: z.enum(LINK_TYPES).optional(),
86
- })
87
- .array()
88
- .optional(),
89
- achievements: z
90
- .object({
91
- title: z.string(),
92
- link: z.string().optional(),
93
- year: z.coerce.number().int().optional(),
94
- })
95
- .array()
96
- .optional(),
26
+ .array(z.string())
27
+ .optional()
28
+ .openapi({ example: ["Design", "Art Direction"] }),
97
29
  createdAt: z.coerce
98
- .date()
99
- .optional()
100
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
101
-
30
+ .date()
31
+ .optional()
32
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
102
33
  updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
103
- })
104
- .openapi({
105
- title: "CreativeEntitySchema",
106
- description:
107
- "Represents a creative profile, including bio, experience level, location, disciplines, tags, and timestamps.",
108
- });
34
+ });
109
35
 
110
- export const ListCreativesInputSchema = z
111
- .object({
112
- query: z.string().optional().openapi({ example: "logo designer" }),
36
+ export const CreativeEntitySchema = z
37
+ .object({
38
+ id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
39
+ userId: z.cuid2().openapi({ example: "user_abc123" }),
40
+ bio: z.string().optional().openapi({
41
+ example:
42
+ "A multi-disciplinary designer specializing in brand identity.",
43
+ }),
44
+ role: z.string().optional().openapi({ example: "Designer" }),
45
+ location: z.string().optional().openapi({ example: "London, UK" }),
46
+ experienceLevel: z
47
+ .enum(
48
+ Object.values(EXPERIENCE_LEVELS) as [
49
+ ExperienceLevel,
50
+ ...ExperienceLevel[],
51
+ ],
52
+ )
53
+ .optional()
54
+ .openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
113
55
 
114
- disciplines: z
115
- .array(z.string())
116
- .optional()
117
- .openapi({ example: ["branding", "web design"] }),
56
+ disciplines: z
57
+ .array(z.string())
58
+ .optional()
59
+ .openapi({ example: ["Design", "Art Direction"] }),
60
+ workExperience: z
61
+ .object({
62
+ companyName: z.string(),
63
+ position: z.string(),
64
+ startDate: z.coerce.date().optional(),
65
+ endDate: z.coerce.date().optional(),
66
+ currentlyWorking: z.boolean().optional(),
67
+ description: z.string(),
68
+ })
69
+ .array()
70
+ .optional(),
71
+ links: z
72
+ .object({
73
+ url: z
74
+ .union([
75
+ z.url({ message: "Please enter a valid URL" }),
76
+ z.literal(""),
77
+ ])
78
+ .optional(),
79
+ type: z.enum(LINK_TYPES).optional(),
80
+ })
81
+ .array()
82
+ .optional(),
83
+ achievements: z
84
+ .object({
85
+ title: z.string(),
86
+ link: z.string().optional(),
87
+ year: z.coerce.number().int().optional(),
88
+ })
89
+ .array()
90
+ .optional(),
91
+ createdAt: z.coerce
92
+ .date()
93
+ .optional()
94
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
118
95
 
119
- experienceLevels: z
120
- .array(
121
- z.enum(
122
- Object.values(EXPERIENCE_LEVELS) as [
123
- ExperienceLevel,
124
- ...ExperienceLevel[]
125
- ]
126
- )
127
- )
128
- .optional()
129
- .openapi({
130
- example: [EXPERIENCE_LEVELS.YEAR_1_3, EXPERIENCE_LEVELS.YEAR_5_PLUS],
131
- }),
96
+ updatedAt: z.coerce
97
+ .date()
98
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
99
+ })
100
+ .openapi({
101
+ title: "CreativeEntitySchema",
102
+ description:
103
+ "Represents a creative profile, including bio, experience level, location, disciplines and timestamps.",
104
+ });
105
+
106
+ export const ListCreativesInputSchema = z
107
+ .object({
108
+ query: z.string().optional().openapi({ example: "logo designer" }),
109
+
110
+ disciplines: z
111
+ .array(z.string())
112
+ .optional()
113
+ .openapi({ example: ["branding", "web design"] }),
132
114
 
133
- location: z.string().optional().openapi({ example: "Los Angeles" }),
115
+ experienceLevels: z
116
+ .array(
117
+ z.enum(
118
+ Object.values(EXPERIENCE_LEVELS) as [
119
+ ExperienceLevel,
120
+ ...ExperienceLevel[],
121
+ ],
122
+ ),
123
+ )
124
+ .optional()
125
+ .openapi({
126
+ example: [
127
+ EXPERIENCE_LEVELS.YEAR_1_3,
128
+ EXPERIENCE_LEVELS.YEAR_5_PLUS,
129
+ ],
130
+ }),
134
131
 
135
- tags: z
136
- .array(z.string())
137
- .optional()
138
- .openapi({ example: ["Figma", "AI"] }),
132
+ location: z.string().optional().openapi({ example: "Los Angeles" }),
139
133
 
140
- page: z.number().int().min(1).default(1).optional().openapi({ example: 1 }),
134
+ page: z
135
+ .number()
136
+ .int()
137
+ .min(1)
138
+ .default(1)
139
+ .optional()
140
+ .openapi({ example: 1 }),
141
141
 
142
- perPage: z
143
- .number()
144
- .int()
145
- .min(1)
146
- .max(100)
147
- .default(20)
148
- .optional()
149
- .openapi({ example: 20 }),
150
- })
151
- .openapi({
152
- title: "ListCreativesInput",
153
- description:
154
- "Query parameters for filtering and paginating creatives. Supports text search, discipline filtering, experience level filtering, tag filtering, location filtering, and pagination settings.",
155
- });
142
+ perPage: z
143
+ .number()
144
+ .int()
145
+ .min(1)
146
+ .max(100)
147
+ .default(20)
148
+ .optional()
149
+ .openapi({ example: 20 }),
150
+ })
151
+ .openapi({
152
+ title: "ListCreativesInput",
153
+ description:
154
+ "Query parameters for filtering and paginating creatives. Supports text search, discipline filtering, experience level filtering, tag filtering, location filtering, and pagination settings.",
155
+ });
156
156
 
157
157
  export const CreateCreativeProfileInputSchema = z
158
- .object({
159
- experienceLevel: z
160
- .enum(EXPERIENCE_LEVELS)
161
- .describe("Overall experience range of the creative.")
162
- .default(EXPERIENCE_LEVELS.YEAR_0_1)
163
- .openapi({
164
- example: EXPERIENCE_LEVELS.YEAR_1_3,
165
- }),
166
- role: z.string().optional().openapi({ example: "Designer" }),
158
+ .object({
159
+ experienceLevel: z
160
+ .enum(EXPERIENCE_LEVELS)
161
+ .describe("Overall experience range of the creative.")
162
+ .default(EXPERIENCE_LEVELS.YEAR_0_1)
163
+ .openapi({
164
+ example: EXPERIENCE_LEVELS.YEAR_1_3,
165
+ }),
166
+ role: z.string().optional().openapi({ example: "Designer" }),
167
167
 
168
- location: z
169
- .string()
170
- .max(100)
171
- .optional()
172
- .describe("Primary location where the creative works or resides.")
173
- .openapi({
174
- example: "Lagos, Nigeria",
175
- }),
168
+ location: z
169
+ .string()
170
+ .max(100)
171
+ .optional()
172
+ .describe("Primary location where the creative works or resides.")
173
+ .openapi({
174
+ example: "Lagos, Nigeria",
175
+ }),
176
176
 
177
- disciplineSlugs: z
178
- .array(z.string())
179
- .min(1, "At least one discipline is required")
180
- .default([])
181
- .describe("List of discipline slugs representing the creative’s fields.")
182
- .openapi({
183
- example: ["ui-ux", "frontend"],
184
- }),
185
- })
186
- .openapi({
187
- title: "create creative profile",
188
- description: "Payload for creating a new creative profile.",
189
- });
177
+ disciplineSlugs: z
178
+ .array(z.string())
179
+ .min(1, "At least one discipline is required")
180
+ .default([])
181
+ .describe(
182
+ "List of discipline slugs representing the creative’s fields.",
183
+ )
184
+ .openapi({
185
+ example: ["ui-ux", "frontend"],
186
+ }),
187
+ })
188
+ .openapi({
189
+ title: "create creative profile",
190
+ description: "Payload for creating a new creative profile.",
191
+ });
190
192
 
191
193
  export const UpdateCreativeProfileInputSchema = z
192
- .object({
193
- experienceLevel: z
194
- .enum(EXPERIENCE_LEVELS)
195
- .optional()
196
- .openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
197
- tags: z
198
- .array(z.string())
199
- .optional()
200
- .openapi({ example: ["react", "design", "product"] }),
201
- role: z.string().optional().openapi({ example: "Designer" }),
202
- bio: z
203
- .string()
204
- .max(600)
205
- .optional()
206
- .openapi({ example: "I am a freelance UI/UX designer." }),
207
- location: z
208
- .string()
209
- .max(100)
210
- .optional()
211
- .openapi({ example: "Lagos, Nigeria" }),
212
- disciplineSlugs: z
213
- .array(z.string())
214
- .min(1, "At least one discipline is required")
215
- .optional()
216
- .openapi({ example: ["frontend", "ui-ux"] }),
217
- workExperience: z
218
- .object({
219
- companyName: z.string(),
220
- position: z.string(),
221
- startDate: z.coerce.date().optional(),
222
- endDate: z.coerce.date().optional(),
223
- currentlyWorking: z.boolean().optional(),
224
- description: z.string().optional(),
225
- })
226
- .array()
227
- .optional(),
228
- links: z
229
- .object({
230
- url: z
231
- .union([
232
- z.url({ message: "Please enter a valid URL" }),
233
- z.literal(""),
234
- ])
235
- .optional(),
236
- type: z.enum(LINK_TYPES).optional(),
237
- })
238
- .array()
239
- .optional(),
240
- achievements: z
241
- .object({
242
- title: z.string(),
243
- link: z.string().optional(),
244
- year: z.coerce.number().int().optional(),
245
- })
246
- .array()
247
- .optional(),
248
- })
249
- .openapi({
250
- title: "update creative profile",
251
- });
194
+ .object({
195
+ experienceLevel: z
196
+ .enum(EXPERIENCE_LEVELS)
197
+ .optional()
198
+ .openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
199
+ role: z.string().optional().openapi({ example: "Designer" }),
200
+ bio: z
201
+ .string()
202
+ .max(600)
203
+ .optional()
204
+ .openapi({ example: "I am a freelance UI/UX designer." }),
205
+ location: z
206
+ .string()
207
+ .max(100)
208
+ .optional()
209
+ .openapi({ example: "Lagos, Nigeria" }),
210
+ disciplineSlugs: z
211
+ .array(z.string())
212
+ .min(1, "At least one discipline is required")
213
+ .optional()
214
+ .openapi({ example: ["frontend", "ui-ux"] }),
215
+ workExperience: z
216
+ .object({
217
+ companyName: z.string(),
218
+ position: z.string(),
219
+ startDate: z.coerce.date().optional(),
220
+ endDate: z.coerce.date().optional(),
221
+ currentlyWorking: z.boolean().optional(),
222
+ description: z.string().optional(),
223
+ })
224
+ .array()
225
+ .optional(),
226
+ links: z
227
+ .object({
228
+ url: z
229
+ .union([
230
+ z.url({ message: "Please enter a valid URL" }),
231
+ z.literal(""),
232
+ ])
233
+ .optional(),
234
+ type: z.enum(LINK_TYPES).optional(),
235
+ })
236
+ .array()
237
+ .optional(),
238
+ achievements: z
239
+ .object({
240
+ title: z.string(),
241
+ link: z.string().optional(),
242
+ year: z.coerce.number().int().optional(),
243
+ })
244
+ .array()
245
+ .optional(),
246
+ })
247
+ .openapi({
248
+ title: "update creative profile",
249
+ });
252
250
 
253
251
  export const GetCreativeInputSchema = z.object({
254
- value: z.cuid2(),
255
- by: ProfileIdentifierSchema.shape.by,
252
+ value: z.cuid2(),
253
+ by: ProfileIdentifierSchema.shape.by,
256
254
  });
257
255
 
258
256
  export const GetCreativeQuerySchema = ProfileIdentifierSchema;
@@ -264,24 +262,24 @@ export const GetCreativeOutputSchema = CreativeEntitySchema;
264
262
  export const UpdateCreativeOutputSchema = CreativeEntitySchema;
265
263
 
266
264
  export const CreativeWithUserEntitySchema = MinimalCreativeEntitySchema.extend({
267
- user: MinimalUserSchema,
265
+ user: MinimalUserSchema,
268
266
  });
269
267
 
270
268
  export const SearchCreativeInputSchema = z.object({
271
- string: z
272
- .string()
273
- .min(1, { message: "Search string cannot be empty" })
274
- .max(200, { message: "Search string cannot exceed 200 characters" }),
275
- limit: z.coerce
276
- .number()
277
- .int({ message: "Limit must be an integer" })
278
- .min(1, { message: "Limit must be at least 1" })
279
- .max(100, { message: "Limit cannot exceed 100" })
280
- .default(20),
281
- cursor: z.string().optional(),
269
+ string: z
270
+ .string()
271
+ .min(1, { message: "Search string cannot be empty" })
272
+ .max(200, { message: "Search string cannot exceed 200 characters" }),
273
+ limit: z.coerce
274
+ .number()
275
+ .int({ message: "Limit must be an integer" })
276
+ .min(1, { message: "Limit must be at least 1" })
277
+ .max(100, { message: "Limit cannot exceed 100" })
278
+ .default(20),
279
+ cursor: z.string().optional(),
282
280
  });
283
281
 
284
282
  export const SearchCreativeOutputSchema = z.object({
285
- creatives: z.array(CreativeWithUserEntitySchema),
286
- nextCursor: z.string().optional().nullable(),
283
+ creatives: z.array(CreativeWithUserEntitySchema),
284
+ nextCursor: z.string().optional().nullable(),
287
285
  });
@@ -1,70 +1,71 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import { ACTIVITY_PARENT_TYPES, NOTIFICATION_TYPES } from "../constants";
3
+ import { MinimalUserSchema } from "./user";
3
4
 
4
5
  export const NotificationEntitySchema = z
5
- .object({
6
- id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
7
- recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
8
- actorId: z.cuid2().openapi({ example: "user_actor_456" }),
9
- type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
10
- // 1. ENTITY: The specific thing created (e.g., the Reply)
11
- entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
6
+ .object({
7
+ id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
8
+ recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
9
+ actorId: z.cuid2().openapi({ example: "user_actor_456" }),
10
+ type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
11
+ entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
12
12
 
13
- // 2. PARENT: The direct context (e.g., the Comment being replied to)
14
- // Optional because top-level interactions (like a comment on a project)
15
- // have no parent other than the root.
16
- parentId: z
13
+ parentId: z
14
+ .cuid2()
15
+ .optional()
16
+ .nullable()
17
+ .openapi({ example: "parent_456" }),
18
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
19
+ rootId: z.cuid2().openapi({ example: "root_123" }),
20
+ rootType: z.enum(ACTIVITY_PARENT_TYPES),
17
21
 
18
- .cuid2()
19
- .optional()
20
- .nullable()
21
- .openapi({ example: "parent_456" }),
22
- parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
23
-
24
- // 3. ROOT: The top-level container (e.g., the Project)
25
- rootId: z.cuid2().openapi({ example: "root_123" }),
26
- rootType: z.enum(ACTIVITY_PARENT_TYPES),
27
-
28
- isRead: z.boolean().default(false).openapi({ example: false }),
29
- createdAt: z.coerce.date().openapi({ example: "2026-01-05T09:00:00.000Z" }),
30
- deletedAt: z.coerce.date().optional().nullable(),
31
- })
32
- .openapi("NotificationEntity");
22
+ isRead: z.boolean().default(false).openapi({ example: false }),
23
+ createdAt: z.coerce
24
+ .date()
25
+ .openapi({ example: "2026-01-05T09:00:00.000Z" }),
26
+ deletedAt: z.coerce.date().optional().nullable(),
27
+ })
28
+ .openapi("NotificationEntity");
33
29
 
34
30
  export const MinimalNotificationEntitySchema = z.object({
35
- id: z.cuid2(),
36
- recipientId: z.cuid2(),
37
- actorId: z.cuid2(),
31
+ id: z.cuid2(),
32
+ recipientId: z.cuid2(),
33
+ actorId: z.cuid2(),
38
34
  });
39
35
 
40
36
  export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
41
- itemTitle: z.string().optional(),
42
- itemContent: z.string().optional(),
43
- itemImgUrl: z.string().optional(),
44
- itemStatus: z.string().optional(),
37
+ actor: MinimalUserSchema,
38
+ recipient: MinimalUserSchema,
39
+ itemTitle: z.string().optional(),
40
+ itemContent: z.string().optional(),
41
+ itemImgUrl: z.string().optional(),
42
+ itemStatus: z.string().optional(),
45
43
  });
46
44
 
47
45
  export const ListNotificationsInputSchema = z
48
- .object({
49
- type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }).optional(),
50
- cursor: z.string().optional(),
51
- unreadOnly: z
52
- .preprocess((val) => val === "true" || val === true, z.boolean())
53
- .optional()
54
- .default(false),
55
- })
56
- .openapi("ListNotificationsInput");
46
+ .object({
47
+ type: z
48
+ .enum(NOTIFICATION_TYPES)
49
+ .openapi({ example: "LIKE" })
50
+ .optional(),
51
+ cursor: z.string().optional(),
52
+ unreadOnly: z
53
+ .preprocess((val) => val === "true" || val === true, z.boolean())
54
+ .optional()
55
+ .default(false),
56
+ })
57
+ .openapi("ListNotificationsInput");
57
58
 
58
59
  export const ListNotificationsOutputSchema = z.object({
59
- notifications: z.array(NotificationDetailsEntitySchema),
60
- nextCursor: z.string().optional().nullable(),
61
- unreadCount: z.number().int().openapi({ example: 5 }),
60
+ notifications: z.array(NotificationDetailsEntitySchema),
61
+ nextCursor: z.string().optional().nullable(),
62
+ unreadCount: z.number().int().openapi({ example: 5 }),
62
63
  });
63
64
 
64
65
  export const MarkReadInputSchema = z.object({
65
- notificationIds: z.array(z.cuid2()).min(1),
66
+ notificationIds: z.array(z.cuid2()).min(1),
66
67
  });
67
68
 
68
69
  export const NotificationCountOutputSchema = z.object({
69
- unreadCount: z.number().int().openapi({ example: 12 }),
70
+ unreadCount: z.number().int().openapi({ example: 12 }),
70
71
  });