import { Request } from "express"; // #################### SERVER export type SERVER_REQUIRED = { REQ: unknown; OPT: { uid: string; }; RES: unknown; }; export const ERROR_401: { code: 401; data: "UNAUTHORIZED" } = { code: 401, data: "UNAUTHORIZED", }; export type SERVER_TRANSFORMER = { REQ: T["REQ"]; OPT: Omit & { req: Request }; RES: T["RES"] | typeof ERROR_401; }; export type SERVER_SETTINGS = { /** * If true, the server will not check if the user is authenticated. The uid could be an empty string. */ allow_unauthorized?: boolean; }; // #################### CLIENT export type CLIENT_SETTINGS = {}; export type CLIENT_REQUIRED = { REQ: unknown; OPT: unknown; RES: unknown; }; export type CLIENT_TRANSFORMER< T extends CLIENT_REQUIRED, K extends SERVER_REQUIRED > = { REQ: T["REQ"]; OPT: T["OPT"]; RES: T["RES"]; };