@zyacreatives/shared 2.5.52 → 2.5.55

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.
Files changed (114) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/schemas/activity.d.ts +1 -0
  4. package/dist/schemas/auth.d.ts +2 -0
  5. package/dist/schemas/bookmark.d.ts +62 -7
  6. package/dist/schemas/bookmark.js +32 -30
  7. package/dist/schemas/brand.d.ts +3 -3
  8. package/dist/schemas/chat.d.ts +96 -52
  9. package/dist/schemas/chat.js +44 -18
  10. package/dist/schemas/comment.d.ts +65 -21
  11. package/dist/schemas/comment.js +48 -54
  12. package/dist/schemas/common.d.ts +15 -11
  13. package/dist/schemas/creative.d.ts +21 -21
  14. package/dist/schemas/creative.js +3 -3
  15. package/dist/schemas/discipline.d.ts +63 -12
  16. package/dist/schemas/discipline.js +62 -65
  17. package/dist/schemas/entity-stats.d.ts +35 -3
  18. package/dist/schemas/entity-stats.js +24 -38
  19. package/dist/schemas/feed.d.ts +50 -3
  20. package/dist/schemas/feed.js +43 -13
  21. package/dist/schemas/file.d.ts +65 -24
  22. package/dist/schemas/file.js +60 -49
  23. package/dist/schemas/index.d.ts +1 -0
  24. package/dist/schemas/index.js +1 -0
  25. package/dist/schemas/investor-shortlist.d.ts +68 -11
  26. package/dist/schemas/investor-shortlist.js +46 -24
  27. package/dist/schemas/investor-signal.d.ts +52 -12
  28. package/dist/schemas/investor-signal.js +59 -39
  29. package/dist/schemas/investor.d.ts +3 -3
  30. package/dist/schemas/job-application.d.ts +291 -279
  31. package/dist/schemas/job-application.js +59 -95
  32. package/dist/schemas/job.d.ts +200 -659
  33. package/dist/schemas/job.js +98 -231
  34. package/dist/schemas/like.d.ts +3 -0
  35. package/dist/schemas/message.d.ts +125 -94
  36. package/dist/schemas/message.js +54 -55
  37. package/dist/schemas/notification.d.ts +99 -32
  38. package/dist/schemas/notification.js +46 -42
  39. package/dist/schemas/payout-method.d.ts +51 -31
  40. package/dist/schemas/payout-method.js +48 -58
  41. package/dist/schemas/post.d.ts +295 -204
  42. package/dist/schemas/post.js +148 -272
  43. package/dist/schemas/product.d.ts +308 -229
  44. package/dist/schemas/product.js +111 -94
  45. package/dist/schemas/project.d.ts +75 -107
  46. package/dist/schemas/project.js +1 -5
  47. package/dist/schemas/seller.d.ts +10 -10
  48. package/dist/schemas/user-strike.d.ts +3 -0
  49. package/dist/schemas/user.d.ts +128 -126
  50. package/dist/schemas/user.js +10 -1
  51. package/dist/schemas/username.d.ts +1 -0
  52. package/dist/schemas/view.d.ts +1 -0
  53. package/dist/types/activity.d.ts +1 -3
  54. package/dist/types/auth.d.ts +1 -4
  55. package/dist/types/bookmark.d.ts +1 -3
  56. package/dist/types/chat.d.ts +1 -11
  57. package/dist/types/comment.d.ts +1 -5
  58. package/dist/types/common.d.ts +2 -8
  59. package/dist/types/discipline.d.ts +1 -11
  60. package/dist/types/entity-stats.d.ts +1 -3
  61. package/dist/types/feed.d.ts +1 -5
  62. package/dist/types/investor-shortlist.d.ts +1 -6
  63. package/dist/types/investor-signal.d.ts +1 -7
  64. package/dist/types/like.d.ts +1 -3
  65. package/dist/types/message.d.ts +1 -9
  66. package/dist/types/notification.d.ts +1 -9
  67. package/dist/types/user-strike.d.ts +1 -5
  68. package/dist/types/username.d.ts +1 -3
  69. package/package.json +1 -1
  70. package/src/index.ts +4 -5
  71. package/src/schemas/activity.ts +5 -4
  72. package/src/schemas/auth.ts +14 -10
  73. package/src/schemas/bookmark.ts +48 -29
  74. package/src/schemas/chat.ts +79 -18
  75. package/src/schemas/comment.ts +63 -49
  76. package/src/schemas/common.ts +8 -3
  77. package/src/schemas/creative.ts +3 -3
  78. package/src/schemas/discipline.ts +103 -71
  79. package/src/schemas/entity-stats.ts +32 -38
  80. package/src/schemas/feed.ts +62 -15
  81. package/src/schemas/file.ts +85 -58
  82. package/src/schemas/index.ts +1 -0
  83. package/src/schemas/investor-shortlist.ts +57 -8
  84. package/src/schemas/investor-signal.ts +79 -27
  85. package/src/schemas/job-application.ts +81 -115
  86. package/src/schemas/job.ts +160 -301
  87. package/src/schemas/like.ts +5 -1
  88. package/src/schemas/message.ts +71 -64
  89. package/src/schemas/notification.ts +63 -51
  90. package/src/schemas/payout-method.ts +47 -63
  91. package/src/schemas/post.ts +211 -272
  92. package/src/schemas/product.ts +202 -139
  93. package/src/schemas/project.ts +7 -10
  94. package/src/schemas/user-strike.ts +7 -1
  95. package/src/schemas/user.ts +17 -5
  96. package/src/schemas/username.ts +5 -3
  97. package/src/schemas/view.ts +0 -50
  98. package/src/types/activity.ts +0 -4
  99. package/src/types/auth.ts +0 -5
  100. package/src/types/bookmark.ts +0 -4
  101. package/src/types/chat.ts +0 -31
  102. package/src/types/comment.ts +0 -12
  103. package/src/types/common.ts +0 -14
  104. package/src/types/discipline.ts +0 -32
  105. package/src/types/entity-stats.ts +0 -4
  106. package/src/types/feed.ts +0 -10
  107. package/src/types/index.ts +0 -16
  108. package/src/types/investor-shortlist.ts +0 -18
  109. package/src/types/investor-signal.ts +0 -26
  110. package/src/types/like.ts +0 -4
  111. package/src/types/message.ts +0 -26
  112. package/src/types/notification.ts +0 -34
  113. package/src/types/user-strike.ts +0 -10
  114. package/src/types/username.ts +0 -4
