OrganizationStore.ts overview
Drizzle OrganizationStore and OrganizationDomainStore over a dialect’s Tables: organizations, memberships, invitations, teams, team memberships, custom roles and domain claims. The unique indexes in the tables hold what the service checks before writing, under concurrency. Neither store opens a transaction: a cascade deletes the rows beneath before the parent, so an interrupted one leaves a parent a retry finishes.
Exports Grouped by Category
utils
domainLayer
OrganizationDomainStore backed by drizzle, on top of DrizzleDatabase.
Signature
declare const domainLayer: (
tables?: Tables
) => Layer.Layer<Auth.Organization.OrganizationDomainStore, never, DrizzleDatabase>
layer
OrganizationStore backed by drizzle, on top of DrizzleDatabase.
Signature
declare const layer: (tables?: Tables) => Layer.Layer<Auth.Organization.OrganizationStore, never, DrizzleDatabase>
makeOrganizationDomainStore
Build an OrganizationDomainStore over the ambient DrizzleDatabase. On PostgreSQL and SQLite a partial unique index allows one verified claim per domain; MySQL has no partial indexes, so there the service’s own check stands alone.
Signature
declare const makeOrganizationDomainStore: (
tables?: Tables
) => Effect.Effect<typeof Auth.Organization.OrganizationDomainStore.Service, never, DrizzleDatabase>
makeOrganizationStore
Build an OrganizationStore over the ambient DrizzleDatabase.
upsertOrgRole updates the (organization_id, role) row, inserts when it matched none, and updates again when a concurrent insert won the unique index, so a replacement keeps the stored id and creation time. It omits the optional listMembersByOrganizationPage, so SCIM pages in memory.
Signature
declare const makeOrganizationStore: (
tables?: Tables
) => Effect.Effect<typeof Auth.Organization.OrganizationStore.Service, never, DrizzleDatabase>