@zyacreatives/shared 2.5.75 → 2.5.77
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/schemas/investor.d.ts +0 -1
- package/dist/schemas/investor.js +0 -2
- package/dist/schemas/notification.d.ts +730 -0
- package/dist/schemas/notification.js +235 -1
- package/dist/types/notification.d.ts +20 -1
- package/package.json +1 -1
- package/src/schemas/investor.ts +1 -3
- package/src/schemas/notification.ts +313 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotificationCountOutputSchema = exports.ListNotificationsOutputSchema = exports.MarkReadInputSchema = exports.ListNotificationsInputSchema = exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema = void 0;
|
|
3
|
+
exports.NotificationCountOutputSchema = exports.ListNotificationInboxOutputSchema = exports.NotificationMutationOutputSchema = exports.ListNotificationsOutputSchema = exports.BulkNotificationMutationInputSchema = exports.ListNotificationInboxInputSchema = exports.ArchiveNotificationsInputSchema = exports.MarkReadInputSchema = exports.ListNotificationsInputSchema = exports.NotificationInboxItemSchema = exports.NotificationInboxKindSchema = exports.NotificationInboxCategorySchema = exports.NotificationInboxTabSchema = exports.NotificationFeedItemSchema = exports.NotificationPreviewSchema = exports.NotificationActionSchema = exports.NotificationTabSchema = exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const minimal_user_1 = require("./minimal-user");
|
|
@@ -30,6 +30,7 @@ exports.NotificationEntitySchema = zod_openapi_1.z
|
|
|
30
30
|
...NotificationShape.shape,
|
|
31
31
|
isRead: zod_openapi_1.z.boolean().default(false),
|
|
32
32
|
createdAt: zod_openapi_1.z.iso.datetime(),
|
|
33
|
+
archivedAt: zod_openapi_1.z.iso.datetime().optional(),
|
|
33
34
|
deletedAt: zod_openapi_1.z.iso.datetime().optional(),
|
|
34
35
|
})
|
|
35
36
|
.openapi("Notification");
|
|
@@ -41,6 +42,205 @@ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.exten
|
|
|
41
42
|
itemImgUrl: zod_openapi_1.z.string().optional(),
|
|
42
43
|
itemStatus: zod_openapi_1.z.string().optional(),
|
|
43
44
|
});
|
|
45
|
+
exports.NotificationTabSchema = zod_openapi_1.z.enum([
|
|
46
|
+
"all",
|
|
47
|
+
"following",
|
|
48
|
+
"likes",
|
|
49
|
+
"comments",
|
|
50
|
+
"archived",
|
|
51
|
+
]);
|
|
52
|
+
exports.NotificationActionSchema = zod_openapi_1.z.object({
|
|
53
|
+
label: zod_openapi_1.z.string(),
|
|
54
|
+
variant: zod_openapi_1.z.enum(["primary", "secondary", "link"]).default("secondary"),
|
|
55
|
+
href: zod_openapi_1.z.string().optional(),
|
|
56
|
+
action: zod_openapi_1.z
|
|
57
|
+
.enum([
|
|
58
|
+
"open",
|
|
59
|
+
"openConversation",
|
|
60
|
+
"viewApplication",
|
|
61
|
+
"reviewProject",
|
|
62
|
+
"retryVerification",
|
|
63
|
+
"viewProduct",
|
|
64
|
+
"exploreOpportunities",
|
|
65
|
+
])
|
|
66
|
+
.default("open"),
|
|
67
|
+
});
|
|
68
|
+
exports.NotificationPreviewSchema = zod_openapi_1.z.object({
|
|
69
|
+
kind: zod_openapi_1.z.enum(["none", "text", "media", "job", "system"]).default("none"),
|
|
70
|
+
title: zod_openapi_1.z.string().optional(),
|
|
71
|
+
content: zod_openapi_1.z.string().optional(),
|
|
72
|
+
imageUrl: zod_openapi_1.z.string().optional(),
|
|
73
|
+
href: zod_openapi_1.z.string().optional(),
|
|
74
|
+
status: zod_openapi_1.z.string().optional(),
|
|
75
|
+
owner: minimal_user_1.MinimalUserSchema.optional(),
|
|
76
|
+
});
|
|
77
|
+
exports.NotificationFeedItemSchema = zod_openapi_1.z
|
|
78
|
+
.object({
|
|
79
|
+
id: zod_openapi_1.z.string(),
|
|
80
|
+
notificationIds: zod_openapi_1.z.array(zod_openapi_1.z.cuid2()).min(1),
|
|
81
|
+
type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES),
|
|
82
|
+
tab: exports.NotificationTabSchema,
|
|
83
|
+
actor: minimal_user_1.MinimalUserSchema,
|
|
84
|
+
actors: zod_openapi_1.z.array(minimal_user_1.MinimalUserSchema).min(1),
|
|
85
|
+
actorCount: zod_openapi_1.z.int().nonnegative(),
|
|
86
|
+
otherActorCount: zod_openapi_1.z.int().nonnegative(),
|
|
87
|
+
recipientId: zod_openapi_1.z.cuid2(),
|
|
88
|
+
entityId: zod_openapi_1.z.cuid2().optional(),
|
|
89
|
+
parentId: zod_openapi_1.z.cuid2().nullable().optional(),
|
|
90
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).nullable().optional(),
|
|
91
|
+
rootId: zod_openapi_1.z.cuid2(),
|
|
92
|
+
rootType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
|
|
93
|
+
createdAt: zod_openapi_1.z.iso.datetime(),
|
|
94
|
+
archivedAt: zod_openapi_1.z.iso.datetime().optional(),
|
|
95
|
+
isRead: zod_openapi_1.z.boolean(),
|
|
96
|
+
headline: zod_openapi_1.z.string(),
|
|
97
|
+
body: zod_openapi_1.z.string().optional(),
|
|
98
|
+
targetLabel: zod_openapi_1.z.string().optional(),
|
|
99
|
+
targetHref: zod_openapi_1.z.string().optional(),
|
|
100
|
+
preview: exports.NotificationPreviewSchema.optional(),
|
|
101
|
+
actions: zod_openapi_1.z.array(exports.NotificationActionSchema).default([]),
|
|
102
|
+
})
|
|
103
|
+
.openapi("NotificationFeedItem");
|
|
104
|
+
exports.NotificationInboxTabSchema = zod_openapi_1.z.enum([
|
|
105
|
+
"all",
|
|
106
|
+
"following",
|
|
107
|
+
"likes",
|
|
108
|
+
"comments",
|
|
109
|
+
"archived",
|
|
110
|
+
]);
|
|
111
|
+
exports.NotificationInboxCategorySchema = zod_openapi_1.z.enum([
|
|
112
|
+
"following",
|
|
113
|
+
"likes",
|
|
114
|
+
"comments",
|
|
115
|
+
"system",
|
|
116
|
+
"jobs",
|
|
117
|
+
"marketplace",
|
|
118
|
+
]);
|
|
119
|
+
exports.NotificationInboxKindSchema = zod_openapi_1.z.enum([
|
|
120
|
+
"account_verified",
|
|
121
|
+
"account_verification_failed",
|
|
122
|
+
"policy_warning",
|
|
123
|
+
"follow",
|
|
124
|
+
"project_liked",
|
|
125
|
+
"post_liked",
|
|
126
|
+
"comment_liked",
|
|
127
|
+
"project_commented",
|
|
128
|
+
"reply",
|
|
129
|
+
"mention",
|
|
130
|
+
"project_featured",
|
|
131
|
+
"project_tagged",
|
|
132
|
+
"project_draft_reminder",
|
|
133
|
+
"job_application_shortlisted",
|
|
134
|
+
"job_application_rejected",
|
|
135
|
+
"job_application_status",
|
|
136
|
+
"product_approved",
|
|
137
|
+
"marketplace_drop",
|
|
138
|
+
"friend_product_added",
|
|
139
|
+
]);
|
|
140
|
+
exports.NotificationInboxItemSchema = zod_openapi_1.z
|
|
141
|
+
.object({
|
|
142
|
+
id: zod_openapi_1.z.string(),
|
|
143
|
+
kind: exports.NotificationInboxKindSchema,
|
|
144
|
+
tab: exports.NotificationInboxCategorySchema,
|
|
145
|
+
isRead: zod_openapi_1.z.boolean(),
|
|
146
|
+
isArchived: zod_openapi_1.z.boolean(),
|
|
147
|
+
createdAt: zod_openapi_1.z.iso.datetime(),
|
|
148
|
+
actorMode: zod_openapi_1.z.enum(["user", "system", "group"]),
|
|
149
|
+
actors: zod_openapi_1.z.array(zod_openapi_1.z.object({
|
|
150
|
+
id: zod_openapi_1.z.string(),
|
|
151
|
+
name: zod_openapi_1.z.string(),
|
|
152
|
+
username: zod_openapi_1.z.string().optional(),
|
|
153
|
+
image: zod_openapi_1.z.string().optional(),
|
|
154
|
+
role: zod_openapi_1.z.enum(["CREATIVE", "BRAND", "INVESTOR", "ADMIN"]).optional(),
|
|
155
|
+
})),
|
|
156
|
+
actorOverflowCount: zod_openapi_1.z.int().nonnegative().optional(),
|
|
157
|
+
icon: zod_openapi_1.z
|
|
158
|
+
.object({
|
|
159
|
+
name: zod_openapi_1.z.enum([
|
|
160
|
+
"user",
|
|
161
|
+
"heart",
|
|
162
|
+
"bell",
|
|
163
|
+
"briefcase",
|
|
164
|
+
"badge-check",
|
|
165
|
+
"alert",
|
|
166
|
+
"megaphone",
|
|
167
|
+
]),
|
|
168
|
+
intent: zod_openapi_1.z
|
|
169
|
+
.enum(["neutral", "success", "warning", "danger", "primary"])
|
|
170
|
+
.optional(),
|
|
171
|
+
})
|
|
172
|
+
.optional(),
|
|
173
|
+
message: zod_openapi_1.z.object({
|
|
174
|
+
parts: zod_openapi_1.z
|
|
175
|
+
.array(zod_openapi_1.z.object({
|
|
176
|
+
text: zod_openapi_1.z.string(),
|
|
177
|
+
tone: zod_openapi_1.z.enum(["default", "muted", "primary"]).optional(),
|
|
178
|
+
weight: zod_openapi_1.z.enum(["regular", "medium", "semibold"]).optional(),
|
|
179
|
+
href: zod_openapi_1.z.string().optional(),
|
|
180
|
+
}))
|
|
181
|
+
.min(1),
|
|
182
|
+
subtitle: zod_openapi_1.z.string().optional(),
|
|
183
|
+
contextLabel: zod_openapi_1.z.string().optional(),
|
|
184
|
+
quote: zod_openapi_1.z.string().optional(),
|
|
185
|
+
}),
|
|
186
|
+
target: zod_openapi_1.z
|
|
187
|
+
.object({
|
|
188
|
+
href: zod_openapi_1.z.string(),
|
|
189
|
+
entityType: zod_openapi_1.z.enum([
|
|
190
|
+
"USER",
|
|
191
|
+
"PROJECT",
|
|
192
|
+
"POST",
|
|
193
|
+
"COMMENT",
|
|
194
|
+
"JOB",
|
|
195
|
+
"JOB_APPLICATION",
|
|
196
|
+
"PRODUCT",
|
|
197
|
+
"CHAT",
|
|
198
|
+
"SETTINGS",
|
|
199
|
+
]),
|
|
200
|
+
entityId: zod_openapi_1.z.string().optional(),
|
|
201
|
+
})
|
|
202
|
+
.optional(),
|
|
203
|
+
preview: zod_openapi_1.z
|
|
204
|
+
.object({
|
|
205
|
+
type: zod_openapi_1.z.enum(["project", "product", "post", "comment", "job", "image"]),
|
|
206
|
+
title: zod_openapi_1.z.string().optional(),
|
|
207
|
+
subtitle: zod_openapi_1.z.string().optional(),
|
|
208
|
+
body: zod_openapi_1.z.string().optional(),
|
|
209
|
+
imageUrl: zod_openapi_1.z.string().optional(),
|
|
210
|
+
imageAlt: zod_openapi_1.z.string().optional(),
|
|
211
|
+
ownerName: zod_openapi_1.z.string().optional(),
|
|
212
|
+
ownerAvatarUrl: zod_openapi_1.z.string().optional(),
|
|
213
|
+
badge: zod_openapi_1.z.enum(["featured", "locked", "new", "warning"]).optional(),
|
|
214
|
+
href: zod_openapi_1.z.string().optional(),
|
|
215
|
+
})
|
|
216
|
+
.optional(),
|
|
217
|
+
actions: zod_openapi_1.z
|
|
218
|
+
.array(zod_openapi_1.z.object({
|
|
219
|
+
id: zod_openapi_1.z.string(),
|
|
220
|
+
label: zod_openapi_1.z.string(),
|
|
221
|
+
style: zod_openapi_1.z.enum(["primary", "secondary", "link"]),
|
|
222
|
+
href: zod_openapi_1.z.string().optional(),
|
|
223
|
+
mutation: zod_openapi_1.z
|
|
224
|
+
.object({
|
|
225
|
+
method: zod_openapi_1.z.enum(["POST", "PATCH"]),
|
|
226
|
+
endpoint: zod_openapi_1.z.string(),
|
|
227
|
+
body: zod_openapi_1.z.record(zod_openapi_1.z.string(), zod_openapi_1.z.unknown()).optional(),
|
|
228
|
+
})
|
|
229
|
+
.optional(),
|
|
230
|
+
}))
|
|
231
|
+
.optional(),
|
|
232
|
+
menuActions: zod_openapi_1.z
|
|
233
|
+
.array(zod_openapi_1.z.enum([
|
|
234
|
+
"mark_read",
|
|
235
|
+
"mark_unread",
|
|
236
|
+
"archive",
|
|
237
|
+
"unarchive",
|
|
238
|
+
"delete",
|
|
239
|
+
"mute_type",
|
|
240
|
+
]))
|
|
241
|
+
.optional(),
|
|
242
|
+
})
|
|
243
|
+
.openapi("NotificationInboxItem");
|
|
44
244
|
/**
|
|
45
245
|
* --------------------------------
|
|
46
246
|
* INPUTS
|
|
@@ -48,12 +248,26 @@ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.exten
|
|
|
48
248
|
*/
|
|
49
249
|
exports.ListNotificationsInputSchema = zod_openapi_1.z.object({
|
|
50
250
|
type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).optional(),
|
|
251
|
+
tab: exports.NotificationTabSchema.optional().default("all"),
|
|
51
252
|
cursor: zod_openapi_1.z.string().optional(),
|
|
52
253
|
unreadOnly: zod_openapi_1.z.boolean().optional().default(false),
|
|
53
254
|
});
|
|
54
255
|
exports.MarkReadInputSchema = zod_openapi_1.z.object({
|
|
55
256
|
notificationIds: zod_openapi_1.z.array(zod_openapi_1.z.cuid2()).min(1),
|
|
56
257
|
});
|
|
258
|
+
exports.ArchiveNotificationsInputSchema = zod_openapi_1.z.object({
|
|
259
|
+
notificationIds: zod_openapi_1.z.array(zod_openapi_1.z.cuid2()).min(1),
|
|
260
|
+
archived: zod_openapi_1.z.boolean().optional().default(true),
|
|
261
|
+
});
|
|
262
|
+
exports.ListNotificationInboxInputSchema = zod_openapi_1.z.object({
|
|
263
|
+
tab: exports.NotificationInboxTabSchema.optional().default("all"),
|
|
264
|
+
unreadOnly: zod_openapi_1.z.boolean().optional().default(false),
|
|
265
|
+
cursor: zod_openapi_1.z.string().optional(),
|
|
266
|
+
limit: zod_openapi_1.z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
267
|
+
});
|
|
268
|
+
exports.BulkNotificationMutationInputSchema = zod_openapi_1.z.object({
|
|
269
|
+
notificationIds: zod_openapi_1.z.array(zod_openapi_1.z.string()).min(1),
|
|
270
|
+
});
|
|
57
271
|
/**
|
|
58
272
|
* --------------------------------
|
|
59
273
|
* OUTPUTS
|
|
@@ -61,8 +275,28 @@ exports.MarkReadInputSchema = zod_openapi_1.z.object({
|
|
|
61
275
|
*/
|
|
62
276
|
exports.ListNotificationsOutputSchema = zod_openapi_1.z.object({
|
|
63
277
|
notifications: zod_openapi_1.z.array(exports.NotificationDetailsEntitySchema),
|
|
278
|
+
items: zod_openapi_1.z.array(exports.NotificationFeedItemSchema).default([]),
|
|
279
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
280
|
+
unreadCount: zod_openapi_1.z.int(),
|
|
281
|
+
});
|
|
282
|
+
exports.NotificationMutationOutputSchema = zod_openapi_1.z.object({
|
|
283
|
+
success: zod_openapi_1.z.boolean(),
|
|
284
|
+
updatedCount: zod_openapi_1.z.int().optional(),
|
|
285
|
+
deletedCount: zod_openapi_1.z.int().optional(),
|
|
286
|
+
});
|
|
287
|
+
exports.ListNotificationInboxOutputSchema = zod_openapi_1.z.object({
|
|
288
|
+
notifications: zod_openapi_1.z.array(exports.NotificationInboxItemSchema),
|
|
64
289
|
nextCursor: zod_openapi_1.z.string().optional(),
|
|
65
290
|
unreadCount: zod_openapi_1.z.int(),
|
|
291
|
+
tabCounts: zod_openapi_1.z
|
|
292
|
+
.object({
|
|
293
|
+
all: zod_openapi_1.z.int().optional(),
|
|
294
|
+
following: zod_openapi_1.z.int().optional(),
|
|
295
|
+
likes: zod_openapi_1.z.int().optional(),
|
|
296
|
+
comments: zod_openapi_1.z.int().optional(),
|
|
297
|
+
archived: zod_openapi_1.z.int().optional(),
|
|
298
|
+
})
|
|
299
|
+
.optional(),
|
|
66
300
|
});
|
|
67
301
|
exports.NotificationCountOutputSchema = zod_openapi_1.z.object({
|
|
68
302
|
unreadCount: zod_openapi_1.z.int(),
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type {
|
|
2
|
+
ArchiveNotificationsInput,
|
|
3
|
+
BulkNotificationMutationInput,
|
|
4
|
+
ListNotificationInboxInput,
|
|
5
|
+
ListNotificationInboxOutput,
|
|
6
|
+
ListNotificationsInput,
|
|
7
|
+
ListNotificationsOutput,
|
|
8
|
+
MarkReadInput,
|
|
9
|
+
MinimalNotificationEntity,
|
|
10
|
+
NotificationAction,
|
|
11
|
+
NotificationCountOutput,
|
|
12
|
+
NotificationDetailsEntity,
|
|
13
|
+
NotificationEntity,
|
|
14
|
+
NotificationFeedItem,
|
|
15
|
+
NotificationInboxItem,
|
|
16
|
+
NotificationInboxTab,
|
|
17
|
+
NotificationMutationOutput,
|
|
18
|
+
NotificationPreview,
|
|
19
|
+
NotificationTab,
|
|
20
|
+
} from "../schemas/notification";
|
package/package.json
CHANGED
package/src/schemas/investor.ts
CHANGED
|
@@ -116,9 +116,7 @@ export const CreateInvestorProfileInputSchema = InvestorShape.pick({
|
|
|
116
116
|
experienceLevel: true,
|
|
117
117
|
location: true,
|
|
118
118
|
websiteURL: true,
|
|
119
|
-
})
|
|
120
|
-
disciplineSlugs: z.array(z.string()).min(1),
|
|
121
|
-
});
|
|
119
|
+
})
|
|
122
120
|
|
|
123
121
|
export type CreateInvestorInput = z.infer<
|
|
124
122
|
typeof CreateInvestorProfileInputSchema
|
|
@@ -36,6 +36,7 @@ export const NotificationEntitySchema = z
|
|
|
36
36
|
...NotificationShape.shape,
|
|
37
37
|
isRead: z.boolean().default(false),
|
|
38
38
|
createdAt: z.iso.datetime(),
|
|
39
|
+
archivedAt: z.iso.datetime().optional(),
|
|
39
40
|
deletedAt: z.iso.datetime().optional(),
|
|
40
41
|
})
|
|
41
42
|
.openapi("Notification");
|
|
@@ -55,14 +56,253 @@ export type NotificationDetailsEntity = z.infer<
|
|
|
55
56
|
typeof NotificationDetailsEntitySchema
|
|
56
57
|
>;
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
export const NotificationTabSchema = z.enum([
|
|
60
|
+
"all",
|
|
61
|
+
"following",
|
|
62
|
+
"likes",
|
|
63
|
+
"comments",
|
|
64
|
+
"archived",
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
export type NotificationTab = z.infer<typeof NotificationTabSchema>;
|
|
68
|
+
|
|
69
|
+
export const NotificationActionSchema = z.object({
|
|
70
|
+
label: z.string(),
|
|
71
|
+
variant: z.enum(["primary", "secondary", "link"]).default("secondary"),
|
|
72
|
+
href: z.string().optional(),
|
|
73
|
+
action: z
|
|
74
|
+
.enum([
|
|
75
|
+
"open",
|
|
76
|
+
"openConversation",
|
|
77
|
+
"viewApplication",
|
|
78
|
+
"reviewProject",
|
|
79
|
+
"retryVerification",
|
|
80
|
+
"viewProduct",
|
|
81
|
+
"exploreOpportunities",
|
|
82
|
+
])
|
|
83
|
+
.default("open"),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export type NotificationAction = z.infer<typeof NotificationActionSchema>;
|
|
87
|
+
|
|
88
|
+
export const NotificationPreviewSchema = z.object({
|
|
89
|
+
kind: z.enum(["none", "text", "media", "job", "system"]).default("none"),
|
|
90
|
+
title: z.string().optional(),
|
|
91
|
+
content: z.string().optional(),
|
|
92
|
+
imageUrl: z.string().optional(),
|
|
93
|
+
href: z.string().optional(),
|
|
94
|
+
status: z.string().optional(),
|
|
95
|
+
owner: MinimalUserSchema.optional(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export type NotificationPreview = z.infer<typeof NotificationPreviewSchema>;
|
|
99
|
+
|
|
100
|
+
export const NotificationFeedItemSchema = z
|
|
101
|
+
.object({
|
|
102
|
+
id: z.string(),
|
|
103
|
+
notificationIds: z.array(z.cuid2()).min(1),
|
|
104
|
+
type: z.enum(NOTIFICATION_TYPES),
|
|
105
|
+
tab: NotificationTabSchema,
|
|
106
|
+
actor: MinimalUserSchema,
|
|
107
|
+
actors: z.array(MinimalUserSchema).min(1),
|
|
108
|
+
actorCount: z.int().nonnegative(),
|
|
109
|
+
otherActorCount: z.int().nonnegative(),
|
|
110
|
+
recipientId: z.cuid2(),
|
|
111
|
+
entityId: z.cuid2().optional(),
|
|
112
|
+
parentId: z.cuid2().nullable().optional(),
|
|
113
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).nullable().optional(),
|
|
114
|
+
rootId: z.cuid2(),
|
|
115
|
+
rootType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
116
|
+
createdAt: z.iso.datetime(),
|
|
117
|
+
archivedAt: z.iso.datetime().optional(),
|
|
118
|
+
isRead: z.boolean(),
|
|
119
|
+
headline: z.string(),
|
|
120
|
+
body: z.string().optional(),
|
|
121
|
+
targetLabel: z.string().optional(),
|
|
122
|
+
targetHref: z.string().optional(),
|
|
123
|
+
preview: NotificationPreviewSchema.optional(),
|
|
124
|
+
actions: z.array(NotificationActionSchema).default([]),
|
|
125
|
+
})
|
|
126
|
+
.openapi("NotificationFeedItem");
|
|
127
|
+
|
|
128
|
+
export type NotificationFeedItem = z.infer<typeof NotificationFeedItemSchema>;
|
|
129
|
+
|
|
130
|
+
export const NotificationInboxTabSchema = z.enum([
|
|
131
|
+
"all",
|
|
132
|
+
"following",
|
|
133
|
+
"likes",
|
|
134
|
+
"comments",
|
|
135
|
+
"archived",
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
export type NotificationInboxTab = z.infer<
|
|
139
|
+
typeof NotificationInboxTabSchema
|
|
140
|
+
>;
|
|
141
|
+
|
|
142
|
+
export const NotificationInboxCategorySchema = z.enum([
|
|
143
|
+
"following",
|
|
144
|
+
"likes",
|
|
145
|
+
"comments",
|
|
146
|
+
"system",
|
|
147
|
+
"jobs",
|
|
148
|
+
"marketplace",
|
|
149
|
+
]);
|
|
150
|
+
|
|
151
|
+
export const NotificationInboxKindSchema = z.enum([
|
|
152
|
+
"account_verified",
|
|
153
|
+
"account_verification_failed",
|
|
154
|
+
"policy_warning",
|
|
155
|
+
"follow",
|
|
156
|
+
"project_liked",
|
|
157
|
+
"post_liked",
|
|
158
|
+
"comment_liked",
|
|
159
|
+
"project_commented",
|
|
160
|
+
"reply",
|
|
161
|
+
"mention",
|
|
162
|
+
"project_featured",
|
|
163
|
+
"project_tagged",
|
|
164
|
+
"project_draft_reminder",
|
|
165
|
+
"job_application_shortlisted",
|
|
166
|
+
"job_application_rejected",
|
|
167
|
+
"job_application_status",
|
|
168
|
+
"product_approved",
|
|
169
|
+
"marketplace_drop",
|
|
170
|
+
"friend_product_added",
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
export const NotificationInboxItemSchema = z
|
|
174
|
+
.object({
|
|
175
|
+
id: z.string(),
|
|
176
|
+
kind: NotificationInboxKindSchema,
|
|
177
|
+
tab: NotificationInboxCategorySchema,
|
|
178
|
+
isRead: z.boolean(),
|
|
179
|
+
isArchived: z.boolean(),
|
|
180
|
+
createdAt: z.iso.datetime(),
|
|
181
|
+
|
|
182
|
+
actorMode: z.enum(["user", "system", "group"]),
|
|
183
|
+
actors: z.array(
|
|
184
|
+
z.object({
|
|
185
|
+
id: z.string(),
|
|
186
|
+
name: z.string(),
|
|
187
|
+
username: z.string().optional(),
|
|
188
|
+
image: z.string().optional(),
|
|
189
|
+
role: z.enum(["CREATIVE", "BRAND", "INVESTOR", "ADMIN"]).optional(),
|
|
190
|
+
}),
|
|
191
|
+
),
|
|
192
|
+
actorOverflowCount: z.int().nonnegative().optional(),
|
|
193
|
+
|
|
194
|
+
icon: z
|
|
195
|
+
.object({
|
|
196
|
+
name: z.enum([
|
|
197
|
+
"user",
|
|
198
|
+
"heart",
|
|
199
|
+
"bell",
|
|
200
|
+
"briefcase",
|
|
201
|
+
"badge-check",
|
|
202
|
+
"alert",
|
|
203
|
+
"megaphone",
|
|
204
|
+
]),
|
|
205
|
+
intent: z
|
|
206
|
+
.enum(["neutral", "success", "warning", "danger", "primary"])
|
|
207
|
+
.optional(),
|
|
208
|
+
})
|
|
209
|
+
.optional(),
|
|
210
|
+
|
|
211
|
+
message: z.object({
|
|
212
|
+
parts: z
|
|
213
|
+
.array(
|
|
214
|
+
z.object({
|
|
215
|
+
text: z.string(),
|
|
216
|
+
tone: z.enum(["default", "muted", "primary"]).optional(),
|
|
217
|
+
weight: z.enum(["regular", "medium", "semibold"]).optional(),
|
|
218
|
+
href: z.string().optional(),
|
|
219
|
+
}),
|
|
220
|
+
)
|
|
221
|
+
.min(1),
|
|
222
|
+
subtitle: z.string().optional(),
|
|
223
|
+
contextLabel: z.string().optional(),
|
|
224
|
+
quote: z.string().optional(),
|
|
225
|
+
}),
|
|
226
|
+
|
|
227
|
+
target: z
|
|
228
|
+
.object({
|
|
229
|
+
href: z.string(),
|
|
230
|
+
entityType: z.enum([
|
|
231
|
+
"USER",
|
|
232
|
+
"PROJECT",
|
|
233
|
+
"POST",
|
|
234
|
+
"COMMENT",
|
|
235
|
+
"JOB",
|
|
236
|
+
"JOB_APPLICATION",
|
|
237
|
+
"PRODUCT",
|
|
238
|
+
"CHAT",
|
|
239
|
+
"SETTINGS",
|
|
240
|
+
]),
|
|
241
|
+
entityId: z.string().optional(),
|
|
242
|
+
})
|
|
243
|
+
.optional(),
|
|
244
|
+
|
|
245
|
+
preview: z
|
|
246
|
+
.object({
|
|
247
|
+
type: z.enum(["project", "product", "post", "comment", "job", "image"]),
|
|
248
|
+
title: z.string().optional(),
|
|
249
|
+
subtitle: z.string().optional(),
|
|
250
|
+
body: z.string().optional(),
|
|
251
|
+
imageUrl: z.string().optional(),
|
|
252
|
+
imageAlt: z.string().optional(),
|
|
253
|
+
ownerName: z.string().optional(),
|
|
254
|
+
ownerAvatarUrl: z.string().optional(),
|
|
255
|
+
badge: z.enum(["featured", "locked", "new", "warning"]).optional(),
|
|
256
|
+
href: z.string().optional(),
|
|
257
|
+
})
|
|
258
|
+
.optional(),
|
|
259
|
+
|
|
260
|
+
actions: z
|
|
261
|
+
.array(
|
|
262
|
+
z.object({
|
|
263
|
+
id: z.string(),
|
|
264
|
+
label: z.string(),
|
|
265
|
+
style: z.enum(["primary", "secondary", "link"]),
|
|
266
|
+
href: z.string().optional(),
|
|
267
|
+
mutation: z
|
|
268
|
+
.object({
|
|
269
|
+
method: z.enum(["POST", "PATCH"]),
|
|
270
|
+
endpoint: z.string(),
|
|
271
|
+
body: z.record(z.string(), z.unknown()).optional(),
|
|
272
|
+
})
|
|
273
|
+
.optional(),
|
|
274
|
+
}),
|
|
275
|
+
)
|
|
276
|
+
.optional(),
|
|
277
|
+
|
|
278
|
+
menuActions: z
|
|
279
|
+
.array(
|
|
280
|
+
z.enum([
|
|
281
|
+
"mark_read",
|
|
282
|
+
"mark_unread",
|
|
283
|
+
"archive",
|
|
284
|
+
"unarchive",
|
|
285
|
+
"delete",
|
|
286
|
+
"mute_type",
|
|
287
|
+
]),
|
|
288
|
+
)
|
|
289
|
+
.optional(),
|
|
290
|
+
})
|
|
291
|
+
.openapi("NotificationInboxItem");
|
|
292
|
+
|
|
293
|
+
export type NotificationInboxItem = z.infer<
|
|
294
|
+
typeof NotificationInboxItemSchema
|
|
295
|
+
>;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* --------------------------------
|
|
299
|
+
* INPUTS
|
|
300
|
+
* --------------------------------
|
|
62
301
|
*/
|
|
63
302
|
|
|
64
303
|
export const ListNotificationsInputSchema = z.object({
|
|
65
304
|
type: z.enum(NOTIFICATION_TYPES).optional(),
|
|
305
|
+
tab: NotificationTabSchema.optional().default("all"),
|
|
66
306
|
cursor: z.string().optional(),
|
|
67
307
|
unreadOnly: z.boolean().optional().default(false),
|
|
68
308
|
});
|
|
@@ -77,25 +317,83 @@ export const MarkReadInputSchema = z.object({
|
|
|
77
317
|
|
|
78
318
|
export type MarkReadInput = z.infer<typeof MarkReadInputSchema>;
|
|
79
319
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
320
|
+
export const ArchiveNotificationsInputSchema = z.object({
|
|
321
|
+
notificationIds: z.array(z.cuid2()).min(1),
|
|
322
|
+
archived: z.boolean().optional().default(true),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
export type ArchiveNotificationsInput = z.infer<
|
|
326
|
+
typeof ArchiveNotificationsInputSchema
|
|
327
|
+
>;
|
|
328
|
+
|
|
329
|
+
export const ListNotificationInboxInputSchema = z.object({
|
|
330
|
+
tab: NotificationInboxTabSchema.optional().default("all"),
|
|
331
|
+
unreadOnly: z.boolean().optional().default(false),
|
|
332
|
+
cursor: z.string().optional(),
|
|
333
|
+
limit: z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
export type ListNotificationInboxInput = z.infer<
|
|
337
|
+
typeof ListNotificationInboxInputSchema
|
|
338
|
+
>;
|
|
339
|
+
|
|
340
|
+
export const BulkNotificationMutationInputSchema = z.object({
|
|
341
|
+
notificationIds: z.array(z.string()).min(1),
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
export type BulkNotificationMutationInput = z.infer<
|
|
345
|
+
typeof BulkNotificationMutationInputSchema
|
|
346
|
+
>;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* --------------------------------
|
|
350
|
+
* OUTPUTS
|
|
351
|
+
* --------------------------------
|
|
84
352
|
*/
|
|
85
353
|
|
|
86
354
|
export const ListNotificationsOutputSchema = z.object({
|
|
87
355
|
notifications: z.array(NotificationDetailsEntitySchema),
|
|
356
|
+
items: z.array(NotificationFeedItemSchema).default([]),
|
|
88
357
|
nextCursor: z.string().optional(),
|
|
89
358
|
unreadCount: z.int(),
|
|
90
359
|
});
|
|
91
360
|
|
|
92
|
-
export type ListNotificationsOutput = z.infer<
|
|
93
|
-
typeof ListNotificationsOutputSchema
|
|
94
|
-
>;
|
|
95
|
-
|
|
96
|
-
export const
|
|
97
|
-
|
|
98
|
-
|
|
361
|
+
export type ListNotificationsOutput = z.infer<
|
|
362
|
+
typeof ListNotificationsOutputSchema
|
|
363
|
+
>;
|
|
364
|
+
|
|
365
|
+
export const NotificationMutationOutputSchema = z.object({
|
|
366
|
+
success: z.boolean(),
|
|
367
|
+
updatedCount: z.int().optional(),
|
|
368
|
+
deletedCount: z.int().optional(),
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
export type NotificationMutationOutput = z.infer<
|
|
372
|
+
typeof NotificationMutationOutputSchema
|
|
373
|
+
>;
|
|
374
|
+
|
|
375
|
+
export const ListNotificationInboxOutputSchema = z.object({
|
|
376
|
+
notifications: z.array(NotificationInboxItemSchema),
|
|
377
|
+
nextCursor: z.string().optional(),
|
|
378
|
+
unreadCount: z.int(),
|
|
379
|
+
tabCounts: z
|
|
380
|
+
.object({
|
|
381
|
+
all: z.int().optional(),
|
|
382
|
+
following: z.int().optional(),
|
|
383
|
+
likes: z.int().optional(),
|
|
384
|
+
comments: z.int().optional(),
|
|
385
|
+
archived: z.int().optional(),
|
|
386
|
+
})
|
|
387
|
+
.optional(),
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
export type ListNotificationInboxOutput = z.infer<
|
|
391
|
+
typeof ListNotificationInboxOutputSchema
|
|
392
|
+
>;
|
|
393
|
+
|
|
394
|
+
export const NotificationCountOutputSchema = z.object({
|
|
395
|
+
unreadCount: z.int(),
|
|
396
|
+
});
|
|
99
397
|
|
|
100
398
|
export type NotificationCountOutput = z.infer<
|
|
101
399
|
typeof NotificationCountOutputSchema
|