mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-06 22:43:34 +02:00
79 lines
2.3 KiB
TypeScript
79 lines
2.3 KiB
TypeScript
/**
|
|
* @adonisjs/session
|
|
*
|
|
* (c) Harminder Virk <virk@adonisjs.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
/// <reference types="@adonisjs/application/build/adonis-typings" />
|
|
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
|
|
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
import { SessionConfig, ExtendCallback, SessionManagerContract, SessionClientContract } from '@ioc:Adonis/Addons/Session';
|
|
import { Session } from '../Session';
|
|
/**
|
|
* Session manager exposes the API to create session instance for a given
|
|
* request and also add new drivers.
|
|
*/
|
|
export declare class SessionManager implements SessionManagerContract {
|
|
application: ApplicationContract;
|
|
/**
|
|
* A private map of drivers added from outside in.
|
|
*/
|
|
private extendedDrivers;
|
|
/**
|
|
* Reference to session config
|
|
*/
|
|
private config;
|
|
constructor(application: ApplicationContract, config: SessionConfig);
|
|
/**
|
|
* Validates the config
|
|
*/
|
|
private validateConfig;
|
|
/**
|
|
* Processes the config and decides the `expires` option for the cookie
|
|
*/
|
|
private processConfig;
|
|
/**
|
|
* Returns an instance of cookie driver
|
|
*/
|
|
private createCookieDriver;
|
|
/**
|
|
* Returns an instance of the memory driver
|
|
*/
|
|
private createMemoryDriver;
|
|
/**
|
|
* Returns an instance of file driver
|
|
*/
|
|
private createFileDriver;
|
|
/**
|
|
* Returns an instance of redis driver
|
|
*/
|
|
private createRedisDriver;
|
|
/**
|
|
* Creates an instance of extended driver
|
|
*/
|
|
private createExtendedDriver;
|
|
/**
|
|
* Creates an instance of driver by looking at the config value `driver`.
|
|
* An hard exception is raised in case of invalid driver name
|
|
*/
|
|
private createDriver;
|
|
/**
|
|
* Find if the sessions are enabled
|
|
*/
|
|
isEnabled(): boolean;
|
|
/**
|
|
* Creates an instance of the session client
|
|
*/
|
|
client(): SessionClientContract;
|
|
/**
|
|
* Creates a new session instance for a given HTTP request
|
|
*/
|
|
create(ctx: HttpContextContract): Session;
|
|
/**
|
|
* Extend the drivers list by adding a new one.
|
|
*/
|
|
extend(driver: string, callback: ExtendCallback): void;
|
|
}
|