Schema.ts overview

Table names, the dialect-independent Tables set and the row types the stores read. Each dialect (Pg, Sqlite, MySql) defines the tables with the same column names, and every column reads back as the same string, Date, JsonObject or boolean. Login handles live only in the identifiers table.


Exports Grouped by Category


utils

ApiKeyPermissions (type alias)

What ApiKey.permissions holds: resource to allowed actions.

Signature

type ApiKeyPermissions = Record<string, ReadonlyArray<string>>

Source

ApiKeyRow (type alias)

The row select() returns from any dialect’s API keys table.

Signature

type ApiKeyRow = Tables["apiKeys"]["$inferSelect"]

Source

IdentifierRow (type alias)

The row select() returns from any dialect’s identifiers table.

Signature

type IdentifierRow = Tables["identifiers"]["$inferSelect"]

Source

RateLimitRow (type alias)

The row select() returns from any dialect’s rate limits table.

Signature

type RateLimitRow = Tables["rateLimits"]["$inferSelect"]

Source

SessionRow (type alias)

Row shapes selected from each table, whichever dialect produced them.

Signature

type SessionRow = Tables["sessions"]["$inferSelect"]

Source

TableNames (interface)

The physical table name for each of the auth tables.

Signature

export interface TableNames {
  readonly sessions: string
  readonly users: string
  readonly identifiers: string
  /** `ApiKeyStore`'s keys, by SHA-256 digest. */
  readonly apiKeys: string
  /** `RateLimitStore`'s fixed-window counters. */
  readonly rateLimits: string
  /** `EmailVerificationStore`'s and `PasswordResetStore`'s pending tokens, by digest. */
  readonly tokens: string
  /** `OrganizationStore`'s organizations, unique per slug. */
  readonly organizations: string
  /** `OrganizationStore`'s memberships, unique per `(organization_id, user_id)`. */
  readonly organizationMembers: string
  /** `OrganizationStore`'s invitations, by the digest of their token. */
  readonly organizationInvitations: string
  /** `OrganizationStore`'s teams. */
  readonly teams: string
  /** `OrganizationStore`'s team memberships, unique per `(team_id, user_id)`. */
  readonly teamMembers: string
  /** `OrganizationStore`'s custom roles, unique per `(organization_id, role)`. */
  readonly organizationRoles: string
  /** `OrganizationDomainStore`'s domain claims, unique per `(organization_id, domain)`. */
  readonly organizationDomains: string
}

Source

Tables (type alias)

The set of tables a store factory reads and writes: one dialect’s six tables, never a mixture.

The union is what makes the stores dialect-generic without giving up type safety — Pg.defineTables(), Sqlite.defineTables() and MySql.defineTables() each produce one member, and every member yields the same row and insert shapes, so the store code is written once.

Signature

type Tables = Pg.Tables | Sqlite.Tables | MySql.Tables

Source

TokenPurpose (type alias)

Which flow a row of the tokens table belongs to. One table holds both kinds; every read and delete is scoped to its purpose, so a password-reset request never clears a pending email verification.

Signature

type TokenPurpose = "email-verification" | "password-reset"

Source

TokenRow (type alias)

The row select() returns from any dialect’s tokens table.

Signature

type TokenRow = Tables["tokens"]["$inferSelect"]

Source

UserRow (type alias)

The row select() returns from any dialect’s users table.

Signature

type UserRow = Tables["users"]["$inferSelect"]

Source

defaultTableNames

The default effect_auth_* table names, shared by every dialect.

Signature

declare const defaultTableNames: TableNames

Source


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