/** * Append-side helpers for the compiler-owned SQL-trigger migration. * * Ported verbatim (behavior-for-behavior) from * `apps/compiler/src/utils/trigger-migration.ts`. Only the append half moves * to the CLI — `buildTriggerJournalMigration`, `renderSqlTrigger`, and * `loweredTriggerName` stay compiler-side because they run during * compilation, not during migration generation. The compiler still decides * WHAT the trigger migration says (`meta.triggerJournalMigration`); the CLI * only decides where and whether it lands. * * Keep `MIGRATION_HEADER`, the DROP composition, and the trigger-name regex * byte-identical to the compiler's copy — the content hash embedded in the * journal tag is computed over `createSql` upstream, but the composed * document is what gets applied, and a whitespace drift here would rewrite * an applied migration's bytes on the next compile. */ export interface TriggerJournalMigrationMeta { /** The CREATE TRIGGER section — '' when the project has no sql triggers. */ createSql: string; /** sha256[0:12] of `createSql`; embedded in the journal tag. */ hash: string; /** Lowered trigger names in the current set. */ names: string[]; } /** Journal tag shape for compiler-owned trigger migrations. */ export declare const TRIGGER_MIGRATION_TAG_RE: RegExp; /** Filename shape of staged prior trigger migrations (for name recovery). */ export declare const TRIGGER_MIGRATION_FILE_RE: RegExp; export declare const STATEMENT_BREAKPOINT = "--> statement-breakpoint"; /** * Recover the lowered trigger names a previous trigger migration created, so * the next migration's DROP section covers triggers a removed config no * longer renders. */ export declare function extractTriggerNamesFromSql(sql: string): string[]; /** * Compose the final migration document: drops for (previous ∪ current), * creates for current. The BEGIN/END frames inside `createSql` are already * uppercase (remote-D1 splitter requirement). */ export declare function composeTriggerMigrationSql(meta: TriggerJournalMigrationMeta, previousNames: string[]): string; /** Journal tag shape for compiler-owned RLS migrations. */ export declare const RLS_MIGRATION_TAG_RE: RegExp; export interface RlsJournalMigrationMeta { /** The combined, idempotent RLS SQL document. */ sql: string; /** Content hash (sha256, first 12 hex chars) of `sql` — the dedupe key. */ hash: string; } //# sourceMappingURL=trigger-sql.d.ts.map