start of the 50th remake of a file host doomed to never be finished
This commit is contained in:
commit
46c05ca3a9
33 changed files with 2155 additions and 0 deletions
15
types/bun.d.ts
vendored
Normal file
15
types/bun.d.ts
vendored
Normal 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
10
types/config.d.ts
vendored
Normal 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
3
types/ejs.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
interface EjsTemplateData {
|
||||
[key: string]: string | number | boolean | object | undefined | null;
|
||||
}
|
9
types/logger.d.ts
vendored
Normal file
9
types/logger.d.ts
vendored
Normal 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
15
types/routes.d.ts
vendored
Normal 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
29
types/session.d.ts
vendored
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue