@vonosan/notifications 0.2.1

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.
@@ -0,0 +1,93 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import type { Context } from 'hono';
11
+ import type { AppVariables } from 'vonosan/types';
12
+ type AppContext = Context<{
13
+ Variables: AppVariables;
14
+ }>;
15
+ export declare function listNotifications(c: AppContext): Promise<Response & import("hono").TypedResponse<{
16
+ success: boolean;
17
+ message: string;
18
+ data?: {
19
+ items: {
20
+ id: string;
21
+ account_id: string;
22
+ type: string;
23
+ title: string;
24
+ body: string;
25
+ data: never;
26
+ read_at: string | null;
27
+ created_at: string;
28
+ deleted_at: string | null;
29
+ }[];
30
+ meta: {
31
+ page: number;
32
+ page_size: number;
33
+ total_items: number;
34
+ total_pages: number;
35
+ has_next: boolean;
36
+ has_prev: boolean;
37
+ };
38
+ } | undefined;
39
+ errors?: string[] | {
40
+ [x: string]: string;
41
+ } | undefined;
42
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
43
+ export declare function markNotificationRead(c: AppContext): Promise<Response & import("hono").TypedResponse<{
44
+ success: boolean;
45
+ message: string;
46
+ data?: null | undefined;
47
+ errors?: string[] | {
48
+ [x: string]: string;
49
+ } | undefined;
50
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
51
+ export declare function markAllNotificationsRead(c: AppContext): Promise<Response & import("hono").TypedResponse<{
52
+ success: boolean;
53
+ message: string;
54
+ data?: null | undefined;
55
+ errors?: string[] | {
56
+ [x: string]: string;
57
+ } | undefined;
58
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
59
+ export declare function deleteNotification(c: AppContext): Promise<Response & import("hono").TypedResponse<{
60
+ success: boolean;
61
+ message: string;
62
+ data?: null | undefined;
63
+ errors?: string[] | {
64
+ [x: string]: string;
65
+ } | undefined;
66
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
67
+ export declare function getNotificationPreferences(c: AppContext): Promise<Response & import("hono").TypedResponse<{
68
+ success: boolean;
69
+ message: string;
70
+ data?: {
71
+ id: string;
72
+ account_id: string;
73
+ type: string;
74
+ email_enabled: boolean;
75
+ push_enabled: boolean;
76
+ in_app_enabled: boolean;
77
+ created_at: string;
78
+ updated_at: string;
79
+ }[] | undefined;
80
+ errors?: string[] | {
81
+ [x: string]: string;
82
+ } | undefined;
83
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
84
+ export declare function updateNotificationPreferences(c: AppContext): Promise<Response & import("hono").TypedResponse<{
85
+ success: boolean;
86
+ message: string;
87
+ data?: null | undefined;
88
+ errors?: string[] | {
89
+ [x: string]: string;
90
+ } | undefined;
91
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
92
+ export {};
93
+ //# sourceMappingURL=notifications.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.controller.d.ts","sourceRoot":"","sources":["../../src/controller/notifications.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAKjD,KAAK,UAAU,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC,CAAA;AAQtD,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAMpD;AAED,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,UAAU;;;;;;;mEAIvD;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAAE,UAAU;;;;;;;mEAG3D;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,UAAU;;;;;;;mEAIrD;AAED,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;mEAG7D;AAED,wBAAsB,6BAA6B,CAAC,CAAC,EAAE,UAAU;;;;;;;mEAIhE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import { ApiResponse } from 'vonosan/server';
11
+ import { NotificationsService } from '../service/notifications.service.js';
12
+ function getService(c) {
13
+ return new NotificationsService(c.var.db);
14
+ }
15
+ // ─── Controllers ─────────────────────────────────────────────────────────────
16
+ export async function listNotifications(c) {
17
+ const accountId = c.var.account.id;
18
+ const page = Number(c.req.query('page') ?? 1);
19
+ const limit = Number(c.req.query('limit') ?? 20);
20
+ const result = await getService(c).list(accountId, page, limit);
21
+ return c.json(ApiResponse.success(result, 'Notifications retrieved'));
22
+ }
23
+ export async function markNotificationRead(c) {
24
+ const id = c.req.param('id');
25
+ await getService(c).markRead(id, c.var.account.id);
26
+ return c.json(ApiResponse.success(null, 'Notification marked as read'));
27
+ }
28
+ export async function markAllNotificationsRead(c) {
29
+ await getService(c).markAllRead(c.var.account.id);
30
+ return c.json(ApiResponse.success(null, 'All notifications marked as read'));
31
+ }
32
+ export async function deleteNotification(c) {
33
+ const id = c.req.param('id');
34
+ await getService(c).delete(id, c.var.account.id);
35
+ return c.json(ApiResponse.success(null, 'Notification deleted'));
36
+ }
37
+ export async function getNotificationPreferences(c) {
38
+ const prefs = await getService(c).getPreferences(c.var.account.id);
39
+ return c.json(ApiResponse.success(prefs, 'Preferences retrieved'));
40
+ }
41
+ export async function updateNotificationPreferences(c) {
42
+ const { type, ...data } = await c.req.json();
43
+ await getService(c).updatePreferences(c.var.account.id, type, data);
44
+ return c.json(ApiResponse.success(null, 'Preferences updated'));
45
+ }
46
+ //# sourceMappingURL=notifications.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.controller.js","sourceRoot":"","sources":["../../src/controller/notifications.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAI1E,SAAS,UAAU,CAAC,CAAa;IAC/B,OAAO,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAwB,CAAC,CAAA;AACjE,CAAC;AAED,gFAAgF;AAEhF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,CAAa;IACnD,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAChD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IAC/D,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,CAAa;IACtD,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,UAAU,CAAC,CAAC,CAAC,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AAC,GAAG,CAAC,IAAI,EAA+F,CAAA;IACzI,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACnE,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAA;AACjE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ export { notifications, notificationPreferences } from './schema.js';
11
+ export { NotificationsService } from './service/notifications.service.js';
12
+ export type { NotificationPreferenceUpdate } from './service/notifications.service.js';
13
+ export { default as notificationsRouter } from './routes/notifications.routes.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AACzE,YAAY,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAA;AACtF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,kCAAkC,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ export { notifications, notificationPreferences } from './schema.js';
11
+ export { NotificationsService } from './service/notifications.service.js';
12
+ export { default as notificationsRouter } from './routes/notifications.routes.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAEzE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,kCAAkC,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import { Hono } from 'hono';
11
+ import type { AppVariables } from 'vonosan/types';
12
+ declare const notificationsRouter: Hono<{
13
+ Variables: AppVariables;
14
+ }, import("hono/types").BlankSchema, "/">;
15
+ export default notificationsRouter;
16
+ //# sourceMappingURL=notifications.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.routes.d.ts","sourceRoot":"","sources":["../../src/routes/notifications.routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAUjD,QAAA,MAAM,mBAAmB;eAAyB,YAAY;yCAAK,CAAA;AASnE,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import { Hono } from 'hono';
11
+ import { listNotifications, markNotificationRead, markAllNotificationsRead, deleteNotification, getNotificationPreferences, updateNotificationPreferences, } from '../controller/notifications.controller.js';
12
+ const notificationsRouter = new Hono();
13
+ notificationsRouter.get('/', listNotifications);
14
+ notificationsRouter.patch('/read-all', markAllNotificationsRead);
15
+ notificationsRouter.patch('/:id/read', markNotificationRead);
16
+ notificationsRouter.delete('/:id', deleteNotification);
17
+ notificationsRouter.get('/preferences', getNotificationPreferences);
18
+ notificationsRouter.put('/preferences', updateNotificationPreferences);
19
+ export default notificationsRouter;
20
+ //# sourceMappingURL=notifications.routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.routes.js","sourceRoot":"","sources":["../../src/routes/notifications.routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,2CAA2C,CAAA;AAElD,MAAM,mBAAmB,GAAG,IAAI,IAAI,EAA+B,CAAA;AAEnE,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAA;AAC/C,mBAAmB,CAAC,KAAK,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAA;AAChE,mBAAmB,CAAC,KAAK,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;AAC5D,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;AACtD,mBAAmB,CAAC,GAAG,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAA;AACnE,mBAAmB,CAAC,GAAG,CAAC,cAAc,EAAE,6BAA6B,CAAC,CAAA;AAEtE,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,320 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ /**
11
+ * notifications — in-app notification records.
12
+ * Soft-deleted via `deleted_at`; read state tracked via `read_at`.
13
+ */
14
+ export declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
15
+ name: "notifications";
16
+ schema: undefined;
17
+ columns: {
18
+ id: import("drizzle-orm/pg-core").PgColumn<{
19
+ name: "id";
20
+ tableName: "notifications";
21
+ dataType: "string";
22
+ columnType: "PgText";
23
+ data: string;
24
+ driverParam: string;
25
+ notNull: true;
26
+ hasDefault: false;
27
+ isPrimaryKey: true;
28
+ isAutoincrement: false;
29
+ hasRuntimeDefault: false;
30
+ enumValues: [string, ...string[]];
31
+ baseColumn: never;
32
+ identity: undefined;
33
+ generated: undefined;
34
+ }, {}, {}>;
35
+ account_id: import("drizzle-orm/pg-core").PgColumn<{
36
+ name: "account_id";
37
+ tableName: "notifications";
38
+ dataType: "string";
39
+ columnType: "PgText";
40
+ data: string;
41
+ driverParam: string;
42
+ notNull: true;
43
+ hasDefault: false;
44
+ isPrimaryKey: false;
45
+ isAutoincrement: false;
46
+ hasRuntimeDefault: false;
47
+ enumValues: [string, ...string[]];
48
+ baseColumn: never;
49
+ identity: undefined;
50
+ generated: undefined;
51
+ }, {}, {}>;
52
+ type: import("drizzle-orm/pg-core").PgColumn<{
53
+ name: "type";
54
+ tableName: "notifications";
55
+ dataType: "string";
56
+ columnType: "PgText";
57
+ data: string;
58
+ driverParam: string;
59
+ notNull: true;
60
+ hasDefault: false;
61
+ isPrimaryKey: false;
62
+ isAutoincrement: false;
63
+ hasRuntimeDefault: false;
64
+ enumValues: [string, ...string[]];
65
+ baseColumn: never;
66
+ identity: undefined;
67
+ generated: undefined;
68
+ }, {}, {}>;
69
+ title: import("drizzle-orm/pg-core").PgColumn<{
70
+ name: "title";
71
+ tableName: "notifications";
72
+ dataType: "string";
73
+ columnType: "PgText";
74
+ data: string;
75
+ driverParam: string;
76
+ notNull: true;
77
+ hasDefault: false;
78
+ isPrimaryKey: false;
79
+ isAutoincrement: false;
80
+ hasRuntimeDefault: false;
81
+ enumValues: [string, ...string[]];
82
+ baseColumn: never;
83
+ identity: undefined;
84
+ generated: undefined;
85
+ }, {}, {}>;
86
+ body: import("drizzle-orm/pg-core").PgColumn<{
87
+ name: "body";
88
+ tableName: "notifications";
89
+ dataType: "string";
90
+ columnType: "PgText";
91
+ data: string;
92
+ driverParam: string;
93
+ notNull: true;
94
+ hasDefault: false;
95
+ isPrimaryKey: false;
96
+ isAutoincrement: false;
97
+ hasRuntimeDefault: false;
98
+ enumValues: [string, ...string[]];
99
+ baseColumn: never;
100
+ identity: undefined;
101
+ generated: undefined;
102
+ }, {}, {}>;
103
+ data: import("drizzle-orm/pg-core").PgColumn<{
104
+ name: "data";
105
+ tableName: "notifications";
106
+ dataType: "json";
107
+ columnType: "PgJsonb";
108
+ data: unknown;
109
+ driverParam: unknown;
110
+ notNull: false;
111
+ hasDefault: false;
112
+ isPrimaryKey: false;
113
+ isAutoincrement: false;
114
+ hasRuntimeDefault: false;
115
+ enumValues: undefined;
116
+ baseColumn: never;
117
+ identity: undefined;
118
+ generated: undefined;
119
+ }, {}, {}>;
120
+ read_at: import("drizzle-orm/pg-core").PgColumn<{
121
+ name: "read_at";
122
+ tableName: "notifications";
123
+ dataType: "date";
124
+ columnType: "PgTimestamp";
125
+ data: Date;
126
+ driverParam: string;
127
+ notNull: false;
128
+ hasDefault: false;
129
+ isPrimaryKey: false;
130
+ isAutoincrement: false;
131
+ hasRuntimeDefault: false;
132
+ enumValues: undefined;
133
+ baseColumn: never;
134
+ identity: undefined;
135
+ generated: undefined;
136
+ }, {}, {}>;
137
+ created_at: import("drizzle-orm/pg-core").PgColumn<{
138
+ name: "created_at";
139
+ tableName: "notifications";
140
+ dataType: "date";
141
+ columnType: "PgTimestamp";
142
+ data: Date;
143
+ driverParam: string;
144
+ notNull: true;
145
+ hasDefault: true;
146
+ isPrimaryKey: false;
147
+ isAutoincrement: false;
148
+ hasRuntimeDefault: false;
149
+ enumValues: undefined;
150
+ baseColumn: never;
151
+ identity: undefined;
152
+ generated: undefined;
153
+ }, {}, {}>;
154
+ deleted_at: import("drizzle-orm/pg-core").PgColumn<{
155
+ name: "deleted_at";
156
+ tableName: "notifications";
157
+ dataType: "date";
158
+ columnType: "PgTimestamp";
159
+ data: Date;
160
+ driverParam: string;
161
+ notNull: false;
162
+ hasDefault: false;
163
+ isPrimaryKey: false;
164
+ isAutoincrement: false;
165
+ hasRuntimeDefault: false;
166
+ enumValues: undefined;
167
+ baseColumn: never;
168
+ identity: undefined;
169
+ generated: undefined;
170
+ }, {}, {}>;
171
+ };
172
+ dialect: "pg";
173
+ }>;
174
+ /**
175
+ * notification_preferences — per-account, per-type delivery preferences.
176
+ */
177
+ export declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWithColumns<{
178
+ name: "notification_preferences";
179
+ schema: undefined;
180
+ columns: {
181
+ id: import("drizzle-orm/pg-core").PgColumn<{
182
+ name: "id";
183
+ tableName: "notification_preferences";
184
+ dataType: "string";
185
+ columnType: "PgText";
186
+ data: string;
187
+ driverParam: string;
188
+ notNull: true;
189
+ hasDefault: false;
190
+ isPrimaryKey: true;
191
+ isAutoincrement: false;
192
+ hasRuntimeDefault: false;
193
+ enumValues: [string, ...string[]];
194
+ baseColumn: never;
195
+ identity: undefined;
196
+ generated: undefined;
197
+ }, {}, {}>;
198
+ account_id: import("drizzle-orm/pg-core").PgColumn<{
199
+ name: "account_id";
200
+ tableName: "notification_preferences";
201
+ dataType: "string";
202
+ columnType: "PgText";
203
+ data: string;
204
+ driverParam: string;
205
+ notNull: true;
206
+ hasDefault: false;
207
+ isPrimaryKey: false;
208
+ isAutoincrement: false;
209
+ hasRuntimeDefault: false;
210
+ enumValues: [string, ...string[]];
211
+ baseColumn: never;
212
+ identity: undefined;
213
+ generated: undefined;
214
+ }, {}, {}>;
215
+ type: import("drizzle-orm/pg-core").PgColumn<{
216
+ name: "type";
217
+ tableName: "notification_preferences";
218
+ dataType: "string";
219
+ columnType: "PgText";
220
+ data: string;
221
+ driverParam: string;
222
+ notNull: true;
223
+ hasDefault: false;
224
+ isPrimaryKey: false;
225
+ isAutoincrement: false;
226
+ hasRuntimeDefault: false;
227
+ enumValues: [string, ...string[]];
228
+ baseColumn: never;
229
+ identity: undefined;
230
+ generated: undefined;
231
+ }, {}, {}>;
232
+ email_enabled: import("drizzle-orm/pg-core").PgColumn<{
233
+ name: "email_enabled";
234
+ tableName: "notification_preferences";
235
+ dataType: "boolean";
236
+ columnType: "PgBoolean";
237
+ data: boolean;
238
+ driverParam: boolean;
239
+ notNull: true;
240
+ hasDefault: true;
241
+ isPrimaryKey: false;
242
+ isAutoincrement: false;
243
+ hasRuntimeDefault: false;
244
+ enumValues: undefined;
245
+ baseColumn: never;
246
+ identity: undefined;
247
+ generated: undefined;
248
+ }, {}, {}>;
249
+ push_enabled: import("drizzle-orm/pg-core").PgColumn<{
250
+ name: "push_enabled";
251
+ tableName: "notification_preferences";
252
+ dataType: "boolean";
253
+ columnType: "PgBoolean";
254
+ data: boolean;
255
+ driverParam: boolean;
256
+ notNull: true;
257
+ hasDefault: true;
258
+ isPrimaryKey: false;
259
+ isAutoincrement: false;
260
+ hasRuntimeDefault: false;
261
+ enumValues: undefined;
262
+ baseColumn: never;
263
+ identity: undefined;
264
+ generated: undefined;
265
+ }, {}, {}>;
266
+ in_app_enabled: import("drizzle-orm/pg-core").PgColumn<{
267
+ name: "in_app_enabled";
268
+ tableName: "notification_preferences";
269
+ dataType: "boolean";
270
+ columnType: "PgBoolean";
271
+ data: boolean;
272
+ driverParam: boolean;
273
+ notNull: true;
274
+ hasDefault: true;
275
+ isPrimaryKey: false;
276
+ isAutoincrement: false;
277
+ hasRuntimeDefault: false;
278
+ enumValues: undefined;
279
+ baseColumn: never;
280
+ identity: undefined;
281
+ generated: undefined;
282
+ }, {}, {}>;
283
+ created_at: import("drizzle-orm/pg-core").PgColumn<{
284
+ name: "created_at";
285
+ tableName: "notification_preferences";
286
+ dataType: "date";
287
+ columnType: "PgTimestamp";
288
+ data: Date;
289
+ driverParam: string;
290
+ notNull: true;
291
+ hasDefault: true;
292
+ isPrimaryKey: false;
293
+ isAutoincrement: false;
294
+ hasRuntimeDefault: false;
295
+ enumValues: undefined;
296
+ baseColumn: never;
297
+ identity: undefined;
298
+ generated: undefined;
299
+ }, {}, {}>;
300
+ updated_at: import("drizzle-orm/pg-core").PgColumn<{
301
+ name: "updated_at";
302
+ tableName: "notification_preferences";
303
+ dataType: "date";
304
+ columnType: "PgTimestamp";
305
+ data: Date;
306
+ driverParam: string;
307
+ notNull: true;
308
+ hasDefault: true;
309
+ isPrimaryKey: false;
310
+ isAutoincrement: false;
311
+ hasRuntimeDefault: false;
312
+ enumValues: undefined;
313
+ baseColumn: never;
314
+ identity: undefined;
315
+ generated: undefined;
316
+ }, {}, {}>;
317
+ };
318
+ dialect: "pg";
319
+ }>;
320
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBzB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBnC,CAAA"}
package/dist/schema.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import { pgTable, text, timestamp, boolean, jsonb, index, } from 'drizzle-orm/pg-core';
11
+ // ─── notifications ────────────────────────────────────────────────────────────
12
+ /**
13
+ * notifications — in-app notification records.
14
+ * Soft-deleted via `deleted_at`; read state tracked via `read_at`.
15
+ */
16
+ export const notifications = pgTable('notifications', {
17
+ id: text('id').primaryKey(),
18
+ account_id: text('account_id').notNull(),
19
+ type: text('type').notNull(),
20
+ title: text('title').notNull(),
21
+ body: text('body').notNull(),
22
+ data: jsonb('data'),
23
+ read_at: timestamp('read_at', { withTimezone: true, mode: 'date' }),
24
+ created_at: timestamp('created_at', { withTimezone: true, mode: 'date' }).notNull().defaultNow(),
25
+ deleted_at: timestamp('deleted_at', { withTimezone: true, mode: 'date' }),
26
+ }, (t) => [
27
+ index('notifications_account_id_idx').on(t.account_id),
28
+ index('notifications_type_idx').on(t.type),
29
+ index('notifications_read_at_idx').on(t.read_at),
30
+ ]);
31
+ // ─── notification_preferences ─────────────────────────────────────────────────
32
+ /**
33
+ * notification_preferences — per-account, per-type delivery preferences.
34
+ */
35
+ export const notificationPreferences = pgTable('notification_preferences', {
36
+ id: text('id').primaryKey(),
37
+ account_id: text('account_id').notNull(),
38
+ type: text('type').notNull(),
39
+ email_enabled: boolean('email_enabled').notNull().default(true),
40
+ push_enabled: boolean('push_enabled').notNull().default(true),
41
+ in_app_enabled: boolean('in_app_enabled').notNull().default(true),
42
+ created_at: timestamp('created_at', { withTimezone: true, mode: 'date' }).notNull().defaultNow(),
43
+ updated_at: timestamp('updated_at', { withTimezone: true, mode: 'date' }).notNull().defaultNow(),
44
+ }, (t) => [
45
+ index('notification_prefs_account_id_idx').on(t.account_id),
46
+ index('notification_prefs_type_idx').on(t.type),
47
+ ]);
48
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,OAAO,EACP,KAAK,EACL,KAAK,GACN,MAAM,qBAAqB,CAAA;AAE5B,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAClC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACxC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;IAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;IACnB,OAAO,EAAE,SAAS,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACnE,UAAU,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EA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E;CACjG,EACD,CAAC,CAAC,EAAE,EAAE,CAAC;IACL,KAAK,CAAC,mCAAmC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAC3D,KAAK,CAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;CAChD,CACF,CAAA"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import type { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
11
+ export interface NotificationPreferenceUpdate {
12
+ email_enabled?: boolean;
13
+ push_enabled?: boolean;
14
+ in_app_enabled?: boolean;
15
+ }
16
+ /**
17
+ * NotificationsService — manages in-app notifications and delivery preferences.
18
+ */
19
+ export declare class NotificationsService {
20
+ private readonly db;
21
+ constructor(db: PostgresJsDatabase);
22
+ /**
23
+ * Paginated list of notifications for an account (excludes soft-deleted).
24
+ */
25
+ list(accountId: string, page: number, limit: number): Promise<{
26
+ items: {
27
+ id: string;
28
+ account_id: string;
29
+ type: string;
30
+ title: string;
31
+ body: string;
32
+ data: unknown;
33
+ read_at: Date | null;
34
+ created_at: Date;
35
+ deleted_at: Date | null;
36
+ }[];
37
+ meta: import("packages/vonosan/src/shared/utils/pagination.js").PaginationMeta;
38
+ }>;
39
+ /**
40
+ * Mark a single notification as read.
41
+ */
42
+ markRead(id: string, accountId: string): Promise<void>;
43
+ /**
44
+ * Mark all unread notifications for an account as read.
45
+ */
46
+ markAllRead(accountId: string): Promise<void>;
47
+ /**
48
+ * Soft-delete a notification.
49
+ */
50
+ delete(id: string, accountId: string): Promise<void>;
51
+ /**
52
+ * Get all notification preferences for an account.
53
+ */
54
+ getPreferences(accountId: string): Promise<{
55
+ id: string;
56
+ account_id: string;
57
+ type: string;
58
+ email_enabled: boolean;
59
+ push_enabled: boolean;
60
+ in_app_enabled: boolean;
61
+ created_at: Date;
62
+ updated_at: Date;
63
+ }[]>;
64
+ /**
65
+ * Upsert notification preferences for a specific type.
66
+ */
67
+ updatePreferences(accountId: string, type: string, data: NotificationPreferenceUpdate): Promise<void>;
68
+ /**
69
+ * Create a notification.
70
+ * Dispatches to queue if available, otherwise inserts synchronously.
71
+ */
72
+ create(accountId: string, type: string, title: string, body: string, data?: Record<string, unknown>): Promise<{
73
+ id: string;
74
+ }>;
75
+ }
76
+ //# sourceMappingURL=notifications.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.service.d.ts","sourceRoot":"","sources":["../../src/service/notifications.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,MAAM,WAAW,4BAA4B;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAID;;GAEG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,kBAAkB;IAInD;;OAEG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;;;;;;;;;;;;IAuBzD;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5D;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;IAStC;;OAEG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,4BAA4B;IAgCpC;;;OAGG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;CAiBjC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * ──────────────────────────────────────────────────────────────────
3
+ * 🏢 Company Name: Bonifade Technologies
4
+ * 👨‍💻 Developer: Bowofade Oyerinde
5
+ * 🐙 GitHub: oyenet1
6
+ * 📅 Created Date: 2026-04-05
7
+ * 🔄 Updated Date: 2026-04-05
8
+ * ──────────────────────────────────────────────────────────────────
9
+ */
10
+ import { eq, and, isNull, desc } from 'drizzle-orm';
11
+ import { generateId, buildPaginationMeta, Logger } from 'vonosan/server';
12
+ import { notifications, notificationPreferences } from '../schema.js';
13
+ // ─── NotificationsService ─────────────────────────────────────────────────────
14
+ /**
15
+ * NotificationsService — manages in-app notifications and delivery preferences.
16
+ */
17
+ export class NotificationsService {
18
+ db;
19
+ constructor(db) {
20
+ this.db = db;
21
+ }
22
+ // ─── list ───────────────────────────────────────────────────────────────────
23
+ /**
24
+ * Paginated list of notifications for an account (excludes soft-deleted).
25
+ */
26
+ async list(accountId, page, limit) {
27
+ const offset = (page - 1) * limit;
28
+ const rows = await this.db
29
+ .select()
30
+ .from(notifications)
31
+ .where(and(eq(notifications.account_id, accountId), isNull(notifications.deleted_at)))
32
+ .orderBy(desc(notifications.created_at))
33
+ .limit(limit)
34
+ .offset(offset);
35
+ // Count total
36
+ const countRows = await this.db
37
+ .select({ id: notifications.id })
38
+ .from(notifications)
39
+ .where(and(eq(notifications.account_id, accountId), isNull(notifications.deleted_at)));
40
+ const total = countRows.length;
41
+ return { items: rows, meta: buildPaginationMeta(page, limit, total) };
42
+ }
43
+ // ─── markRead ───────────────────────────────────────────────────────────────
44
+ /**
45
+ * Mark a single notification as read.
46
+ */
47
+ async markRead(id, accountId) {
48
+ await this.db
49
+ .update(notifications)
50
+ .set({ read_at: new Date() })
51
+ .where(and(eq(notifications.id, id), eq(notifications.account_id, accountId)));
52
+ }
53
+ // ─── markAllRead ────────────────────────────────────────────────────────────
54
+ /**
55
+ * Mark all unread notifications for an account as read.
56
+ */
57
+ async markAllRead(accountId) {
58
+ await this.db
59
+ .update(notifications)
60
+ .set({ read_at: new Date() })
61
+ .where(and(eq(notifications.account_id, accountId), isNull(notifications.read_at)));
62
+ }
63
+ // ─── delete ─────────────────────────────────────────────────────────────────
64
+ /**
65
+ * Soft-delete a notification.
66
+ */
67
+ async delete(id, accountId) {
68
+ await this.db
69
+ .update(notifications)
70
+ .set({ deleted_at: new Date() })
71
+ .where(and(eq(notifications.id, id), eq(notifications.account_id, accountId)));
72
+ }
73
+ // ─── getPreferences ─────────────────────────────────────────────────────────
74
+ /**
75
+ * Get all notification preferences for an account.
76
+ */
77
+ async getPreferences(accountId) {
78
+ return this.db
79
+ .select()
80
+ .from(notificationPreferences)
81
+ .where(eq(notificationPreferences.account_id, accountId));
82
+ }
83
+ // ─── updatePreferences ──────────────────────────────────────────────────────
84
+ /**
85
+ * Upsert notification preferences for a specific type.
86
+ */
87
+ async updatePreferences(accountId, type, data) {
88
+ const existing = await this.db
89
+ .select({ id: notificationPreferences.id })
90
+ .from(notificationPreferences)
91
+ .where(and(eq(notificationPreferences.account_id, accountId), eq(notificationPreferences.type, type)))
92
+ .limit(1);
93
+ if (existing.length > 0) {
94
+ await this.db
95
+ .update(notificationPreferences)
96
+ .set({ ...data, updated_at: new Date() })
97
+ .where(eq(notificationPreferences.id, existing[0].id));
98
+ }
99
+ else {
100
+ await this.db.insert(notificationPreferences).values({
101
+ id: generateId(),
102
+ account_id: accountId,
103
+ type,
104
+ email_enabled: data.email_enabled ?? true,
105
+ push_enabled: data.push_enabled ?? true,
106
+ in_app_enabled: data.in_app_enabled ?? true,
107
+ });
108
+ }
109
+ }
110
+ // ─── create ─────────────────────────────────────────────────────────────────
111
+ /**
112
+ * Create a notification.
113
+ * Dispatches to queue if available, otherwise inserts synchronously.
114
+ */
115
+ async create(accountId, type, title, body, data) {
116
+ const id = generateId();
117
+ // Synchronous insert (queue dispatch would be wired here when available)
118
+ await this.db.insert(notifications).values({
119
+ id,
120
+ account_id: accountId,
121
+ type,
122
+ title,
123
+ body,
124
+ data: data ?? null,
125
+ });
126
+ Logger.info('[notifications] Notification created', { id, accountId, type });
127
+ return { id };
128
+ }
129
+ }
130
+ //# sourceMappingURL=notifications.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.service.js","sourceRoot":"","sources":["../../src/service/notifications.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAUrE,iFAAiF;AAEjF;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,EAAsB;QAAtB,OAAE,GAAF,EAAE,CAAoB;IAAG,CAAC;IAEvD,+EAA+E;IAE/E;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE,IAAY,EAAE,KAAa;QACvD,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;QAEjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE;aACvB,MAAM,EAAE;aACR,IAAI,CAAC,aAAa,CAAC;aACnB,KAAK,CAAC,GAAG,CAAC,EAAE,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/notifications",
3
+ "version": "0.2.1",
4
+ "type": "module",
5
+ "description": "Vono in-app notification module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/oyenet1/vonosan.git",
9
+ "directory": "packages/notifications"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc -p tsconfig.json",
27
+ "dev": "tsc -p tsconfig.json --watch"
28
+ },
29
+ "peerDependencies": {
30
+ "drizzle-orm": ">=0.44.0",
31
+ "hono": ">=4.8.0",
32
+ "vonosan": ">=0.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/bun": "1.2.14",
36
+ "@types/node": "25.5.2",
37
+ "drizzle-orm": "0.44.5",
38
+ "hono": "4.8.10",
39
+ "typescript": "5.8.3",
40
+ "vonosan": "0.2.1"
41
+ }
42
+ }