SessionStore.ts overview

Drizzle SessionStore and the batched session reads, over a dialect’s Tables or a defineSchema mapping. Session ids are the token digests the service computes. touch moves only the expiry columns, guarded so it never recreates a deleted session.


Exports Grouped by Category


utils

GetSession (class)

Read one session by its id (the SHA-256 hash of the bearer token).

Resolves to None on a miss, exactly like SessionStore.get. Issue it with Requests.getSession(id) rather than constructing it by hand.

Signature

declare class GetSession

Source

layer

SessionStore backed by drizzle, on top of DrizzleDatabase.

Signature

declare const layer: (schema?: SchemaInput) => Layer.Layer<Auth.SessionStore.SessionStore, never, DrizzleDatabase>

Source

make

Build a SessionStore over the ambient DrizzleDatabase.

Signature

declare const make: (
  schema?: SchemaInput
) => Effect.Effect<typeof Auth.SessionStore.SessionStore.Service, never, DrizzleDatabase>

Source

makeResolver

A resolver that collapses every GetSession in a batch into a single WHERE id IN (...) query.

Duplicate ids in the same batch are de-duplicated before the query is built, so N concurrent lookups of the same session cost one row read.

The returned resolver must be shared for batching to happen — requests are grouped per resolver instance. Build it once behind Requests.AuthRequests/Requests.layer rather than per call site.

Signature

declare const makeResolver: (
  schema?: SchemaInput
) => Effect.Effect<RequestResolver.RequestResolver<GetSession>, never, DrizzleDatabase>

Source


This site uses Just the Docs, a documentation theme for Jekyll.