@@ -1,354 +1,293 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+
2
3
  import {
3
4
  ACTIVITY_PARENT_TYPES,
4
5
  POST_BADGE_TYPES,
5
6
  POST_TYPES,
6
7
  } from "../constants";
8
+
7
9
  import { FileEntitySchema, CreateFileInputSchema } from "./file";
8
- import { EntityStatsSchema } from "./entity-stats";
10
+ import { EntityStatsEntitySchema } from "./entity-stats";
9
11
  import { cleanHtml } from "../utils/clean-html";
10
12
 
11
- export const PostEntitySchema = z.object({
12
- id: z
13
- .cuid2()
14
- .openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
15
- parentId: z
16
- .cuid2()
17
- .optional()
18
- .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
19
- parentType: z
20
- .enum(ACTIVITY_PARENT_TYPES)
21
- .default(ACTIVITY_PARENT_TYPES.POST)
22
- .openapi({ example: "POST" }),
23
- tags: z
24
- .array(
25
- z.object({
26
- name: z.string().openapi({ example: "javascript" }),
27
- id: z.int().openapi({ example: 101 }),
28
- }),
29
- )
30
- .optional()
31
- .openapi({ example: [{ name: "javascript", id: 101 }] }),
32
- mentions: z
33
- .array(z.string())
34
- .optional()
35
- .openapi({ example: ["cuid123", "cuid456"] }),
36
- badge: z.enum(POST_BADGE_TYPES).optional().openapi({ example: "FEATURED" }),
37
- userId: z
38
- .cuid2()
39
- .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
40
- creatorUsername: z
41
- .string()
42
- .optional()
43
- .openapi({ description: "Username", example: "dev_guru" }),
44
- creatorFullName: z.string().optional().openapi({ example: "Jane Doe" }),
45
- creatorImageUrl: z
46
- .cuid2()
47
- .optional()
48
- .openapi({ description: "Creator Image ID", example: "clm1a2b3c0000pic" }),
13
+ /**
14
+ * --------------------------------
15
+ * SHARED
16
+ * --------------------------------
17
+ */
18
+
19
+ export const LinkMetaSchema = z.object({
20
+ url: z.url(),
21
+ title: z.string().optional(),
22
+ description: z.string().optional(),
23
+ image: z.url().optional(),
24
+ });
25
+
26
+ export type LinkMeta = z.infer<typeof LinkMetaSchema>;
27
+
28
+ const PostTagSchema = z.object({
29
+ id: z.int(),
30
+ name: z.string(),
31
+ });
32
+
33
+ export type PostTag = z.infer<typeof PostTagSchema>;
34
+
35
+ /**
36
+ * --------------------------------
37
+ * SHAPE
38
+ * --------------------------------
39
+ */
40
+
41
+ const PostShape = z.object({
42
+ parentId: z.cuid2().optional(),
43
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
44
+
49
45
  content: z
50
46
  .string()
51
47
  .optional()
52
48
  .refine(
53
- (val) => {
54
- if (!val) return true;
55
- const plainText = cleanHtml(val, Number.MAX_SAFE_INTEGER);
49
+ (value) => {
50
+ if (!value) return true;
51
+ const plainText = cleanHtml(value, Number.MAX_SAFE_INTEGER);
56
52
  return plainText.length <= 300;
57
53
  },
58
54
  { message: "Post content cannot exceed 300 characters" },
59
- )
60
- .openapi({ example: "Check out my new portfolio update!" }),
61
- postType: z.enum(POST_TYPES).openapi({
62
- description: "Type of the post entity",
63
- title: "Post Type",
64
- example: "PROJECT",
65
- }),
66
- createdAt: z.coerce
67
- .date()
68
- .optional()
69
- .openapi({ example: "2026-03-11T14:43:09Z" }),
70
- linkMeta: z
71
- .object({
72
- url: z.url().openapi({ example: "https://example.com" }),
73
- title: z.string().optional().openapi({ example: "Example Website" }),
74
- description: z
75
- .string()
76
- .optional()
77
- .openapi({ example: "This is an example link" }),
78
- image: z
79
- .url()
80
- .optional()
81
- .openapi({ example: "https://example.com/preview.jpg" }),
82
- })
83
- .optional()
84
- .openapi({
85
- description: "Optional metadata for a single link in the post",
86
- }),
55
+ ),
56
+
57
+ postType: z.enum(POST_TYPES).default("DEFAULT_POST"),
58
+ badge: z.enum(POST_BADGE_TYPES).optional(),
59
+ mentions: z.array(z.cuid2()).max(15).optional(),
60
+ linkMeta: LinkMetaSchema.optional(),
87
61
  });
62
+
63
+ export type PostShapeType = z.infer<typeof PostShape>;
64
+
65
+ /**
66
+ * --------------------------------
67
+ * BASE ENTITY
68
+ * --------------------------------
69
+ */
70
+
71
+ export const PostEntitySchema = z
72
+ .object({
73
+ id: z.cuid2(),
74
+ userId: z.cuid2(),
75
+
76
+ ...PostShape.shape,
77
+
78
+ tags: z.array(PostTagSchema).optional(),
79
+
80
+ creatorUsername: z.string().optional(),
81
+ creatorFullName: z.string().optional(),
82
+ creatorImageUrl: z.string().optional(),
83
+
84
+ createdAt: z.iso.datetime(),
85
+ })
86
+ .openapi("Post");
87
+
88
88
  export type PostEntity = z.infer<typeof PostEntitySchema>;
89
89
 
90
+ /**
91
+ * --------------------------------
92
+ * DERIVED ENTITIES
93
+ * --------------------------------
94
+ */
95
+
90
96
  export const PostWithFilesEntitySchema = PostEntitySchema.extend({
91
- files: z
92
- .array(FileEntitySchema)
93
- .optional()
94
- .openapi({ description: "Files attached to the post", example: [] }),
95
- });
97
+ files: z.array(FileEntitySchema).optional(),
98
+ }).openapi("PostWithFiles");
99
+
96
100
  export type PostWithFilesEntity = z.infer<typeof PostWithFilesEntitySchema>;
