/** * Column-agnostic CRUD over `vk_tenants`. * * Pure SQL against a caller-supplied `Querier`; no `@venturekit/data` * import. Reads `SELECT *` so app-added columns ride along (the data * client maps them). Writes take a camelCase field bag and infer the * right binding per value: * - `status` → cast to the `tenant_status` enum. * - plain object / array → serialized + cast to `jsonb`. * - `Date` / scalar / null → bound as a plain parameter. * * This lets a consumer that ALTERed extra columns onto `vk_tenants` * (e.g. `branding jsonb`, `secret_arn_prefix text`) create / update * them through the same helpers without the package knowing the shape. */ import type { Querier, TenantRecord, TenantStatus, TenantWriteFields } from './types.js'; /** List every tenant, newest first. */ export declare function listTenants(querier: Querier): Promise; /** Fetch one tenant by id, or `null` when absent. */ export declare function getTenantById(querier: Querier, id: string): Promise; /** Fetch one tenant by its unique `slug`, or `null`. */ export declare function getTenantBySlug(querier: Querier, slug: string): Promise; /** Fetch one tenant by its `primary_domain`, or `null`. */ export declare function getTenantByPrimaryDomain(querier: Querier, domain: string): Promise; /** * Insert a tenant from a camelCase field bag. Omit `id` to let the DB * default (`gen_random_uuid()`) assign it. The `slug` unique constraint * is DB-enforced — callers map `23505` via `isUniqueViolation`. */ export declare function createTenant(querier: Querier, fields: TenantWriteFields): Promise; /** * Update a tenant from a camelCase field bag. Always bumps `updated_at`. * Returns the updated row, or `null` when no tenant matches `id`. A * no-op (`fields` empty) still touches `updated_at` and returns the row. */ export declare function updateTenant(querier: Querier, id: string, fields: TenantWriteFields): Promise; /** * Convenience: flip a tenant's lifecycle `status`. Returns the updated * row, or `null` when no tenant matches. For richer transitions * (stamping `suspended_at` / `archived_at`, cascades) use the lifecycle * helpers in `../lifecycle`. */ export declare function setTenantStatus(querier: Querier, id: string, status: TenantStatus): Promise; /** True when `err` is a Postgres `unique_violation` (23505). */ export declare function isUniqueViolation(err: unknown): boolean; //# sourceMappingURL=crud.d.ts.map