Layers.ts overview

Every drizzle store as one layer. The batched Requests.layer() is not in it; provide it alongside when wanted.


Exports Grouped by Category


utils

layer

Every drizzle-backed store in one layer. Provide it together with a DrizzleDatabase layer and the session/sign-in path (session validation, credential lookup, identifier resolution) has persistence.

schema defaults to the PostgreSQL tables under their effect_auth_* names; pass Sqlite.tables or MySql.tables (or a defineTables(...) result from any of the three) to match the handle you provided, or a defineSchema(...) mapping to run the stores against tables this package did not define.

The package’s other stores — EmailPasswordStore, UserServiceStore, ApiKeyStore, RateLimitStore, TokenStore — have layers of their own, which take the same tables; merge the ones the application uses. Stores this package does not implement (OAuth accounts, WebAuthn credentials, and the rest) come from @thomasfosterau/effect-auth/sql or a KeyValueStore-backed layer from core.

Example

const stores = layer(Pg.defineTables({ sessions: "app_sessions" }));

// Or, against an application's own tables:
const adopted = layer(defineSchema({ sessions: { table, columns }, ... }));

Signature

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

Source


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