@zyacreatives/shared 2.1.39 → 2.1.41
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.
|
@@ -16,14 +16,6 @@ export declare const NotificationEntitySchema: z.ZodObject<{
|
|
|
16
16
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
17
17
|
}>;
|
|
18
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
19
|
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
28
20
|
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
29
21
|
readonly PROJECT: "PROJECT";
|
|
@@ -68,14 +60,6 @@ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
|
|
|
68
60
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
69
61
|
}>;
|
|
70
62
|
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
63
|
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
80
64
|
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
81
65
|
readonly PROJECT: "PROJECT";
|
|
@@ -97,6 +81,32 @@ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
|
|
|
97
81
|
isRead: z.ZodDefault<z.ZodBoolean>;
|
|
98
82
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
99
83
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
84
|
+
actor: z.ZodObject<{
|
|
85
|
+
email: z.ZodString;
|
|
86
|
+
username: z.ZodOptional<z.ZodString>;
|
|
87
|
+
id: z.ZodCUID2;
|
|
88
|
+
name: z.ZodOptional<z.ZodString>;
|
|
89
|
+
image: z.ZodOptional<z.ZodString>;
|
|
90
|
+
role: z.ZodEnum<{
|
|
91
|
+
CREATIVE: "CREATIVE";
|
|
92
|
+
BRAND: "BRAND";
|
|
93
|
+
INVESTOR: "INVESTOR";
|
|
94
|
+
ADMIN: "ADMIN";
|
|
95
|
+
}>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
recipient: z.ZodObject<{
|
|
98
|
+
email: z.ZodString;
|
|
99
|
+
username: z.ZodOptional<z.ZodString>;
|
|
100
|
+
id: z.ZodCUID2;
|
|
101
|
+
name: z.ZodOptional<z.ZodString>;
|
|
102
|
+
image: z.ZodOptional<z.ZodString>;
|
|
103
|
+
role: z.ZodEnum<{
|
|
104
|
+
CREATIVE: "CREATIVE";
|
|
105
|
+
BRAND: "BRAND";
|
|
106
|
+
INVESTOR: "INVESTOR";
|
|
107
|
+
ADMIN: "ADMIN";
|
|
108
|
+
}>;
|
|
109
|
+
}, z.core.$strip>;
|
|
100
110
|
itemTitle: z.ZodOptional<z.ZodString>;
|
|
101
111
|
itemContent: z.ZodOptional<z.ZodString>;
|
|
102
112
|
itemImgUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -136,14 +146,6 @@ export declare const ListNotificationsOutputSchema: z.ZodObject<{
|
|
|
136
146
|
readonly PROJECT_FEATURED: "Project Featured";
|
|
137
147
|
}>;
|
|
138
148
|
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
149
|
parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
148
150
|
parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
149
151
|
readonly PROJECT: "PROJECT";
|
|
@@ -165,6 +167,32 @@ export declare const ListNotificationsOutputSchema: z.ZodObject<{
|
|
|
165
167
|
isRead: z.ZodDefault<z.ZodBoolean>;
|
|
166
168
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
167
169
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
170
|
+
actor: z.ZodObject<{
|
|
171
|
+
email: z.ZodString;
|
|
172
|
+
username: z.ZodOptional<z.ZodString>;
|
|
173
|
+
id: z.ZodCUID2;
|
|
174
|
+
name: z.ZodOptional<z.ZodString>;
|
|
175
|
+
image: z.ZodOptional<z.ZodString>;
|
|
176
|
+
role: z.ZodEnum<{
|
|
177
|
+
CREATIVE: "CREATIVE";
|
|
178
|
+
BRAND: "BRAND";
|
|
179
|
+
INVESTOR: "INVESTOR";
|
|
180
|
+
ADMIN: "ADMIN";
|
|
181
|
+
}>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
recipient: z.ZodObject<{
|
|
184
|
+
email: z.ZodString;
|
|
185
|
+
username: z.ZodOptional<z.ZodString>;
|
|
186
|
+
id: z.ZodCUID2;
|
|
187
|
+
name: z.ZodOptional<z.ZodString>;
|
|
188
|
+
image: z.ZodOptional<z.ZodString>;
|
|
189
|
+
role: z.ZodEnum<{
|
|
190
|
+
CREATIVE: "CREATIVE";
|
|
191
|
+
BRAND: "BRAND";
|
|
192
|
+
INVESTOR: "INVESTOR";
|
|
193
|
+
ADMIN: "ADMIN";
|
|
194
|
+
}>;
|
|
195
|
+
}, z.core.$strip>;
|
|
168
196
|
itemTitle: z.ZodOptional<z.ZodString>;
|
|
169
197
|
itemContent: z.ZodOptional<z.ZodString>;
|
|
170
198
|
itemImgUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NotificationCountOutputSchema = exports.MarkReadInputSchema = exports.ListNotificationsOutputSchema = exports.ListNotificationsInputSchema = exports.NotificationDetailsEntitySchema = exports.MinimalNotificationEntitySchema = exports.NotificationEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
+
const user_1 = require("./user");
|
|
6
7
|
exports.NotificationEntitySchema = zod_openapi_1.z
|
|
7
8
|
.object({
|
|
8
9
|
id: zod_openapi_1.z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
@@ -11,7 +12,6 @@ exports.NotificationEntitySchema = zod_openapi_1.z
|
|
|
11
12
|
type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
|
|
12
13
|
// 1. ENTITY: The specific thing created (e.g., the Reply)
|
|
13
14
|
entityId: zod_openapi_1.z.cuid2().optional().openapi({ example: "entity_789" }),
|
|
14
|
-
entityType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
|
|
15
15
|
// 2. PARENT: The direct context (e.g., the Comment being replied to)
|
|
16
16
|
// Optional because top-level interactions (like a comment on a project)
|
|
17
17
|
// have no parent other than the root.
|
|
@@ -25,7 +25,9 @@ exports.NotificationEntitySchema = zod_openapi_1.z
|
|
|
25
25
|
rootId: zod_openapi_1.z.cuid2().openapi({ example: "root_123" }),
|
|
26
26
|
rootType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
|
|
27
27
|
isRead: zod_openapi_1.z.boolean().default(false).openapi({ example: false }),
|
|
28
|
-
createdAt: zod_openapi_1.z.coerce
|
|
28
|
+
createdAt: zod_openapi_1.z.coerce
|
|
29
|
+
.date()
|
|
30
|
+
.openapi({ example: "2026-01-05T09:00:00.000Z" }),
|
|
29
31
|
deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
|
|
30
32
|
})
|
|
31
33
|
.openapi("NotificationEntity");
|
|
@@ -35,6 +37,8 @@ exports.MinimalNotificationEntitySchema = zod_openapi_1.z.object({
|
|
|
35
37
|
actorId: zod_openapi_1.z.cuid2(),
|
|
36
38
|
});
|
|
37
39
|
exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.extend({
|
|
40
|
+
actor: user_1.MinimalUserSchema,
|
|
41
|
+
recipient: user_1.MinimalUserSchema,
|
|
38
42
|
itemTitle: zod_openapi_1.z.string().optional(),
|
|
39
43
|
itemContent: zod_openapi_1.z.string().optional(),
|
|
40
44
|
itemImgUrl: zod_openapi_1.z.string().optional(),
|
|
@@ -42,7 +46,10 @@ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.exten
|
|
|
42
46
|
});
|
|
43
47
|
exports.ListNotificationsInputSchema = zod_openapi_1.z
|
|
44
48
|
.object({
|
|
45
|
-
type: zod_openapi_1.z
|
|
49
|
+
type: zod_openapi_1.z
|
|
50
|
+
.enum(constants_1.NOTIFICATION_TYPES)
|
|
51
|
+
.openapi({ example: "LIKE" })
|
|
52
|
+
.optional(),
|
|
46
53
|
cursor: zod_openapi_1.z.string().optional(),
|
|
47
54
|
unreadOnly: zod_openapi_1.z
|
|
48
55
|
.preprocess((val) => val === "true" || val === true, zod_openapi_1.z.boolean())
|
package/package.json
CHANGED
|
@@ -1,72 +1,77 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { ACTIVITY_PARENT_TYPES, NOTIFICATION_TYPES } from "../constants";
|
|
3
|
+
import { MinimalUserSchema } from "./user";
|
|
3
4
|
|
|
4
5
|
export const NotificationEntitySchema = z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
.object({
|
|
7
|
+
id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
+
recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
|
|
9
|
+
actorId: z.cuid2().openapi({ example: "user_actor_456" }),
|
|
10
|
+
type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
|
|
11
|
+
// 1. ENTITY: The specific thing created (e.g., the Reply)
|
|
12
|
+
entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
// 2. PARENT: The direct context (e.g., the Comment being replied to)
|
|
15
|
+
// Optional because top-level interactions (like a comment on a project)
|
|
16
|
+
// have no parent other than the root.
|
|
17
|
+
parentId: z
|
|
18
|
+
.cuid2()
|
|
19
|
+
.optional()
|
|
20
|
+
.nullable()
|
|
21
|
+
.openapi({ example: "parent_456" }),
|
|
22
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
parentId: z
|
|
24
|
+
// 3. ROOT: The top-level container (e.g., the Project)
|
|
25
|
+
rootId: z.cuid2().openapi({ example: "root_123" }),
|
|
26
|
+
rootType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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");
|
|
28
|
+
isRead: z.boolean().default(false).openapi({ example: false }),
|
|
29
|
+
createdAt: z.coerce
|
|
30
|
+
.date()
|
|
31
|
+
.openapi({ example: "2026-01-05T09:00:00.000Z" }),
|
|
32
|
+
deletedAt: z.coerce.date().optional().nullable(),
|
|
33
|
+
})
|
|
34
|
+
.openapi("NotificationEntity");
|
|
35
35
|
|
|
36
36
|
export const MinimalNotificationEntitySchema = z.object({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
id: z.cuid2(),
|
|
38
|
+
recipientId: z.cuid2(),
|
|
39
|
+
actorId: z.cuid2(),
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
actor: MinimalUserSchema,
|
|
44
|
+
recipient: MinimalUserSchema,
|
|
45
|
+
itemTitle: z.string().optional(),
|
|
46
|
+
itemContent: z.string().optional(),
|
|
47
|
+
itemImgUrl: z.string().optional(),
|
|
48
|
+
itemStatus: z.string().optional(),
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
export const ListNotificationsInputSchema = z
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
.object({
|
|
53
|
+
type: z
|
|
54
|
+
.enum(NOTIFICATION_TYPES)
|
|
55
|
+
.openapi({ example: "LIKE" })
|
|
56
|
+
.optional(),
|
|
57
|
+
cursor: z.string().optional(),
|
|
58
|
+
unreadOnly: z
|
|
59
|
+
.preprocess((val) => val === "true" || val === true, z.boolean())
|
|
60
|
+
.optional()
|
|
61
|
+
.default(false),
|
|
62
|
+
})
|
|
63
|
+
.openapi("ListNotificationsInput");
|
|
59
64
|
|
|
60
65
|
export const ListNotificationsOutputSchema = z.object({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
notifications: z.array(NotificationDetailsEntitySchema),
|
|
67
|
+
nextCursor: z.string().optional().nullable(),
|
|
68
|
+
unreadCount: z.number().int().openapi({ example: 5 }),
|
|
64
69
|
});
|
|
65
70
|
|
|
66
71
|
export const MarkReadInputSchema = z.object({
|
|
67
|
-
|
|
72
|
+
notificationIds: z.array(z.cuid2()).min(1),
|
|
68
73
|
});
|
|
69
74
|
|
|
70
75
|
export const NotificationCountOutputSchema = z.object({
|
|
71
|
-
|
|
76
|
+
unreadCount: z.number().int().openapi({ example: 12 }),
|
|
72
77
|
});
|