/** * Module emission — the single seam every dials command renders through. * * The engine (semantic diff, granularity, partition) produces plan-ordered * {@link PgpmRow}s; a {@link PgpmModuleModel} is just those rows plus the * module's name and control-file requires. `writeModule` is the one writer * that turns a model into an on-disk pgpm module (`.control` + `pgpm.plan` + * deploy/revert/verify trees) — so `pgpm diff`, `pgpm transform`, and * `pgpm import` all emit byte-identical module layouts instead of each * carrying its own copy of the writer. */ import { PgpmRow } from '@pgpmjs/ast'; /** * A pgpm module as an in-memory value: a name, the extensions it requires * (control-file names), and its changes in plan order. `writeModule` and the * other projections (linear SQL, bundle) are pure functions of this model. */ export interface PgpmModuleModel { /** Package (module) name. */ name: string; /** Module names this package requires (control-file names). */ requires: string[]; /** Changes in plan order. */ rows: PgpmRow[]; } /** Write a module's Postgres extension `.control` file. */ export declare const writeControlFile: (dir: string, name: string, requires: string[]) => void; /** * Write a {@link PgpmModuleModel} to `/` as a full pgpm module: * a `.control` file, `pgpm.plan`, and deploy/revert/verify script trees. * The deploy/revert/verify directories are cleared first so a re-emit never * leaves stale scripts behind. Returns the module directory. */ export declare const writeModule: (outBase: string, model: PgpmModuleModel, extraRequires?: string[]) => string; /** Result of appending changes into an existing module (see {@link appendModule}). */ export interface AppendModuleResult { /** The module directory that was appended to. */ dir: string; /** Change names that were added to the plan. */ added: string[]; /** Change names skipped because they already exist in the plan. */ skipped: string[]; /** Non-fatal notices (skips, dropped dangling dependencies). */ warnings: string[]; } /** * Append plan-ordered {@link PgpmRow}s into an *existing* module rather than * writing a fresh package. Existing changes, their scripts, and the `.control` * file are left untouched; only the new changes are written (deploy/revert/ * verify) and appended to `pgpm.plan` after the current changes. * * Rows whose change name already exists are skipped (never overwritten). * A new change's dependency bracket is filtered to names that resolve within * the plan (existing changes, other appended changes, or `pkg:`-external * references); a dangling internal dependency is dropped with a warning * (plan order still sequences it after the current changes). */ export declare const appendModule: (moduleDir: string, rows: PgpmRow[], options?: { author?: string; }) => AppendModuleResult; /** * Guard against clobbering: writing into the source directory requires * `--write`, as does overwriting any existing package directory. */ export declare const checkOverwrite: (targetDir: string, sourcePath: string, write: boolean) => string | null;