import { ErrorFactory } from "./errors.mjs"; import { GenericDataModel, TableNamesInDataModel } from "convex/server"; import { RLSConfig, Rules, wrapDatabaseReader, wrapDatabaseWriter } from "convex-helpers/server/rowLevelSecurity"; //#region src/tenancy.d.ts /** The server-owned tenancy field stamped on every tenant table row. */ export declare const TENANT_FIELD: 'tenant'; /** * Deny-oriented row-level security rules generated mechanically from a table * registry: read/insert/modify pass only when the row's tenant matches. * Registering a table here is the entire onboarding — there is no second * per-table step to forget. */ export declare function createTenantRules(tenant: string, tables: readonly TableNamesInDataModel[]): Rules; /** * AND-composes rule sets: a row passes an operation only when every rule set * that defines a rule for it passes. Lets tenant isolation and role-level * rules coexist on the same wrapped database. */ export declare function composeRules(...sets: readonly Rules[]): Rules; /** * Loads a client-referenced document and verifies tenant ownership without * disclosing existence: a missing row and a foreign row fail identically * with REFERENCE_NOT_FOUND. Use for every id argument a client supplies. */ export declare function requireTenantReference(tenant: string, load: () => Promise, errors?: ErrorFactory): Promise; /** Asserts a loaded document belongs to the tenant; use on internal paths. */ export declare function assertTenantOwned(tenant: string, document: Document, errors?: ErrorFactory): Document; //#endregion export { type RLSConfig, type Rules, wrapDatabaseReader, wrapDatabaseWriter }; //# sourceMappingURL=tenancy.d.mts.map