import { Server, WebSocketHandler } from "bun"; import { Logger } from "pino"; import { RadixRouter } from "radix3"; import { PrismaClient } from "../../app/db/db"; import admin from "firebase-admin"; import { Database } from "bun:sqlite"; import { prodIndex } from "./prod-index"; type SingleRoute = { url: string; args: string[]; fn: (...arg: any[]) => Promise; path: string; }; export type SinglePage = { id: string; url: string; name: true; content_tree: any; is_default_layout: true; }; type PrasiServer = { ws?: WebSocketHandler<{ url: string }>; http: (arg: { url: { raw: URL; pathname: string }; req: Request; server: Server; mode: "dev" | "prod"; handle: (req: Request) => Promise; index: { head: string[]; body: string[]; render: () => string }; }) => Promise; }; export const g = global as unknown as { db: PrismaClient; dburl: string; datadir: string; mode: "dev" | "prod"; server: Server; log: Logger; firebaseInit: boolean; firebase: admin.app.App; notif: { db: Database; }; api: Record; web: { site_id: string; current: number; deploying: null | { status: string; received: number; total: number }; deploys: number[]; router: RadixRouter; }; router: RadixRouter; port: number; frm: { js: string; etag: string; }; cache: { br: Record; br_timeout: Set; }; createServer: ( arg: PrasiServer & { api: any; db: any } ) => (site_id: string) => Promise; deploy: { init: boolean; raw: any; router?: RadixRouter<{ url: string; id: string }>; layout: null | any; comps: Record; pages: Record< string, { id: string; url: string; name: true; content_tree: any } >; gz: null | { layouts: SinglePage[]; pages: SinglePage[]; site: {}; comps: { id: string; content_tree: true }[]; code: { server: Record; site: Record; core: Record; }; }; config: { site_id: string; deploy: { ts: string }; }; server: PrasiServer | null; index: ReturnType | null; }; };