import { type DbExec } from "../db/client.js"; export declare const DATABASE_IDENTITY_SETTING_KEY = "framework.database_identity"; export interface DatabaseIdentityRecord { app: string; recordedAt: string; } export type DatabaseIdentityReadResult = ({ state: "recorded"; } & DatabaseIdentityRecord) | { state: "unrecorded"; } | { state: "unreadable"; error: string; }; export type DatabaseIdentityRecordResult = ({ state: "recorded"; } & DatabaseIdentityRecord) | { state: "skipped"; reason: "no-app-identity"; }; export declare function resolveRunningAppIdentity(): string | null; /** * Record this database as belonging to the running app, unless it already * belongs to one. Uses `mutateSetting`'s CAS loop so two processes racing to * record different apps at once can't both win — the updater hands back the * existing record untouched whenever one is already there, so the retried * write persists the first writer's value, not this call's. * * Failures throw (a release migration that silently failed to record * identity is the exact bug this file exists to prevent) except the one * legitimate no-op: no app slug or id is configured, so there is nothing to * attribute this database to yet. */ export declare function recordDatabaseIdentity(): Promise; export declare function readDatabaseIdentity(exec?: DbExec): Promise;