/** * Tenant-lifecycle operations. * * - `suspendTenant` — `status = 'suspended'`, reversible. * - `archiveTenant` — `status = 'archived'`, reversible (data * still present, just hidden from active * UIs). * - `restoreTenant` — `status = 'active'`, reverses suspend or * archive. * - `hardDeleteTenant` — runs the cascade walker + drops the * `tenants` row. **Irreversible.** * * The package mutates `tenants.status` plus, optionally, a metadata * column. It does NOT touch any other table — application children * are left intact for the reversible operations, and only the * cascade walker touches them for the hard-delete path. * * Audit hook: * - Every operation calls the supplied `audit` callback after * mutating the DB. Apps wire this to `@venturekit-pro/audit`'s * `record()` (or whatever audit sink they use). * - The hook receives a typed event — see `types.ts` for the * shape. */ import { type CascadeResult } from './cascade.js'; import type { LifecycleArgs, LifecycleAuditSink, Querier } from './types.js'; export interface LifecycleOperationArgs extends LifecycleArgs { /** Optional audit sink invoked once per operation. */ audit?: LifecycleAuditSink; } export interface HardDeleteArgs extends LifecycleOperationArgs { /** Schema to operate against. Default `public`. */ schema?: string; /** Tables to exclude from the cascade (`tenants` is always implicit). */ skipTables?: string[]; } /** * Mark a tenant as `suspended`. Reversible via `restoreTenant`. * * Application code should refuse to serve requests for suspended * tenants — typically a check in the tenancy middleware: * `if (tenant.status === 'suspended') throw 403`. */ export declare function suspendTenant(querier: Querier, args: LifecycleOperationArgs): Promise; /** * Mark a tenant as `archived`. Same reversibility as suspend; the * intent is "this tenant is going away soon" so admin UIs hide it * but data is preserved for compliance + potential restore. */ export declare function archiveTenant(querier: Querier, args: LifecycleOperationArgs): Promise; /** * Flip a `suspended` / `archived` tenant back to `active`. */ export declare function restoreTenant(querier: Querier, args: LifecycleOperationArgs): Promise; /** * Run the cascade walker + drop the `tenants` row. Irreversible. * * Caller must have DELETE privileges on every tenant-scoped table. * Apps typically wire this to a dedicated cron Lambda running under * a privileged maintenance role. * * Audit event includes the per-table row-deletion counts so the * compliance log knows exactly what disappeared. */ export declare function hardDeleteTenant(querier: Querier, args: HardDeleteArgs): Promise; //# sourceMappingURL=operations.d.ts.map