@checkstack/notification-backend 0.1.5 → 0.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @checkstack/notification-backend
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 66a3963: Update database types to use SafeDatabase
8
+
9
+ - Updated all database type declarations from `NodePgDatabase` to `SafeDatabase` for compile-time safety
10
+
11
+ - Updated dependencies [2c0822d]
12
+ - Updated dependencies [66a3963]
13
+ - Updated dependencies [66a3963]
14
+ - @checkstack/queue-api@0.2.0
15
+ - @checkstack/auth-backend@0.4.3
16
+ - @checkstack/backend-api@0.5.0
17
+
18
+ ## 0.1.6
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [8a87cd4]
23
+ - Updated dependencies [8a87cd4]
24
+ - Updated dependencies [8a87cd4]
25
+ - @checkstack/auth-common@0.5.2
26
+ - @checkstack/backend-api@0.4.1
27
+ - @checkstack/common@0.5.0
28
+ - @checkstack/auth-backend@0.4.2
29
+ - @checkstack/queue-api@0.1.3
30
+ - @checkstack/notification-common@0.2.2
31
+ - @checkstack/signal-common@0.1.3
32
+
3
33
  ## 0.1.5
4
34
 
5
35
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/notification-backend",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "checkstack": {
@@ -9,12 +9,12 @@ import type {
9
9
  NotificationStrategyRegistry,
10
10
  ConfigService,
11
11
  } from "@checkstack/backend-api";
12
- import type { NodePgDatabase } from "drizzle-orm/node-postgres";
12
+ import type { SafeDatabase } from "@checkstack/backend-api";
13
13
  import { createStrategyService } from "./strategy-service";
14
14
  import type * as schema from "./schema";
15
15
 
16
16
  export interface OAuthCallbackDeps {
17
- db: NodePgDatabase<typeof schema>;
17
+ db: SafeDatabase<typeof schema>;
18
18
  configService: ConfigService;
19
19
  strategyRegistry: NotificationStrategyRegistry;
20
20
  baseUrl: string;
package/src/router.ts CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  } from "@checkstack/notification-common";
19
19
  import { AuthApi } from "@checkstack/auth-common";
20
20
  import type { SignalService } from "@checkstack/signal-common";
21
- import { NodePgDatabase } from "drizzle-orm/node-postgres";
21
+ import { SafeDatabase } from "@checkstack/backend-api";
22
22
  import * as schema from "./schema";
23
23
  import {
24
24
  getUserNotifications,
@@ -89,7 +89,7 @@ function resolveContact({
89
89
  * based on the contract's meta.userType and meta.access.
90
90
  */
91
91
  export const createNotificationRouter = (
92
- database: NodePgDatabase<typeof schema>,
92
+ database: SafeDatabase<typeof schema>,
93
93
  configService: ConfigService,
94
94
  signalService: SignalService,
95
95
  strategyRegistry: NotificationStrategyRegistry,
package/src/service.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { NodePgDatabase } from "drizzle-orm/node-postgres";
1
+ import type { SafeDatabase } from "@checkstack/backend-api";
2
2
  import { eq, and, count, desc, lt } from "drizzle-orm";
3
3
  import * as schema from "./schema";
4
4
 
@@ -8,7 +8,7 @@ import * as schema from "./schema";
8
8
  * Get notifications for a user (for router use)
9
9
  */
10
10
  export async function getUserNotifications(
11
- db: NodePgDatabase<typeof schema>,
11
+ db: SafeDatabase<typeof schema>,
12
12
  userId: string,
13
13
  options: { limit: number; offset: number; unreadOnly: boolean }
14
14
  ): Promise<{
@@ -44,7 +44,7 @@ export async function getUserNotifications(
44
44
  * Get unread count for a user
45
45
  */
46
46
  export async function getUnreadCount(
47
- db: NodePgDatabase<typeof schema>,
47
+ db: SafeDatabase<typeof schema>,
48
48
  userId: string
49
49
  ): Promise<number> {
50
50
  const result = await db
@@ -64,7 +64,7 @@ export async function getUnreadCount(
64
64
  * Mark notification(s) as read
65
65
  */
66
66
  export async function markAsRead(
67
- db: NodePgDatabase<typeof schema>,
67
+ db: SafeDatabase<typeof schema>,
68
68
  userId: string,
69
69
  notificationId?: string
70
70
  ): Promise<void> {
@@ -85,7 +85,7 @@ export async function markAsRead(
85
85
  * Delete a notification
86
86
  */
87
87
  export async function deleteNotification(
88
- db: NodePgDatabase<typeof schema>,
88
+ db: SafeDatabase<typeof schema>,
89
89
  userId: string,
90
90
  notificationId: string
91
91
  ): Promise<void> {
@@ -103,7 +103,7 @@ export async function deleteNotification(
103
103
  * Get all notification groups
104
104
  */
105
105
  export async function getAllGroups(
106
- db: NodePgDatabase<typeof schema>
106
+ db: SafeDatabase<typeof schema>
107
107
  ): Promise<(typeof schema.notificationGroups.$inferSelect)[]> {
108
108
  return db.select().from(schema.notificationGroups);
109
109
  }
@@ -112,7 +112,7 @@ export async function getAllGroups(
112
112
  * Get user's subscriptions with enriched group details
113
113
  */
114
114
  export async function getEnrichedUserSubscriptions(
115
- db: NodePgDatabase<typeof schema>,
115
+ db: SafeDatabase<typeof schema>,
116
116
  userId: string
117
117
  ): Promise<
118
118
  {
@@ -145,7 +145,7 @@ export async function getEnrichedUserSubscriptions(
145
145
  * Subscribe user to a group
146
146
  */
147
147
  export async function subscribeToGroup(
148
- db: NodePgDatabase<typeof schema>,
148
+ db: SafeDatabase<typeof schema>,
149
149
  userId: string,
150
150
  groupId: string
151
151
  ): Promise<void> {
@@ -173,7 +173,7 @@ export async function subscribeToGroup(
173
173
  * Unsubscribe user from a group
174
174
  */
175
175
  export async function unsubscribeFromGroup(
176
- db: NodePgDatabase<typeof schema>,
176
+ db: SafeDatabase<typeof schema>,
177
177
  userId: string,
178
178
  groupId: string
179
179
  ): Promise<void> {
@@ -196,7 +196,7 @@ export async function purgeOldNotifications({
196
196
  enabled,
197
197
  retentionDays,
198
198
  }: {
199
- db: NodePgDatabase<typeof schema>;
199
+ db: SafeDatabase<typeof schema>;
200
200
  enabled: boolean;
201
201
  retentionDays: number;
202
202
  }): Promise<number> {
@@ -11,7 +11,7 @@ import {
11
11
  configString,
12
12
  type ConfigService,
13
13
  } from "@checkstack/backend-api";
14
- import type { NodePgDatabase } from "drizzle-orm/node-postgres";
14
+ import type { SafeDatabase } from "@checkstack/backend-api";
15
15
  import type { NotificationStrategyRegistry } from "@checkstack/backend-api";
16
16
  import type * as schema from "./schema";
17
17
 
@@ -78,7 +78,7 @@ const STRATEGY_META_VERSION = 1;
78
78
  // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
79
 
80
80
  export interface StrategyServiceDeps {
81
- db: NodePgDatabase<typeof schema>;
81
+ db: SafeDatabase<typeof schema>;
82
82
  configService: ConfigService;
83
83
  strategyRegistry: NotificationStrategyRegistry;
84
84
  }