import type { JSONColumnType, Selectable } from 'kysely'; import type * as Db from '../Db.js'; import type * as db_Schema from '../Schema.js'; /** Columns of the `invite_links` table. */ export type Table = Omit & { /** Lowercase email domains allowed to redeem, or null for unrestricted. */ allowedEmailDomains: JSONColumnType; }; /** Columns of the `invite_link_redemptions` table. */ export type RedemptionTable = db_Schema.InviteLinkRedemption; /** A stored invite link. */ export type Record = Selectable; /** A stored redemption. */ export type Redemption = Selectable; /** Derived link availability. */ export type Status = 'active' | 'deleted' | 'disabled' | 'exhausted' | 'expired'; /** Derives current availability from persisted controls and count. */ export declare function status(record: Record, now?: string): Status; /** Creates a reusable invite link. */ export declare function create(db: Db.Db, input: { allowedEmailDomains: readonly string[] | null; createdBy: string; expiresAt: string | null; maxUses: number | null; name?: string | undefined; orgId: string; role: 'member'; }): Promise; /** Lists non-deleted links in an organization. */ export declare function list(db: Db.Db, orgId: string): Promise; /** Gets an invite link by its management id, including deleted links. */ export declare function get(db: Db.Db, id: string): Promise; /** Gets an invite link by its bearer token, including deleted links. */ export declare function getByToken(db: Db.Db, token: string): Promise; /** Updates an org-scoped non-deleted link. */ export declare function update(db: Db.Db, orgId: string, id: string, enabled: boolean): Promise; /** Soft deletes an org-scoped link. */ export declare function remove(db: Db.Db, orgId: string, id: string): Promise; /** Lists redemption audit records, newest first. */ export declare function listRedemptions(db: Db.Db, orgId: string, inviteLinkId: string): Promise; /** Atomically joins through an active link, consuming only a newly inserted membership. */ export declare function accept(db: Db.Db, token: string, userId: string, email: string): Promise<{ link: Record; consumed: boolean; } | undefined>; /** The verified email domain is not allowed by the invite link. */ export declare class EmailDomainForbiddenError extends Error { name: string; } //# sourceMappingURL=inviteLinks.d.ts.map