From 1073646633c7efdea60de521459df49e640defa5 Mon Sep 17 00:00:00 2001 From: Louis Bailleau Date: Tue, 9 Apr 2024 13:15:38 +0200 Subject: [PATCH 1/2] feat: make session macroable --- src/session.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/session.ts b/src/session.ts index 9287f16..192eaba 100644 --- a/src/session.ts +++ b/src/session.ts @@ -13,6 +13,7 @@ import { cuid } from '@adonisjs/core/helpers' import type { HttpContext } from '@adonisjs/core/http' import type { EmitterService } from '@adonisjs/core/types' import type { HttpError } from '@adonisjs/core/types/http' +import Macroable from '@poppinss/macroable' import debug from './debug.js' import * as errors from './errors.js' @@ -32,7 +33,7 @@ import type { * A session instance is isolated between requests but * uses a centralized persistence store and */ -export class Session { +export class Session extends Macroable { #store: SessionStoreContract #emitter: EmitterService #ctx: HttpContext @@ -135,6 +136,8 @@ export class Session { emitter: EmitterService, ctx: HttpContext ) { + super() + this.#ctx = ctx this.#emitter = emitter this.#store = storeFactory(ctx, config) From 8364a87e47a4eee8e8942b2b14210e036f9303da Mon Sep 17 00:00:00 2001 From: Louis Bailleau Date: Tue, 9 Apr 2024 13:37:29 +0200 Subject: [PATCH 2/2] feat: export Session from the main entrypoint --- index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.ts b/index.ts index a0a549e..3fba1aa 100644 --- a/index.ts +++ b/index.ts @@ -11,3 +11,4 @@ export * as errors from './src/errors.js' export { configure } from './configure.js' export { stubsRoot } from './stubs/main.js' export { defineConfig, stores } from './src/define_config.js' +export { Session } from './src/session.js'