"use strict"; /** * @adonisjs/session * * (c) Harminder Virk * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); /** * Session provider for AdonisJS */ class SessionProvider { constructor(app) { this.app = app; } /** * Register Session Manager */ register() { this.app.container.singleton('Adonis/Addons/Session', () => { const { SessionManager } = require('../src/SessionManager'); return new SessionManager(this.app, this.app.config.get('session', {})); }); } /** * Register bindings for tests */ registerTestsBindings() { this.app.container.withBindings([ 'Japa/Preset/ApiRequest', 'Japa/Preset/ApiResponse', 'Japa/Preset/ApiClient', 'Adonis/Addons/Session', ], (ApiRequest, ApiResponse, ApiClient, Session) => { const { defineTestsBindings } = require('../src/Bindings/Tests'); defineTestsBindings(ApiRequest, ApiResponse, ApiClient, Session); }); } /** * Register server bindings */ registerServerBindings() { this.app.container.withBindings(['Adonis/Core/Server', 'Adonis/Core/HttpContext', 'Adonis/Addons/Session'], (Server, HttpContext, Session) => { const { defineServerBindings } = require('../src/Bindings/Server'); defineServerBindings(HttpContext, Server, Session); }); } boot() { this.registerServerBindings(); this.registerTestsBindings(); } } exports.default = SessionProvider; SessionProvider.needsApplication = true;