@zyacreatives/shared 2.2.65 → 2.2.66

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.
@@ -18,22 +18,40 @@ export const PostEntitySchema = z.object({
18
18
  .cuid2()
19
19
  .optional()
20
20
  .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
21
- parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
21
+ parentType: z
22
+ .enum(ACTIVITY_PARENT_TYPES)
23
+ .default(ACTIVITY_PARENT_TYPES.POST)
24
+ .openapi({ example: "POST" }),
22
25
  tags: z
23
26
  .array(
24
27
  z.object({
25
- name: z.string(),
26
- id: z.int(),
28
+ name: z.string().openapi({ example: "javascript" }),
29
+ id: z.int().openapi({ example: 101 }),
27
30
  }),
28
31
  )
29
- .optional(),
30
- badge: z.enum(POST_BADGE_TYPES).optional(),
32
+ .optional()
33
+ .openapi({
34
+ example: [{ name: "javascript", id: 101 }],
35
+ }),
36
+ badge: z
37
+ .enum(POST_BADGE_TYPES)
38
+ .optional()
39
+ .openapi({ example: "FEATURED" }),
31
40
  userId: z
32
41
  .cuid2()
33
42
  .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
34
- creatorUsername: z.string().optional().openapi({ description: "Username" }),
35
- creatorFullName: z.string().optional(),
36
- creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
43
+ creatorUsername: z
44
+ .string()
45
+ .optional()
46
+ .openapi({ description: "Username", example: "dev_guru" }),
47
+ creatorFullName: z
48
+ .string()
49
+ .optional()
50
+ .openapi({ example: "Jane Doe" }),
51
+ creatorImageUrl: z
52
+ .cuid2()
53
+ .optional()
54
+ .openapi({ description: "Creator Image ID", example: "clm1a2b3c0000pic" }),
37
55
  content: z
38
56
  .string()
39
57
  .optional()
@@ -46,20 +64,32 @@ export const PostEntitySchema = z.object({
46
64
  {
47
65
  message: "Post content cannot exceed 300 characters",
48
66
  },
49
- ),
67
+ )
68
+ .openapi({ example: "Check out my new portfolio update!" }),
50
69
  postType: z.enum(POST_TYPES).openapi({
51
70
  description: "Type of the post entity this statistic belongs to.",
52
71
  title: "Post Type",
72
+ example: "PROJECT",
53
73
  }),
54
74
 
55
- createdAt: z.coerce.date().optional(),
75
+ createdAt: z
76
+ .coerce
77
+ .date()
78
+ .optional()
79
+ .openapi({ example: "2026-03-11T14:43:09Z" }),
56
80
 
57
81
  linkMeta: z
58
82
  .object({
59
- url: z.url(),
60
- title: z.string().optional(),
61
- description: z.string().optional(),
62
- image: z.url().optional(),
83
+ url: z.url().openapi({ example: "https://example.com" }),
84
+ title: z.string().optional().openapi({ example: "Example Website" }),
85
+ description: z
86
+ .string()
87
+ .optional()
88
+ .openapi({ example: "This is an example link" }),
89
+ image: z
90
+ .url()
91
+ .optional()
92
+ .openapi({ example: "https://example.com/preview.jpg" }),
63
93
  })
64
94
  .optional()
65
95
  .openapi({
@@ -76,12 +106,16 @@ export const PostEntitySchema = z.object({
76
106
  export const PostFileEntitySchema = z
77
107
  .object({
78
108
  id: z
79
- .string()
80
- .openapi({ description: "CUID2 of the project file record." }),
81
- postId: z.string().openapi({
109
+ .cuid2()
110
+ .openapi({ description: "CUID2 of the project file record.", example: "cxy1a2b3c0000qwe" }),
111
+ postId: z.cuid2().openapi({
82
112
  description: "CUID2 of the post this file belongs to.",
113
+ example: "ckj1a2b3c0000xyz",
114
+ }),
115
+ fileId: z.cuid2().openapi({
116
+ description: "CUID2 of the linked file.",
117
+ example: "cvb1a2b3c0000rty"
83
118
  }),
84
- fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
85
119
  order: z.number().int().openapi({
86
120
  description: "Order index of the file in the project.",
87
121
  example: 1,
@@ -96,20 +130,34 @@ export const PostWithFilesEntitySchema = PostEntitySchema.extend({
96
130
  postFiles: z
97
131
  .array(
98
132
  PostFileEntitySchema.extend({
99
- url: z.url(),
133
+ url: z.url().openapi({ example: "https://cdn.example.com/image.png" }),
100
134
  }),
101
135
  )
102
136
  .optional()
103
- .openapi({ description: "Files associated with the project." }),
137
+ .openapi({
138
+ description: "Files associated with the project.",
139
+ example: [
140
+ {
141
+ id: "cxy1a2b3c0000qwe",
142
+ postId: "ckj1a2b3c0000xyz",
143
+ fileId: "cvb1a2b3c0000rty",
144
+ order: 1,
145
+ url: "https://cdn.example.com/image.png"
146
+ }
147
+ ]
148
+ }),
104
149
  });
105
150
 
106
151
  export const CreatePostInputSchema = z.object({
107
- id: z.cuid2(),
152
+ id: z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" }),
108
153
  parentId: z
109
154
  .cuid2({ message: "Invalid parentId" })
110
155
  .optional()
111
156
  .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
112
- parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
157
+ parentType: z
158
+ .enum(ACTIVITY_PARENT_TYPES)
159
+ .default(ACTIVITY_PARENT_TYPES.POST)
160
+ .openapi({ example: "POST" }),
113
161
  content: z
114
162
  .string()
115
163
  .max(300, { message: "Post content cannot exceed 300 characters" })
@@ -130,33 +178,39 @@ export const CreatePostInputSchema = z.object({
130
178
  order: z
131
179
  .number()
132
180
  .int({ message: "File order must be an integer" })
133
-
134
181
  .max(5, { message: "File order cannot exceed 5" })
135
- .default(1),
182
+ .default(1)
183
+ .openapi({ example: 1 }),
136
184
  }),
137
185
  )
138
186
  .max(5, { message: "Cannot attach more than 5 files" })
139
- .optional(),
187
+ .optional()
188
+ .openapi({
189
+ example: [{ fileId: "cvb1a2b3c0000rty", order: 1 }]
190
+ }),
140
191
 
141
192
  tags: z
142
- .array(z.string().min(1, { message: "Tag cannot be empty" }))
193
+ .array(z.string().min(1, { message: "Tag cannot be empty" }).openapi({ example: "react" }))
143
194
  .max(3, { message: "Cannot add more than 3 tags" })
144
- .optional(),
145
- badge: z.enum(POST_BADGE_TYPES).optional(),
195
+ .optional()
196
+ .openapi({ example: ["react", "frontend"] }),
197
+ badge: z.enum(POST_BADGE_TYPES).optional().openapi({ example: "TRENDING" }),
146
198
  linkMeta: z
147
199
  .object({
148
- url: z.url({ message: "Invalid URL format" }),
200
+ url: z.url({ message: "Invalid URL format" }).openapi({ example: "https://example.com" }),
149
201
  title: z
150
202
  .string()
151
203
  .max(200, { message: "Title cannot exceed 200 characters" })
152
- .optional(),
204
+ .optional()
205
+ .openapi({ example: "Example Website" }),
153
206
  description: z
154
207
  .string()
155
208
  .max(500, {
156
209
  message: "Description cannot exceed 500 characters",
157
210
  })
158
- .optional(),
159
- image: z.url({ message: "Invalid image URL" }).optional(),
211
+ .optional()
212
+ .openapi({ example: "This is an example link" }),
213
+ image: z.url({ message: "Invalid image URL" }).optional().openapi({ example: "https://example.com/preview.jpg" }),
160
214
  })
161
215
  .optional()
162
216
  .openapi({
@@ -172,7 +226,10 @@ export const CreatePostInputSchema = z.object({
172
226
 
173
227
  export const CreatePostOutputSchema = PostEntitySchema;
174
228
  export const GetPostOutputSchema = PostWithFilesEntitySchema;
175
- export const PostIdSchema = z.object({ postId: z.cuid2() });
229
+ export const PostIdSchema = z.object({
230
+ postId: z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" })
231
+ });
232
+
176
233
  export const MinimalPostSchema = PostEntitySchema.pick({
177
234
  id: true,
178
235
  parentId: true,
@@ -182,120 +239,164 @@ export const MinimalPostSchema = PostEntitySchema.pick({
182
239
  export const PostWithLikesEntitySchema = MinimalPostSchema.extend({
183
240
  likes: z.array(
184
241
  ActivitySchema.extend({
185
- followsYou: z.boolean().optional(),
186
- isFollowing: z.boolean().optional(),
242
+ followsYou: z.boolean().optional().openapi({ example: true }),
243
+ isFollowing: z.boolean().optional().openapi({ example: false }),
187
244
  }),
188
- ),
245
+ ).openapi({ example: [] }),
189
246
  }).openapi({
190
247
  title: "PostWithPostLikesEntity",
191
248
  });
192
249
 
193
250
  export const GetPostWithLikesOutputSchema = PostWithLikesEntitySchema.extend({
194
- nextCursor: z.string().optional().nullable(),
251
+ nextCursor: z.string().optional().nullable().openapi({ example: "ckj1a2b3c0000nxt" }),
195
252
  });
196
253
 
197
254
  export const PostWithCommentsEntitySchema = MinimalPostSchema.extend({
198
- comments: z.array(CommentEntitySchema),
255
+ comments: z.array(CommentEntitySchema).openapi({ example: [] }),
199
256
  }).openapi({
200
257
  title: "PostWithPostCommentsEntity",
201
258
  });
202
259
 
203
260
  export const GetPostWithCommentsOutputSchema =
204
261
  PostWithCommentsEntitySchema.extend({
205
- nextCursor: z.string().optional().nullable(),
262
+ nextCursor: z.string().optional().nullable().openapi({ example: "ckj1a2b3c0000nxt" }),
206
263
  });
207
264
 
208
265
  export const PostWithBookmarksEntitySchema = MinimalPostSchema.extend({
209
- bookmarks: z.array(ActivitySchema),
266
+ bookmarks: z.array(ActivitySchema).openapi({ example: [] }),
210
267
  }).openapi({
211
268
  title: "PostWithPostBookmarksEntity",
212
269
  });
213
270
 
214
271
  export const GetPostWithBookmarksOutputSchema =
215
272
  PostWithBookmarksEntitySchema.extend({
216
- totalNo: z.number().int(),
273
+ totalNo: z.number().int().openapi({ example: 42 }),
217
274
  });
218
275
 
219
276
  export const LinkPreviewInputSchema = z.object({
220
- url: z.string(),
277
+ url: z.url().openapi({ example: "https://example.com/article" }),
221
278
  });
222
279
 
223
280
  export const LinkPreviewOutputSchema = z.object({
224
- title: z.string(),
225
- description: z.string().optional(),
226
- image: z.string().optional(),
227
- url: z.string().optional(),
281
+ title: z.string().openapi({ example: "Great Article" }),
282
+ description: z.string().optional().openapi({ example: "A detailed breakdown of the topic." }),
283
+ image: z.string().optional().openapi({ example: "https://example.com/hero.jpg" }),
284
+ url: z.string().optional().openapi({ example: "https://example.com/article" }),
228
285
  });
229
286
 
230
287
  export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
231
288
  stats: EntityStatsSchema,
232
- score: z.number(),
233
- isLiked: z.boolean().optional(),
234
- isFollowing: z.boolean().optional(),
235
- isBookmarked: z.boolean().optional(),
289
+ score: z.number().openapi({ example: 98.5 }),
290
+ isLiked: z.boolean().optional().openapi({ example: true }),
291
+ isFollowing: z.boolean().optional().openapi({ example: false }),
292
+ isBookmarked: z.boolean().optional().openapi({ example: false }),
236
293
  });
237
294
 
238
295
  export const GetFeedInputSchema = z.object({
239
- limit: z.number().optional(),
240
- cursor: z.string().optional(),
296
+ limit: z.number().int().optional().openapi({ example: 20 }),
297
+ cursor: z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
241
298
  });
242
299
 
243
300
  export const GetFeedOutputSchema = z.object({
244
- feed: z.array(FeedPostEntitySchema),
245
- nextCursor: z.string().optional().nullable(),
301
+ feed: z.array(FeedPostEntitySchema).openapi({ example: [] }),
302
+ nextCursor: z.string().optional().nullable().openapi({ example: "ckj1a2b3c0000nxt" }),
246
303
  });
247
304
 
248
305
  export const SearchPostInputSchema = z.object({
249
306
  queryString: z
250
307
  .string()
251
308
  .min(1, { message: "Search string cannot be empty" })
252
- .max(200, { message: "Search string cannot exceed 200 characters" }),
253
- cursor: z.string().optional(),
309
+ .max(200, { message: "Search string cannot exceed 200 characters" })
310
+ .openapi({ example: "typescript utility types" }),
311
+ cursor: z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
254
312
  });
255
313
 
256
314
  export const SearchPostOutputSchema = z.object({
257
- posts: z.array(FeedPostEntitySchema),
258
- nextCursor: z.string().optional().nullable(),
315
+ posts: z.array(FeedPostEntitySchema).openapi({ example: [] }),
316
+ nextCursor: z.string().optional().nullable().openapi({ example: "ckj1a2b3c0000nxt" }),
259
317
  });
260
318
 
261
319
  export const ReportPostInputSchema = z.object({
262
320
  complaint: z
263
321
  .string()
264
- .max(200, { error: "Complaint cannot be longer than 200 characters" }),
322
+ .max(200, { error: "Complaint cannot be longer than 200 characters" })
323
+ .openapi({ example: "This post contains spam." }),
265
324
  });
266
325
 
267
326
  const AnalyticsChartItemSchema = z.object({
268
- x: z.string(),
269
- y: z.number(),
327
+ x: z.string().openapi({ example: "2026-03-11" }),
328
+ y: z.number().openapi({ example: 150 }),
270
329
  });
271
330
 
272
331
  export const PostAnalyticsOutputSchema = z.object({
273
332
  awareness: z.object({
274
- reach: z.number(),
275
- impressions: z.number(),
276
- visitors: z.number(),
277
- newFollowers: z.number(),
333
+ reach: z.number().openapi({ example: 5000 }),
334
+ impressions: z.number().openapi({ example: 6500 }),
335
+ visitors: z.number().openapi({ example: 1200 }),
336
+ newFollowers: z.number().openapi({ example: 45 }),
278
337
  }),
279
338
  engagement: z.object({
280
- rate: z.number(),
281
- likes: z.number(),
282
- comments: z.number(),
283
- linkCopied: z.number(),
284
- bookmarks: z.number(),
285
- tagsClicked: z.array(AnalyticsChartItemSchema),
286
- platformShares: z.array(AnalyticsChartItemSchema),
339
+ rate: z.number().openapi({ example: 4.2 }),
340
+ likes: z.number().openapi({ example: 210 }),
341
+ comments: z.number().openapi({ example: 34 }),
342
+ linkCopied: z.number().openapi({ example: 12 }),
343
+ bookmarks: z.number().openapi({ example: 56 }),
344
+ tagsClicked: z.array(AnalyticsChartItemSchema).openapi({ example: [{ x: "javascript", y: 25 }] }),
345
+ platformShares: z.array(AnalyticsChartItemSchema).openapi({ example: [{ x: "Twitter", y: 10 }] }),
287
346
  }),
288
347
  behavior: z.object({
289
- viralityScore: z.number(),
290
- frictionRatio: z.number(),
291
- consumptionDepth: z.number(),
348
+ viralityScore: z.number().openapi({ example: 8.5 }),
349
+ frictionRatio: z.number().openapi({ example: 1.2 }),
350
+ consumptionDepth: z.number().openapi({ example: 65.4 }),
292
351
  sentiment: z.object({
293
- positive: z.number(),
294
- negative: z.number(),
295
- score: z.number(),
296
- reports: z.number(),
297
- notInterested: z.number(),
298
- status: z.enum(["Healthy", "Polarizing"]),
352
+ positive: z.number().openapi({ example: 85 }),
353
+ negative: z.number().openapi({ example: 5 }),
354
+ score: z.number().openapi({ example: 9.1 }),
355
+ reports: z.number().openapi({ example: 0 }),
356
+ notInterested: z.number().openapi({ example: 2 }),
357
+ status: z.enum(["Healthy", "Polarizing"]).openapi({ example: "Healthy" }),
299
358
  }),
300
359
  }),
301
360
  });
361
+
362
+
363
+ export const PostSearchDocumentSchema = z.object({
364
+ id: z.cuid2().openapi({ example: "ckj1a2b3c0000doc" }),
365
+ userId: z.cuid2().openapi({ example: "ckj1a2b3c0000usr" }),
366
+ parentId: z.cuid2().nullable().openapi({ example: "ckj1a2b3c0000prt" }),
367
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({ example: "POST" }),
368
+ creatorUsername: z.string().nullable().openapi({ example: "tech_lead" }),
369
+ creatorFullName: z.string().nullable().openapi({ example: "Alex Smith" }),
370
+ creatorImageUrl: z.cuid2().nullable().openapi({ example: "clm1a2b3c0000pic" }),
371
+ tagIds: z.array(z.number()).openapi({ example: [101, 102] }),
372
+ tagNames: z.array(z.string()).openapi({ example: ["react", "typescript"] }),
373
+ badge: z.enum(POST_BADGE_TYPES).nullable().openapi({ example: "TRENDING" }),
374
+ postType: z.enum(POST_TYPES).openapi({ example: "PROJECT" }),
375
+ content: z.string().nullable().openapi({ example: "Here is my latest open source tool." }),
376
+ linkTitle: z.string().nullable().openapi({ example: "GitHub Repo" }),
377
+ linkDescription: z.string().nullable().openapi({ example: "A fast, modern build system." }),
378
+ linkUrl: z.url().nullable().openapi({ example: "https://github.com/project" }),
379
+ linkImage: z.url().nullable().openapi({ example: "https://github.com/image.png" }),
380
+ postFiles: z
381
+ .array(
382
+ PostFileEntitySchema.extend({
383
+ url: z.url().openapi({ example: "https://cdn.example.com/file1.png" }),
384
+ }),
385
+ )
386
+ .nullable()
387
+ .openapi({
388
+ example: [
389
+ {
390
+ id: "cxy1a2b3c0000qwe",
391
+ postId: "ckj1a2b3c0000doc",
392
+ fileId: "cvb1a2b3c0000rty",
393
+ order: 1,
394
+ url: "https://cdn.example.com/file1.png",
395
+ },
396
+ ],
397
+ }),
398
+ createdAt: z.string().nullable().openapi({ example: "2026-03-11T14:43:09.000Z" }),
399
+ }).openapi({
400
+ title: "Post Search Document",
401
+ description: "Flattened schema used for indexing posts in search engines.",
402
+ });