@zyacreatives/shared 2.5.54 → 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.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/schemas/activity.d.ts +1 -0
- package/dist/schemas/auth.d.ts +2 -0
- package/dist/schemas/bookmark.d.ts +62 -7
- package/dist/schemas/bookmark.js +32 -30
- package/dist/schemas/brand.d.ts +3 -3
- package/dist/schemas/chat.d.ts +96 -52
- package/dist/schemas/chat.js +44 -18
- package/dist/schemas/comment.d.ts +65 -21
- package/dist/schemas/comment.js +48 -54
- package/dist/schemas/common.d.ts +15 -11
- package/dist/schemas/creative.d.ts +3 -3
- package/dist/schemas/discipline.d.ts +63 -12
- package/dist/schemas/discipline.js +62 -65
- package/dist/schemas/entity-stats.d.ts +35 -3
- package/dist/schemas/entity-stats.js +24 -38
- package/dist/schemas/feed.d.ts +50 -3
- package/dist/schemas/feed.js +43 -13
- package/dist/schemas/file.d.ts +65 -24
- package/dist/schemas/file.js +60 -49
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/investor-shortlist.d.ts +68 -11
- package/dist/schemas/investor-shortlist.js +46 -24
- package/dist/schemas/investor-signal.d.ts +52 -12
- package/dist/schemas/investor-signal.js +59 -39
- package/dist/schemas/investor.d.ts +3 -3
- package/dist/schemas/job-application.d.ts +291 -279
- package/dist/schemas/job-application.js +59 -95
- package/dist/schemas/job.d.ts +200 -659
- package/dist/schemas/job.js +98 -231
- package/dist/schemas/like.d.ts +3 -0
- package/dist/schemas/message.d.ts +125 -94
- package/dist/schemas/message.js +54 -55
- package/dist/schemas/notification.d.ts +99 -32
- package/dist/schemas/notification.js +46 -42
- package/dist/schemas/payout-method.d.ts +51 -31
- package/dist/schemas/payout-method.js +48 -58
- package/dist/schemas/post.d.ts +295 -204
- package/dist/schemas/post.js +148 -272
- package/dist/schemas/product.d.ts +308 -229
- package/dist/schemas/product.js +111 -94
- package/dist/schemas/project.d.ts +75 -107
- package/dist/schemas/project.js +1 -5
- package/dist/schemas/seller.d.ts +10 -10
- package/dist/schemas/user-strike.d.ts +3 -0
- package/dist/schemas/user.d.ts +114 -123
- package/dist/schemas/username.d.ts +1 -0
- package/dist/schemas/view.d.ts +1 -0
- package/dist/types/activity.d.ts +1 -3
- package/dist/types/auth.d.ts +1 -4
- package/dist/types/bookmark.d.ts +1 -3
- package/dist/types/chat.d.ts +1 -11
- package/dist/types/comment.d.ts +1 -5
- package/dist/types/common.d.ts +2 -8
- package/dist/types/discipline.d.ts +1 -11
- package/dist/types/entity-stats.d.ts +1 -3
- package/dist/types/feed.d.ts +1 -5
- package/dist/types/investor-shortlist.d.ts +1 -6
- package/dist/types/investor-signal.d.ts +1 -7
- package/dist/types/like.d.ts +1 -3
- package/dist/types/message.d.ts +1 -9
- package/dist/types/notification.d.ts +1 -9
- package/dist/types/user-strike.d.ts +1 -5
- package/dist/types/username.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +4 -5
- package/src/schemas/activity.ts +5 -4
- package/src/schemas/auth.ts +14 -10
- package/src/schemas/bookmark.ts +48 -29
- package/src/schemas/chat.ts +79 -18
- package/src/schemas/comment.ts +63 -49
- package/src/schemas/common.ts +8 -3
- package/src/schemas/discipline.ts +103 -71
- package/src/schemas/entity-stats.ts +32 -38
- package/src/schemas/feed.ts +62 -15
- package/src/schemas/file.ts +85 -58
- package/src/schemas/index.ts +1 -0
- package/src/schemas/investor-shortlist.ts +57 -8
- package/src/schemas/investor-signal.ts +79 -27
- package/src/schemas/job-application.ts +81 -115
- package/src/schemas/job.ts +160 -301
- package/src/schemas/like.ts +5 -1
- package/src/schemas/message.ts +71 -64
- package/src/schemas/notification.ts +63 -51
- package/src/schemas/payout-method.ts +47 -63
- package/src/schemas/post.ts +211 -272
- package/src/schemas/product.ts +202 -139
- package/src/schemas/project.ts +7 -10
- package/src/schemas/user-strike.ts +7 -1
- package/src/schemas/user.ts +2 -6
- package/src/schemas/username.ts +5 -3
- package/src/schemas/view.ts +0 -50
- package/src/types/activity.ts +0 -4
- package/src/types/auth.ts +0 -5
- package/src/types/bookmark.ts +0 -4
- package/src/types/chat.ts +0 -31
- package/src/types/comment.ts +0 -12
- package/src/types/common.ts +0 -14
- package/src/types/discipline.ts +0 -32
- package/src/types/entity-stats.ts +0 -4
- package/src/types/feed.ts +0 -10
- package/src/types/index.ts +0 -16
- package/src/types/investor-shortlist.ts +0 -18
- package/src/types/investor-signal.ts +0 -26
- package/src/types/like.ts +0 -4
- package/src/types/message.ts +0 -26
- package/src/types/notification.ts +0 -34
- package/src/types/user-strike.ts +0 -10
- package/src/types/username.ts +0 -4
package/src/schemas/post.ts
CHANGED
|
@@ -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 {
|
|
10
|
+
import { EntityStatsEntitySchema } from "./entity-stats";
|
|
9
11
|
import { cleanHtml } from "../utils/clean-html";
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
(
|
|
54
|
-
if (!
|
|
55
|
-
const plainText = cleanHtml(
|
|
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
|
-
|
|
61
|
-
postType: z.enum(POST_TYPES).
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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:
|
|
106
|
-
score: z.number()
|
|
107
|
-
isLiked: z.boolean().optional()
|
|
108
|
-
isFollowing: z.boolean().optional()
|
|
109
|
-
isBookmarked: z.boolean().optional()
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
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
|
|
148
|
-
.optional()
|
|
149
|
-
|
|
150
|
-
|
|
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
|
|
198
|
-
postId: z.cuid2()
|
|
144
|
+
export const PostIdInputSchema = z.object({
|
|
145
|
+
postId: z.cuid2(),
|
|
199
146
|
});
|
|
200
|
-
|
|
147
|
+
|
|
148
|
+
export type PostIdInput = z.infer<typeof PostIdInputSchema>;
|
|
149
|
+
|
|
201
150
|
export const LinkPreviewInputSchema = z.object({
|
|
202
|
-
url: z.url()
|
|
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().
|
|
214
|
-
cursor: z.string().optional()
|
|
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
|
-
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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)
|
|
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)
|
|
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()
|
|
268
|
-
y: z.number()
|
|
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()
|
|
273
|
-
impressions: z.number()
|
|
274
|
-
visitors: z.number()
|
|
275
|
-
newFollowers: z.number()
|
|
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()
|
|
279
|
-
likes: z.number()
|
|
280
|
-
comments: z.number()
|
|
281
|
-
linkCopied: z.number()
|
|
282
|
-
bookmarks: z.number()
|
|
283
|
-
tagsClicked: z
|
|
284
|
-
|
|
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()
|
|
292
|
-
frictionRatio: z.number()
|
|
293
|
-
consumptionDepth: z.number()
|
|
238
|
+
viralityScore: z.number(),
|
|
239
|
+
frictionRatio: z.number(),
|
|
240
|
+
consumptionDepth: z.number(),
|
|
294
241
|
sentiment: z.object({
|
|
295
|
-
positive: z.number()
|
|
296
|
-
negative: z.number()
|
|
297
|
-
score: z.number()
|
|
298
|
-
reports: z.number()
|
|
299
|
-
notInterested: z.number()
|
|
300
|
-
status: z.enum(["Healthy", "Polarizing"])
|
|
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()
|
|
309
|
-
userId: z.cuid2()
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
tagIds: z.array(z.number())
|
|
319
|
-
tagNames: z.array(z.string())
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
linkTitle: z.string().nullable()
|
|
327
|
-
linkDescription: z
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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
|
-
|
|
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>;
|