From 34d4dd8090553ccdbd4fb110a449dfa6635d60e1 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 6 Feb 2024 10:42:50 +0700 Subject: [PATCH] wip fix --- app/srv/ws/sync/actions/code_action.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/srv/ws/sync/actions/code_action.ts b/app/srv/ws/sync/actions/code_action.ts index 6ac12a12..e3541e9b 100644 --- a/app/srv/ws/sync/actions/code_action.ts +++ b/app/srv/ws/sync/actions/code_action.ts @@ -102,6 +102,26 @@ export const code_action: SAction["code"]["action"] = async function ( Bun.file(path.join(dir, "runtime/library.d.ts")), res.prisma["runtime/library.d.ts"] ); + await Bun.write( + Bun.file(path.join(dir, "global.d.ts")), + ` +import prisma from "./typings/prisma"; +import type * as SRVAPI from "gen/srv/api/srv"; + +declare global { + const db: prisma.PrismaClient; + + type Api = typeof SRVAPI; + type ApiName = keyof Api; + const api: { [k in ApiName]: Awaited["_"]["api"] }; +} + ` + ); + + Bun.spawn({ + cmd: ["chmod", "-R", "777", "."], + cwd: dir, + }); break; }