MCPcopy Create free account
hub / github.com/adonisjs/session / constructor

Method constructor

src/session.ts:145–157  ·  view source on GitHub ↗

* Creates a new session instance * * @param config - Session configuration * @param storeFactory - Factory function to create session store * @param emitter - Event emitter service * @param ctx - HTTP context

(
    public config: SessionConfig,
    storeFactory: SessionStoreFactory,
    emitter: EmitterService,
    ctx: HttpContext
  )

Source from the content-addressed store, hash-verified

143 * @param ctx - HTTP context
144 */
145 constructor(
146 public config: SessionConfig,
147 storeFactory: SessionStoreFactory,
148 emitter: EmitterService,
149 ctx: HttpContext
150 ) {
151 super()
152 this.#ctx = ctx
153 this.#emitter = emitter
154 this.#store = storeFactory(ctx, config)
155 this.#sessionIdFromCookie = ctx.request.cookie(config.cookieName, undefined)
156 this.#sessionId = this.#sessionIdFromCookie || randomUUID()
157 }
158
159 /**
160 * Returns the flash messages store for a given mode

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected