@zyacreatives/shared 2.1.37 → 2.1.39
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.
|
@@ -15,8 +15,26 @@ export declare const NotificationEntitySchema: z.ZodObject<{
|
|
|
15
15
|
readonly SYSTEM_STRIKE: "System Strike";
|
|
16
16
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
17
17
|
}>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
entityId: z.ZodOptional<z.ZodCUID2>;
|
|
19
|
+
entityType: z.ZodEnum<{
|
|
20
|
+
readonly PROJECT: "PROJECT";
|
|
21
|
+
readonly USER: "USER";
|
|
22
|
+
readonly JOB: "JOB";
|
|
23
|
+
readonly POST: "POST";
|
|
24
|
+
readonly COMMENT: "COMMENT";
|
|
25
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
26
|
+
}>;
|
|
27
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
28
|
+
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
readonly PROJECT: "PROJECT";
|
|
30
|
+
readonly USER: "USER";
|
|
31
|
+
readonly JOB: "JOB";
|
|
32
|
+
readonly POST: "POST";
|
|
33
|
+
readonly COMMENT: "COMMENT";
|
|
34
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
35
|
+
}>>>;
|
|
36
|
+
rootId: z.ZodCUID2;
|
|
37
|
+
rootType: z.ZodEnum<{
|
|
20
38
|
readonly PROJECT: "PROJECT";
|
|
21
39
|
readonly USER: "USER";
|
|
22
40
|
readonly JOB: "JOB";
|
|
@@ -49,8 +67,26 @@ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
|
|
|
49
67
|
readonly SYSTEM_STRIKE: "System Strike";
|
|
50
68
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
51
69
|
}>;
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
entityId: z.ZodOptional<z.ZodCUID2>;
|
|
71
|
+
entityType: z.ZodEnum<{
|
|
72
|
+
readonly PROJECT: "PROJECT";
|
|
73
|
+
readonly USER: "USER";
|
|
74
|
+
readonly JOB: "JOB";
|
|
75
|
+
readonly POST: "POST";
|
|
76
|
+
readonly COMMENT: "COMMENT";
|
|
77
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
78
|
+
}>;
|
|
79
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
80
|
+
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
readonly PROJECT: "PROJECT";
|
|
82
|
+
readonly USER: "USER";
|
|
83
|
+
readonly JOB: "JOB";
|
|
84
|
+
readonly POST: "POST";
|
|
85
|
+
readonly COMMENT: "COMMENT";
|
|
86
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
87
|
+
}>>>;
|
|
88
|
+
rootId: z.ZodCUID2;
|
|
89
|
+
rootType: z.ZodEnum<{
|
|
54
90
|
readonly PROJECT: "PROJECT";
|
|
55
91
|
readonly USER: "USER";
|
|
56
92
|
readonly JOB: "JOB";
|
|
@@ -99,8 +135,26 @@ export declare const ListNotificationsOutputSchema: z.ZodObject<{
|
|
|
99
135
|
readonly SYSTEM_STRIKE: "System Strike";
|
|
100
136
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
101
137
|
}>;
|
|
102
|
-
|
|
103
|
-
|
|
138
|
+
entityId: z.ZodOptional<z.ZodCUID2>;
|
|
139
|
+
entityType: z.ZodEnum<{
|
|
140
|
+
readonly PROJECT: "PROJECT";
|
|
141
|
+
readonly USER: "USER";
|
|
142
|
+
readonly JOB: "JOB";
|
|
143
|
+
readonly POST: "POST";
|
|
144
|
+
readonly COMMENT: "COMMENT";
|
|
145
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
146
|
+
}>;
|
|
147
|
+
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
148
|
+
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
149
|
+
readonly PROJECT: "PROJECT";
|
|
150
|
+
readonly USER: "USER";
|
|
151
|
+
readonly JOB: "JOB";
|
|
152
|
+
readonly POST: "POST";
|
|
153
|
+
readonly COMMENT: "COMMENT";
|
|
154
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
155
|
+
}>>>;
|
|
156
|
+
rootId: z.ZodCUID2;
|
|
157
|
+
rootType: z.ZodEnum<{
|
|
104
158
|
readonly PROJECT: "PROJECT";
|
|
105
159
|
readonly USER: "USER";
|
|
106
160
|
readonly JOB: "JOB";
|
|
@@ -9,12 +9,23 @@ exports.NotificationEntitySchema = zod_openapi_1.z
|
|
|
9
9
|
recipientId: zod_openapi_1.z.cuid2().openapi({ example: "user_recipient_123" }),
|
|
10
10
|
actorId: zod_openapi_1.z.cuid2().openapi({ example: "user_actor_456" }),
|
|
11
11
|
type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// 1. ENTITY: The specific thing created (e.g., the Reply)
|
|
13
|
+
entityId: zod_openapi_1.z.cuid2().optional().openapi({ example: "entity_789" }),
|
|
14
|
+
entityType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
|
|
15
|
+
// 2. PARENT: The direct context (e.g., the Comment being replied to)
|
|
16
|
+
// Optional because top-level interactions (like a comment on a project)
|
|
17
|
+
// have no parent other than the root.
|
|
18
|
+
parentId: zod_openapi_1.z
|
|
19
|
+
.cuid2()
|
|
20
|
+
.optional()
|
|
21
|
+
.nullable()
|
|
22
|
+
.openapi({ example: "parent_456" }),
|
|
23
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).optional().nullable(),
|
|
24
|
+
// 3. ROOT: The top-level container (e.g., the Project)
|
|
25
|
+
rootId: zod_openapi_1.z.cuid2().openapi({ example: "root_123" }),
|
|
26
|
+
rootType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
|
|
14
27
|
isRead: zod_openapi_1.z.boolean().default(false).openapi({ example: false }),
|
|
15
|
-
createdAt: zod_openapi_1.z.coerce
|
|
16
|
-
.date()
|
|
17
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
28
|
+
createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2026-01-05T09:00:00.000Z" }),
|
|
18
29
|
deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
|
|
19
30
|
})
|
|
20
31
|
.openapi("NotificationEntity");
|
|
@@ -31,10 +42,7 @@ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.exten
|
|
|
31
42
|
});
|
|
32
43
|
exports.ListNotificationsInputSchema = zod_openapi_1.z
|
|
33
44
|
.object({
|
|
34
|
-
type: zod_openapi_1.z
|
|
35
|
-
.enum(constants_1.NOTIFICATION_TYPES)
|
|
36
|
-
.openapi({ example: "LIKE" })
|
|
37
|
-
.optional(),
|
|
45
|
+
type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).openapi({ example: "LIKE" }).optional(),
|
|
38
46
|
cursor: zod_openapi_1.z.string().optional(),
|
|
39
47
|
unreadOnly: zod_openapi_1.z
|
|
40
48
|
.preprocess((val) => val === "true" || val === true, zod_openapi_1.z.boolean())
|
package/package.json
CHANGED
|
@@ -2,58 +2,71 @@ import { z } from "@hono/zod-openapi";
|
|
|
2
2
|
import { ACTIVITY_PARENT_TYPES, NOTIFICATION_TYPES } from "../constants";
|
|
3
3
|
|
|
4
4
|
export const NotificationEntitySchema = z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
.object({
|
|
6
|
+
id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
7
|
+
recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
|
|
8
|
+
actorId: z.cuid2().openapi({ example: "user_actor_456" }),
|
|
9
|
+
type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
|
|
10
|
+
|
|
11
|
+
// 1. ENTITY: The specific thing created (e.g., the Reply)
|
|
12
|
+
entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
|
|
13
|
+
entityType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
14
|
+
|
|
15
|
+
// 2. PARENT: The direct context (e.g., the Comment being replied to)
|
|
16
|
+
// Optional because top-level interactions (like a comment on a project)
|
|
17
|
+
// have no parent other than the root.
|
|
18
|
+
parentId: z
|
|
19
|
+
|
|
20
|
+
.cuid2()
|
|
21
|
+
.optional()
|
|
22
|
+
.nullable()
|
|
23
|
+
.openapi({ example: "parent_456" }),
|
|
24
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
|
|
25
|
+
|
|
26
|
+
// 3. ROOT: The top-level container (e.g., the Project)
|
|
27
|
+
rootId: z.cuid2().openapi({ example: "root_123" }),
|
|
28
|
+
rootType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
29
|
+
|
|
30
|
+
isRead: z.boolean().default(false).openapi({ example: false }),
|
|
31
|
+
createdAt: z.coerce.date().openapi({ example: "2026-01-05T09:00:00.000Z" }),
|
|
32
|
+
deletedAt: z.coerce.date().optional().nullable(),
|
|
33
|
+
})
|
|
34
|
+
.openapi("NotificationEntity");
|
|
19
35
|
|
|
20
36
|
export const MinimalNotificationEntitySchema = z.object({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
id: z.cuid2(),
|
|
38
|
+
recipientId: z.cuid2(),
|
|
39
|
+
actorId: z.cuid2(),
|
|
24
40
|
});
|
|
25
41
|
|
|
26
42
|
export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
itemTitle: z.string().optional(),
|
|
44
|
+
itemContent: z.string().optional(),
|
|
45
|
+
itemImgUrl: z.string().optional(),
|
|
46
|
+
itemStatus: z.string().optional(),
|
|
31
47
|
});
|
|
32
48
|
|
|
33
49
|
export const ListNotificationsInputSchema = z
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.default(false),
|
|
44
|
-
})
|
|
45
|
-
.openapi("ListNotificationsInput");
|
|
50
|
+
.object({
|
|
51
|
+
type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }).optional(),
|
|
52
|
+
cursor: z.string().optional(),
|
|
53
|
+
unreadOnly: z
|
|
54
|
+
.preprocess((val) => val === "true" || val === true, z.boolean())
|
|
55
|
+
.optional()
|
|
56
|
+
.default(false),
|
|
57
|
+
})
|
|
58
|
+
.openapi("ListNotificationsInput");
|
|
46
59
|
|
|
47
60
|
export const ListNotificationsOutputSchema = z.object({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
notifications: z.array(NotificationDetailsEntitySchema),
|
|
62
|
+
nextCursor: z.string().optional().nullable(),
|
|
63
|
+
unreadCount: z.number().int().openapi({ example: 5 }),
|
|
51
64
|
});
|
|
52
65
|
|
|
53
66
|
export const MarkReadInputSchema = z.object({
|
|
54
|
-
|
|
67
|
+
notificationIds: z.array(z.cuid2()).min(1),
|
|
55
68
|
});
|
|
56
69
|
|
|
57
70
|
export const NotificationCountOutputSchema = z.object({
|
|
58
|
-
|
|
71
|
+
unreadCount: z.number().int().openapi({ example: 12 }),
|
|
59
72
|
});
|