start of the 50th remake of a file host doomed to never be finished

This commit is contained in:
creations 2025-03-02 17:36:45 -05:00
commit 46c05ca3a9
Signed by: creations
GPG key ID: 8F553AA4320FC711
33 changed files with 2155 additions and 0 deletions

15
types/bun.d.ts vendored Normal file
View file

@ -0,0 +1,15 @@
import type { Server } from "bun";
type Query = Record<string, string>;
type Params = Record<string, string>;
declare global {
type BunServer = Server;
type ExtendedRequest = Request & {
startPerf: number;
query: Query;
params: Params;
session: UserSession | ApiUserSession | null;
};
}

10
types/config.d.ts vendored Normal file
View file

@ -0,0 +1,10 @@
type Environment = {
port: number;
host: string;
development: boolean;
};
type UserValidation = {
check: { valid: boolean; error?: string };
field: string;
};

3
types/ejs.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
interface EjsTemplateData {
[key: string]: string | number | boolean | object | undefined | null;
}

9
types/logger.d.ts vendored Normal file
View file

@ -0,0 +1,9 @@
type ILogMessagePart = { value: string; color: string };
type ILogMessageParts = {
level: ILogMessagePart;
filename: ILogMessagePart;
readableTimestamp: ILogMessagePart;
message: ILogMessagePart;
[key: string]: ILogMessagePart;
};

15
types/routes.d.ts vendored Normal file
View file

@ -0,0 +1,15 @@
type RouteDef = {
method: string;
accepts: string | null;
returns: string;
needsBody?: "multipart" | "json";
};
type RouteModule = {
handler: (
request: Request,
requestBody: unknown,
server: BunServer,
) => Promise<Response> | Response;
routeDef: RouteDef;
};

29
types/session.d.ts vendored Normal file
View file

@ -0,0 +1,29 @@
type UserSession = {
id: string;
username: string;
email: string;
email_verified: boolean;
roles: string[];
avatar: boolean;
timezone: string;
authorization_token: string;
};
type ApiUserSession = UserSession & {
is_api: boolean;
};
type User = {
id: UUID;
authorization_token: UUID;
username: string;
email: string;
email_verified: boolean;
password: string;
avatar: boolean;
roles: string[];
timezone: string;
invited_by: UUID;
created_at: Date;
last_seen: Date;
};