import type { WorkOSOrgMap } from "./adapters/workos-org.js"; export interface WorkOSOrgMirrorOptions { /** * The stored WorkOS org id for a local id, or null if none is recorded yet * (which triggers the reconcile). * * THROW if the local id has no row at all: null means "no pointer, go find or * make the org", and answering that for a row that doesn't exist would mint an * org for nothing. */ readPointer(localId: string): Promise; /** Persist the pointer. Called whenever it was missing or had drifted. */ writePointer(localId: string, workosOrgId: string): Promise; /** The local id a WorkOS org id maps back to, when the app can answer it from * its own store. Return null to fall back to the org's `externalId`. */ reversePointer?(workosOrgId: string): Promise; /** Organization name to create with. Receives the local id; default "Workspace". * Only consulted on the reconcile path, so it can cost a query. */ nameFor?(localId: string): Promise | string; } export interface WorkOSOrgMirror extends WorkOSOrgMap { /** Create-or-fetch the org backing `localId` and persist the pointer. * Idempotent — keyed on `externalId`, so a retry finds rather than duplicates. */ ensureOrg(localId: string, name?: string): Promise; /** The org id for a local id, reconciling on read when the pointer is missing. */ toWorkosOrgId(localId: string): Promise; /** The local id for an org id, via the app's store then the org's externalId. */ toOrgId(workosOrgId: string): Promise; /** Rename the org. A deleted org is not an error — nothing to rename. */ renameOrg(workosOrgId: string, name: string): Promise; /** Delete the org. Already gone is success. */ deleteOrg(workosOrgId: string): Promise; /** Add a user with a role, tolerating a membership that already exists. */ ensureMembership(workosOrgId: string, userId: string, roleSlug: string): Promise; /** Membership id for (org, user) across ALL statuses, or null. WorkOS keys * membership mutations by this id, not by user id — and the default listing * is active-only, which silently hides a pending or deactivated member. */ membershipId(workosOrgId: string, userId: string): Promise; } /** Every membership status. The WorkOS listing defaults to active-only. */ export declare const ALL_MEMBERSHIP_STATUSES: readonly ["active", "inactive", "pending"]; export declare function createWorkOSOrgMirror(opts: WorkOSOrgMirrorOptions): WorkOSOrgMirror; //# sourceMappingURL=org-mirror.d.ts.map