import { MatchFunction } from 'path-to-regexp'; import { HTTPMethods } from '../client/types.js'; type ServerClientSecret = string; type ServerClientOrigin = string; type ServerClientInfo = { path: string; secret: string; hash: string; searchParams: { [key: string]: any; }; }; type ServerClient = { origin: string; secret: ServerClientSecret; }; type UploadFileMeta = { fileId: string; name: string; size: number; type: string; chunkIndex: number; totalChunks: number; isFinish: boolean; }; type UploadFilePath = string; type Metadata = { [key: string]: any; }; type SecurequServerConfig = { debug?: boolean; mode?: "production" | "development"; basepath: string; clients: ServerClient[]; file?: { maxFilesize?: number; checkFileType?: boolean; chunkSize?: number; upload: (chunk: Uint8Array, filemeta: UploadFileMeta) => Promise; delete: (filename: string) => Promise; }; accept?: (info: HandlerInfo, metadata?: Metadata) => boolean | Promise; }; type ListenerInfo = { body: any; headers: { [key: string]: string; }; metadata?: Metadata; }; type HandlerInfo = { path: string; body: object; method: HTTPMethods; searchParams: { [key: string]: any; }; params: { [key: string]: any; }; }; type ServerResponse = { value: Uint8Array | string; status: number; contentType: string; }; type HandlerFunction = (info: HandlerInfo, metadata?: Metadata) => (any | void) | Promise | void>; type RouteFactory = { [key in HTTPMethods]: { [path: string]: { handler: HandlerFunction; test: MatchFunction<{ [key: string]: string; }>; }; }; }; export type { HandlerFunction, HandlerInfo, ListenerInfo, Metadata, RouteFactory, SecurequServerConfig, ServerClient, ServerClientInfo, ServerClientOrigin, ServerClientSecret, ServerResponse, UploadFileMeta, UploadFilePath };