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