2020-12-04 14:42:09 +01:00
|
|
|
import {Session, SessionData} from "express-session";
|
2021-05-03 19:29:22 +02:00
|
|
|
import {Files} from "formidable";
|
|
|
|
|
|
|
|
import {PasswordAuthProofSessionData} from "../auth/password/PasswordAuthProof.js";
|
|
|
|
import {FlashMessages} from "../components/SessionComponent.js";
|
|
|
|
import Middleware from "../Middleware.js";
|
|
|
|
import {Type} from "../Utils.js";
|
2020-04-22 15:52:17 +02:00
|
|
|
|
2020-04-23 11:16:05 +02:00
|
|
|
declare global {
|
|
|
|
namespace Express {
|
|
|
|
export interface Request {
|
2020-12-04 14:42:09 +01:00
|
|
|
getSession(): Session & Partial<SessionData>;
|
|
|
|
|
|
|
|
getSessionOptional(): Session & Partial<SessionData> | undefined;
|
2020-09-25 23:42:15 +02:00
|
|
|
|
|
|
|
|
2020-06-14 21:47:18 +02:00
|
|
|
files: Files;
|
2020-04-22 15:52:17 +02:00
|
|
|
|
2020-09-25 22:03:22 +02:00
|
|
|
|
|
|
|
middlewares: Middleware[];
|
|
|
|
|
|
|
|
as<M extends Middleware>(type: Type<M>): M;
|
|
|
|
|
|
|
|
|
2020-09-25 23:42:15 +02:00
|
|
|
flash(): FlashMessages;
|
2020-04-22 15:52:17 +02:00
|
|
|
|
2020-09-25 23:42:15 +02:00
|
|
|
flash(message: string): unknown[];
|
2020-04-22 15:52:17 +02:00
|
|
|
|
2020-11-03 11:12:49 +01:00
|
|
|
flash(event: string, message: unknown): void;
|
2020-04-22 15:52:17 +02:00
|
|
|
|
2021-01-24 22:24:04 +01:00
|
|
|
|
|
|
|
getPreviousUrl(): string | null;
|
|
|
|
|
|
|
|
getIntendedUrl(): string | null;
|
2020-04-23 11:16:05 +02:00
|
|
|
}
|
2020-04-22 15:52:17 +02:00
|
|
|
}
|
2020-09-25 23:42:15 +02:00
|
|
|
}
|
2020-12-04 14:42:09 +01:00
|
|
|
|
|
|
|
declare module 'express-session' {
|
|
|
|
interface SessionData {
|
|
|
|
id?: string;
|
|
|
|
|
|
|
|
previousUrl?: string;
|
|
|
|
|
2021-01-24 16:29:23 +01:00
|
|
|
wantsSessionPersistence?: boolean;
|
|
|
|
|
|
|
|
persistent?: boolean;
|
|
|
|
|
2021-01-25 10:53:43 +01:00
|
|
|
isAuthenticated?: boolean;
|
2020-12-04 14:42:09 +01:00
|
|
|
|
2021-01-25 10:53:43 +01:00
|
|
|
authPasswordProof?: PasswordAuthProofSessionData;
|
2020-12-04 14:42:09 +01:00
|
|
|
|
|
|
|
csrf?: string;
|
|
|
|
}
|
|
|
|
}
|