@zyacreatives/shared 2.1.40 → 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.
@@ -81,6 +81,32 @@ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
81
81
  isRead: z.ZodDefault<z.ZodBoolean>;
82
82
  createdAt: z.ZodCoercedDate<unknown>;
83
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>;
84
110
  itemTitle: z.ZodOptional<z.ZodString>;
85
111
  itemContent: z.ZodOptional<z.ZodString>;
86
112
  itemImgUrl: z.ZodOptional<z.ZodString>;
@@ -141,6 +167,32 @@ export declare const ListNotificationsOutputSchema: z.ZodObject<{
141
167
  isRead: z.ZodDefault<z.ZodBoolean>;
142
168
  createdAt: z.ZodCoercedDate<unknown>;
143
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>;
144
196
  itemTitle: z.ZodOptional<z.ZodString>;
145
197
  itemContent: z.ZodOptional<z.ZodString>;
146
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" }),
@@ -24,7 +25,9 @@ exports.NotificationEntitySchema = zod_openapi_1.z
24
25
  rootId: zod_openapi_1.z.cuid2().openapi({ example: "root_123" }),
25
26
  rootType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES),
26
27
  isRead: zod_openapi_1.z.boolean().default(false).openapi({ example: false }),
27
- createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2026-01-05T09:00:00.000Z" }),
28
+ createdAt: zod_openapi_1.z.coerce
29
+ .date()
30
+ .openapi({ example: "2026-01-05T09:00:00.000Z" }),
28
31
  deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
29
32
  })
30
33
  .openapi("NotificationEntity");
@@ -34,6 +37,8 @@ exports.MinimalNotificationEntitySchema = zod_openapi_1.z.object({
34
37
  actorId: zod_openapi_1.z.cuid2(),
35
38
  });
36
39
  exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.extend({
40
+ actor: user_1.MinimalUserSchema,
41
+ recipient: user_1.MinimalUserSchema,
37
42
  itemTitle: zod_openapi_1.z.string().optional(),
38
43
  itemContent: zod_openapi_1.z.string().optional(),
39
44
  itemImgUrl: zod_openapi_1.z.string().optional(),
@@ -41,7 +46,10 @@ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.exten
41
46
  });
42
47
  exports.ListNotificationsInputSchema = zod_openapi_1.z
43
48
  .object({
44
- type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).openapi({ example: "LIKE" }).optional(),
49
+ type: zod_openapi_1.z
50
+ .enum(constants_1.NOTIFICATION_TYPES)
51
+ .openapi({ example: "LIKE" })
52
+ .optional(),
45
53
  cursor: zod_openapi_1.z.string().optional(),
46
54
  unreadOnly: zod_openapi_1.z
47
55
  .preprocess((val) => val === "true" || val === true, zod_openapi_1.z.boolean())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.40",
3
+ "version": "2.1.41",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,70 +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
- .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
- // 1. ENTITY: The specific thing created (e.g., the Reply)
11
- entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
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" }),
12
13
 
13
- // 2. PARENT: The direct context (e.g., the Comment being replied to)
14
- // Optional because top-level interactions (like a comment on a project)
15
- // have no parent other than the root.
16
- parentId: z
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(),
17
23
 
18
- .cuid2()
19
- .optional()
20
- .nullable()
21
- .openapi({ example: "parent_456" }),
22
- parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
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),
23
27
 
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),
27
-
28
- isRead: z.boolean().default(false).openapi({ example: false }),
29
- createdAt: z.coerce.date().openapi({ example: "2026-01-05T09:00:00.000Z" }),
30
- deletedAt: z.coerce.date().optional().nullable(),
31
- })
32
- .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");
33
35
 
34
36
  export const MinimalNotificationEntitySchema = z.object({
35
- id: z.cuid2(),
36
- recipientId: z.cuid2(),
37
- actorId: z.cuid2(),
37
+ id: z.cuid2(),
38
+ recipientId: z.cuid2(),
39
+ actorId: z.cuid2(),
38
40
  });
39
41
 
40
42
  export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
41
- itemTitle: z.string().optional(),
42
- itemContent: z.string().optional(),
43
- itemImgUrl: z.string().optional(),
44
- itemStatus: z.string().optional(),
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(),
45
49
  });
46
50
 
47
51
  export const ListNotificationsInputSchema = z
48
- .object({
49
- type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }).optional(),
50
- cursor: z.string().optional(),
51
- unreadOnly: z
52
- .preprocess((val) => val === "true" || val === true, z.boolean())
53
- .optional()
54
- .default(false),
55
- })
56
- .openapi("ListNotificationsInput");
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");
57
64
 
58
65
  export const ListNotificationsOutputSchema = z.object({
59
- notifications: z.array(NotificationDetailsEntitySchema),
60
- nextCursor: z.string().optional().nullable(),
61
- unreadCount: z.number().int().openapi({ example: 5 }),
66
+ notifications: z.array(NotificationDetailsEntitySchema),
67
+ nextCursor: z.string().optional().nullable(),
68
+ unreadCount: z.number().int().openapi({ example: 5 }),
62
69
  });
63
70
 
64
71
  export const MarkReadInputSchema = z.object({
65
- notificationIds: z.array(z.cuid2()).min(1),
72
+ notificationIds: z.array(z.cuid2()).min(1),
66
73
  });
67
74
 
68
75
  export const NotificationCountOutputSchema = z.object({
69
- unreadCount: z.number().int().openapi({ example: 12 }),
76
+ unreadCount: z.number().int().openapi({ example: 12 }),
70
77
  });