From 380b1ee440c6457f204a3fd60bbd0af4cb415d9c Mon Sep 17 00:00:00 2001 From: kabin thakuri Date: Thu, 4 Jun 2026 16:44:49 +0545 Subject: [PATCH 1/2] feat(firebase): decouple package from supertokens --- packages/firebase/package.json | 4 +--- packages/firebase/src/index.ts | 6 +++--- .../src/model/notification/handlers/sendNotification.ts | 5 ++--- .../firebase/src/model/userDevice/handlers/addUserDevice.ts | 5 ++--- .../src/model/userDevice/handlers/removeUserDevice.ts | 5 ++--- pnpm-lock.yaml | 3 --- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/packages/firebase/package.json b/packages/firebase/package.json index 2a5162f84..7af8d463f 100644 --- a/packages/firebase/package.json +++ b/packages/firebase/package.json @@ -49,7 +49,6 @@ "pg-mem": "3.0.14", "prettier": "3.8.3", "slonik": "46.8.0", - "supertokens-node": "14.1.4", "typescript": "5.9.3", "vite": "6.4.2", "vitest": "3.2.4" @@ -62,8 +61,7 @@ "fastify": ">=5.2.2", "fastify-plugin": ">=5.0.1", "mercurius": ">=16.1.0", - "slonik": ">=46.1.0", - "supertokens-node": ">=14.1.4" + "slonik": ">=46.1.0" }, "engines": { "node": ">=20" diff --git a/packages/firebase/src/index.ts b/packages/firebase/src/index.ts index 9939b7e86..b457586b1 100644 --- a/packages/firebase/src/index.ts +++ b/packages/firebase/src/index.ts @@ -1,5 +1,3 @@ -import { verifySession } from "supertokens-node/recipe/session/framework/fastify"; - import type { User } from "./types"; import notificationHandlers from "./model/notification/handlers"; @@ -7,7 +5,9 @@ import deviceHandlers from "./model/userDevice/handlers"; declare module "fastify" { interface FastifyInstance { - verifySession: typeof verifySession; + verifySession: (options?: { + sessionRequired?: boolean; + }) => (request: FastifyRequest, reply: FastifyReply) => Promise; } interface FastifyRequest { diff --git a/packages/firebase/src/model/notification/handlers/sendNotification.ts b/packages/firebase/src/model/notification/handlers/sendNotification.ts index 4a43a4ce8..add06bfbc 100644 --- a/packages/firebase/src/model/notification/handlers/sendNotification.ts +++ b/packages/firebase/src/model/notification/handlers/sendNotification.ts @@ -1,6 +1,5 @@ -import type { FastifyReply } from "fastify"; +import type { FastifyReply, FastifyRequest } from "fastify"; import type { MulticastMessage } from "firebase-admin/lib/messaging/messaging-api"; -import type { SessionRequest } from "supertokens-node/framework/fastify"; import type { TestNotificationInput } from "../../../types"; @@ -8,7 +7,7 @@ import { sendPushNotification } from "../../../lib"; import DeviceService from "../../userDevice/service"; const testPushNotification = async ( - request: SessionRequest, + request: FastifyRequest, reply: FastifyReply, ) => { const user = request.user; diff --git a/packages/firebase/src/model/userDevice/handlers/addUserDevice.ts b/packages/firebase/src/model/userDevice/handlers/addUserDevice.ts index 8f29555f2..c342a1e36 100644 --- a/packages/firebase/src/model/userDevice/handlers/addUserDevice.ts +++ b/packages/firebase/src/model/userDevice/handlers/addUserDevice.ts @@ -1,11 +1,10 @@ -import type { FastifyReply } from "fastify"; -import type { SessionRequest } from "supertokens-node/framework/fastify"; +import type { FastifyReply, FastifyRequest } from "fastify"; import type { UserDeviceCreateInput } from "../../../types"; import Service from "../service"; -const addUserDevice = async (request: SessionRequest, reply: FastifyReply) => { +const addUserDevice = async (request: FastifyRequest, reply: FastifyReply) => { const { body, config, dbSchema, slonik, user } = request; if (!user) { diff --git a/packages/firebase/src/model/userDevice/handlers/removeUserDevice.ts b/packages/firebase/src/model/userDevice/handlers/removeUserDevice.ts index f5f8504fb..3821047db 100644 --- a/packages/firebase/src/model/userDevice/handlers/removeUserDevice.ts +++ b/packages/firebase/src/model/userDevice/handlers/removeUserDevice.ts @@ -1,10 +1,9 @@ -import type { FastifyReply } from "fastify"; -import type { SessionRequest } from "supertokens-node/framework/fastify"; +import type { FastifyReply, FastifyRequest } from "fastify"; import Service from "../service"; const removeUserDevice = async ( - request: SessionRequest, + request: FastifyRequest, reply: FastifyReply, ) => { const user = request.user; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72ce9811f..90e71264d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -182,9 +182,6 @@ importers: slonik: specifier: 46.8.0 version: 46.8.0(zod@3.25.76) - supertokens-node: - specifier: 14.1.4 - version: 14.1.4 typescript: specifier: 5.9.3 version: 5.9.3 From 4525b808c70c04048b50c3934c8c005b48528c93 Mon Sep 17 00:00:00 2001 From: kabin thakuri Date: Fri, 5 Jun 2026 14:15:23 +0545 Subject: [PATCH 2/2] fix(firebase/notification): rename 'body' to 'message' in TestNotificationInput interface --- .../src/model/notification/handlers/sendNotification.ts | 2 +- packages/firebase/src/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/firebase/src/model/notification/handlers/sendNotification.ts b/packages/firebase/src/model/notification/handlers/sendNotification.ts index add06bfbc..c7e688c3f 100644 --- a/packages/firebase/src/model/notification/handlers/sendNotification.ts +++ b/packages/firebase/src/model/notification/handlers/sendNotification.ts @@ -17,8 +17,8 @@ const testPushNotification = async ( } const { - body, data, + message: body, title, userId: receiverId, } = request.body as TestNotificationInput; diff --git a/packages/firebase/src/types.ts b/packages/firebase/src/types.ts index 65b7d49c9..eafb92294 100644 --- a/packages/firebase/src/types.ts +++ b/packages/firebase/src/types.ts @@ -1,10 +1,10 @@ import "@prefabs.tech/fastify-error-handler"; interface TestNotificationInput { - body: string; data?: { [key: string]: string; }; + message: string; title: string; userId: string; }