97
101
 
98
102
  export const MinimalPostSchema = PostEntitySchema.pick({
99
103
  id: true,
100
104
  parentId: true,
101
105
  content: true,
102
- });
106
+ }).openapi("MinimalPost");
107
+
108
+ export type MinimalPost = z.infer<typeof MinimalPostSchema>;
103
109
 
104
110
  export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
105
- stats: EntityStatsSchema,
106
- score: z.number().openapi({ example: 98.5 }),
107
- isLiked: z.boolean().optional().openapi({ example: true }),
108
- isFollowing: z.boolean().optional().openapi({ example: false }),
109
- isBookmarked: z.boolean().optional().openapi({ example: false }),
110
- });
111
+ stats: EntityStatsEntitySchema,
112
+ score: z.number(),
113
+ isLiked: z.boolean().optional(),
114
+ isFollowing: z.boolean().optional(),
115
+ isBookmarked: z.boolean().optional(),
116
+ }).openapi("FeedPost");
117
+
111
118
  export type FeedPostEntity = z.infer<typeof FeedPostEntitySchema>;
112
119
 
113
- export const CreatePostInputSchema = z.object({
114
- id: z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" }),
115
- parentId: z
116
- .cuid2({ message: "Invalid parentId" })
117
- .optional()
118
- .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
119
- parentType: z
120
- .enum(ACTIVITY_PARENT_TYPES)
121
- .default(ACTIVITY_PARENT_TYPES.POST)
122
- .openapi({ example: "POST" }),
123
- content: z
124
- .string()
125
- .max(2000, { message: "Post content cannot exceed 2000 characters" })
126
- .optional()
127
- .openapi({
128
- description: "Post content",
129
- example: "New project announcement",
130
- }),
131
- postType: z
132
- .enum(POST_TYPES)
133
- .default("DEFAULT_POST")
134
- .openapi({ description: "Post type", example: "PROJECT" }),
120
+ /**
121
+ * --------------------------------
122
+ * INPUTS
123
+ * --------------------------------
124
+ */
125
+
126
+ export const CreatePostInputSchema = PostShape.extend({
127
+ content: z.string().max(2000).optional(),
128
+
135
129
  files: z
136
130
  .array(
137
131
  CreateFileInputSchema.extend({
138
- order: z
139
- .number()
140
- .int({ message: "File order must be an integer" })
141
- .max(5, { message: "File order cannot exceed 5" })
142
- .default(1)
143
- .openapi({ example: 1 }),
144
- isThumbnail: z.boolean().optional().openapi({ example: false }),
132
+ order: z.number().int().max(5).default(1),
133
+ isThumbnail: z.boolean().optional(),
145
134
  }),
146
135
  )
147
- .max(5, { message: "Cannot attach more than 5 files" })
148
- .optional()
149
- .openapi({
150
- example: [
151
- {
152
- key: "uploads/img.png",
153
- mimeType: "image/png",
154
- order: 1,
155
- isThumbnail: false,
156
- },
157
- ],
158
- }),
159
- tags: z
160
- .array(z.string().min(1, { message: "Tag cannot be empty" }))
161
- .max(3, { message: "Cannot add more than 3 tags" })
162
- .optional()
163
- .openapi({ example: ["react", "frontend"] }),
164
- mentions: z
165
- .array(z.cuid2())
166
- .max(15, { message: "Cannot mention more than 15 users" })
167
- .optional()
168
- .openapi({ example: ["cuid123"] }),
169
- badge: z.enum(POST_BADGE_TYPES).optional().openapi({ example: "TRENDING" }),
170
- linkMeta: z
171
- .object({
172
- url: z
173
- .url({ message: "Invalid URL format" })
174
- .openapi({ example: "https://example.com" }),
175
- title: z
176
- .string()
177
- .max(200, { message: "Title cannot exceed 200 characters" })
178
- .optional()
179
- .openapi({ example: "Example Website" }),
180
- description: z
181
- .string()
182
- .max(500, { message: "Description cannot exceed 500 characters" })
183
- .optional()
184
- .openapi({ example: "This is an example link" }),
185
- image: z
186
- .string({ message: "" })
187
- .optional()
188
- .openapi({ example: "https://example.com/preview.jpg" }),
189
- })
190
- .optional()
191
- .openapi({
192
- description: "Optional metadata for a single link in the post",
193
- }),
136
+ .max(5)
137
+ .optional(),
138
+
139
+ tags: z.array(z.string().min(1)).max(3).optional(),
194
140
  });
141
+
195
142
  export type CreatePostInput = z.infer<typeof CreatePostInputSchema>;
196
143
 
197
- export const PostIdSchema = z.object({
198
- postId: z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" }),
144
+ export const PostIdInputSchema = z.object({
145
+ postId: z.cuid2(),
199
146
  });
200
- export type PostIdInput = z.infer<typeof PostIdSchema>;
147
+
148
+ export type PostIdInput = z.infer<typeof PostIdInputSchema>;
149
+
201
150
  export const LinkPreviewInputSchema = z.object({
202
- url: z.url().openapi({ example: "https://example.com/article" }),
151
+ url: z.url(),
203
152
  });
153
+
204
154
  export type LinkPreviewInput = z.infer<typeof LinkPreviewInputSchema>;
155
+
205
156
  export const ReportPostInputSchema = z.object({
206
- complaint: z
207
- .string()
208
- .max(200, { error: "Complaint cannot be longer than 200 characters" })
209
- .openapi({ example: "This post contains spam." }),
157
+ complaint: z.string().max(200),
210
158
  });
159
+
211
160
  export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
161
+
212
162
  export const GetFeedInputSchema = z.object({
213
- limit: z.number().int().optional().openapi({ example: 20 }),
214
- cursor: z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
163
+ limit: z.coerce.number().int().min(1).max(100).default(20),
164
+ cursor: z.string().optional(),
215
165
  });
166
+
216
167
  export type GetFeedInput = z.infer<typeof GetFeedInputSchema>;
168
+
217
169
  export const SearchPostInputSchema = z.object({
218
- queryString: z
219
- .string()
220
- .min(1, { message: "Search string cannot be empty" })
221
- .max(200, { message: "Search string cannot exceed 200 characters" })
222
- .openapi({ example: "typescript utility types" }),
223
- cursor: z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
170
+ queryString: z.string().min(1).max(200),
171
+ cursor: z.string().optional(),
224
172
  });
173
+
225
174
  export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
226
175
 
176
+ /**
177
+ * --------------------------------
178
+ * OUTPUTS
179
+ * --------------------------------
180
+ */
181
+
227
182
  export const CreatePostOutputSchema = PostEntitySchema;
183
+
228
184
  export type CreatePostOutput = z.infer<typeof CreatePostOutputSchema>;
185
+
229
186
  export const GetPostOutputSchema = PostWithFilesEntitySchema;
187
+
230
188
  export type GetPostOutput = z.infer<typeof GetPostOutputSchema>;
231
- export const LinkPreviewOutputSchema = z.object({
232
- title: z.string().openapi({ example: "Great Article" }),
233
- description: z
234
- .string()
235
- .optional()
236
- .openapi({ example: "A detailed breakdown of the topic." }),
237
- image: z
238
- .string()
239
- .optional()
240
- .openapi({ example: "https://example.com/hero.jpg" }),
241
- url: z
242
- .string()
243
- .optional()
244
- .openapi({ example: "https://example.com/article" }),
245
- });
189
+
190
+ export const LinkPreviewOutputSchema = LinkMetaSchema;
191
+
246
192
  export type LinkPreviewOutput = z.infer<typeof LinkPreviewOutputSchema>;
193
+
247
194
  export const GetFeedOutputSchema = z.object({
248
- feed: z.array(FeedPostEntitySchema).openapi({ example: [] }),
249
- nextCursor: z
250
- .string()
251
- .optional()
252
- .nullable()
253
- .openapi({ example: "ckj1a2b3c0000nxt" }),
195
+ feed: z.array(FeedPostEntitySchema),
196
+ nextCursor: z.string().optional(),
254
197
  });
198
+
255
199
  export type GetFeedOutput = z.infer<typeof GetFeedOutputSchema>;
200
+
256
201
  export const SearchPostOutputSchema = z.object({
257
- posts: z.array(FeedPostEntitySchema).openapi({ example: [] }),
258
- nextCursor: z
259
- .string()
260
- .optional()
261
- .nullable()
262
- .openapi({ example: "ckj1a2b3c0000nxt" }),
202
+ posts: z.array(FeedPostEntitySchema),
203
+ nextCursor: z.string().optional(),
263
204
  });
205
+
264
206
  export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
265
207
 
208
+ /**
209
+ * --------------------------------
210
+ * ANALYTICS
211
+ * --------------------------------
212
+ */
213
+
266
214
  const AnalyticsChartItemSchema = z.object({
267
- x: z.string().openapi({ example: "2026-03-11" }),
268
- y: z.number().openapi({ example: 150 }),
215
+ x: z.string(),
216
+ y: z.number(),
269
217
  });
218
+
270
219
  export const PostAnalyticsOutputSchema = z.object({
271
220
  awareness: z.object({
272
- reach: z.number().openapi({ example: 5000 }),
273
- impressions: z.number().openapi({ example: 6500 }),
274
- visitors: z.number().openapi({ example: 1200 }),
275
- newFollowers: z.number().openapi({ example: 45 }),
221
+ reach: z.number(),
222
+ impressions: z.number(),
223
+ visitors: z.number(),
224
+ newFollowers: z.number(),
276
225
  }),
226
+
277
227
  engagement: z.object({
278
- rate: z.number().openapi({ example: 4.2 }),
279
- likes: z.number().openapi({ example: 210 }),
280
- comments: z.number().openapi({ example: 34 }),
281
- linkCopied: z.number().openapi({ example: 12 }),
282
- bookmarks: z.number().openapi({ example: 56 }),
283
- tagsClicked: z
284
- .array(AnalyticsChartItemSchema)
285
- .openapi({ example: [{ x: "javascript", y: 25 }] }),
286
- platformShares: z
287
- .array(AnalyticsChartItemSchema)
288
- .openapi({ example: [{ x: "Twitter", y: 10 }] }),
228
+ rate: z.number(),
229
+ likes: z.number(),
230
+ comments: z.number(),
231
+ linkCopied: z.number(),
232
+ bookmarks: z.number(),
233
+ tagsClicked: z.array(AnalyticsChartItemSchema),
234
+ platformShares: z.array(AnalyticsChartItemSchema),
289
235
  }),
236
+
290
237
  behavior: z.object({
291
- viralityScore: z.number().openapi({ example: 8.5 }),
292
- frictionRatio: z.number().openapi({ example: 1.2 }),
293
- consumptionDepth: z.number().openapi({ example: 65.4 }),
238
+ viralityScore: z.number(),
239
+ frictionRatio: z.number(),
240
+ consumptionDepth: z.number(),
294
241
  sentiment: z.object({
295
- positive: z.number().openapi({ example: 85 }),
296
- negative: z.number().openapi({ example: 5 }),
297
- score: z.number().openapi({ example: 9.1 }),
298
- reports: z.number().openapi({ example: 0 }),
299
- notInterested: z.number().openapi({ example: 2 }),
300
- status: z.enum(["Healthy", "Polarizing"]).openapi({ example: "Healthy" }),
242
+ positive: z.number(),
243
+ negative: z.number(),
244
+ score: z.number(),
245
+ reports: z.number(),
246
+ notInterested: z.number(),
247
+ status: z.enum(["Healthy", "Polarizing"]),
301
248
  }),
302
249
  }),
303
250
  });
251
+
304
252
  export type PostAnalyticsOutput = z.infer<typeof PostAnalyticsOutputSchema>;
305
253
 
254
+ /**
255
+ * --------------------------------
256
+ * SEARCH DOCUMENT
257
+ * --------------------------------
258
+ */
259
+
306
260
  export const PostSearchDocumentSchema = z
307
261
  .object({
308
- id: z.cuid2().openapi({ example: "ckj1a2b3c0000doc" }),
309
- userId: z.cuid2().openapi({ example: "ckj1a2b3c0000usr" }),
310
- parentId: z.cuid2().nullable().openapi({ example: "ckj1a2b3c0000prt" }),
311
- parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({ example: "POST" }),
312
- creatorUsername: z.string().nullable().openapi({ example: "tech_lead" }),
313
- creatorFullName: z.string().nullable().openapi({ example: "Alex Smith" }),
314
- creatorImageUrl: z
315
- .cuid2()
316
- .nullable()
317
- .openapi({ example: "clm1a2b3c0000pic" }),
318
- tagIds: z.array(z.number()).openapi({ example: [101, 102] }),
319
- tagNames: z.array(z.string()).openapi({ example: ["react", "typescript"] }),
320
- badge: z.enum(POST_BADGE_TYPES).nullable().openapi({ example: "TRENDING" }),
321
- postType: z.enum(POST_TYPES).openapi({ example: "PROJECT" }),
322
- content: z
323
- .string()
324
- .nullable()
325
- .openapi({ example: "Here is my latest open source tool." }),
326
- linkTitle: z.string().nullable().openapi({ example: "GitHub Repo" }),
327
- linkDescription: z
328
- .string()
329
- .nullable()
330
- .openapi({ example: "A fast, modern build system." }),
331
- linkUrl: z
332
- .url()
333
- .nullable()
334
- .openapi({ example: "https://github.com/project" }),
335
- linkImage: z
336
- .url()
337
- .nullable()
338
- .openapi({ example: "https://github.com/image.png" }),
339
- files: z.array(FileEntitySchema).nullable().openapi({ example: [] }),
340
- mentions: z
341
- .array(z.cuid2())
342
- .max(15, { message: "Cannot mention more than 15 users" })
343
- .optional()
344
- .openapi({ example: ["cuid123"] }),
345
- createdAt: z
346
- .string()
347
- .nullable()
348
- .openapi({ example: "2026-03-11T14:43:09.000Z" }),
262
+ id: z.cuid2(),
263
+ userId: z.cuid2(),
264
+
265
+ parentId: z.cuid2().nullable(),
266
+ parentType: z.enum(ACTIVITY_PARENT_TYPES),
267
+
268
+ creatorUsername: z.string().nullable(),
269
+ creatorFullName: z.string().nullable(),
270
+ creatorImageUrl: z.string().nullable(),
271
+
272
+ tagIds: z.array(z.number()),
273
+ tagNames: z.array(z.string()),
274
+
275
+ badge: z.enum(POST_BADGE_TYPES).nullable(),
276
+ postType: z.enum(POST_TYPES),
277
+
278
+ content: z.string().nullable(),
279
+
280
+ linkTitle: z.string().nullable(),
281
+ linkDescription: z.string().nullable(),
282
+ linkUrl: z.url().nullable(),
283
+ linkImage: z.url().nullable(),
284
+
285
+ files: z.array(FileEntitySchema).nullable(),
286
+
287
+ mentions: z.array(z.cuid2()).max(15).optional(),
288
+
289
+ createdAt: z.iso.datetime().nullable(),
349
290
  })
350
- .openapi({
351
- title: "Post Search Document",
352
- description: "Flattened schema used for indexing posts in search engines.",
353
- });
291
+ .openapi("PostSearchDocument");
292
+
354
293
  export type PostSearchDocument = z.infer<typeof PostSearchDocumentSchema>;