/** * Module ingestion for the dials pipeline: load an on-disk pgpm module into * the flattened, classified change list the transform/partition drivers * consume. `pgpm transform` uses this today; a future `pgpm import` (dumps) * and `pgpm diff` are expected to reuse the same seam. */ import type { ExtendedPlanFile } from '@pgpmjs/ast'; /** One change of a loaded module: headerless, unwrapped deploy SQL. */ export interface ModuleSourceChange { /** Change name (plan token). */ name: string; /** Change names this change requires, as recorded in the plan. */ dependencies: string[]; /** Deploy SQL with the pgpm header and BEGIN/COMMIT wrapper stripped. */ deploy: string; } /** A pgpm module loaded from disk, flattened in plan order. */ export interface ModuleSource { /** Module (project) name from pgpm.plan. */ name: string; /** Absolute module directory. */ modulePath: string; /** Changes in plan order. */ changes: ModuleSourceChange[]; /** Non-fatal notes (missing deploy scripts, etc.). */ warnings: string[]; } /** * Strip the transaction wrapper some modules carry inside their scripts * (standalone `BEGIN;` / `COMMIT;` / `ROLLBACK;` lines). The caller owns * transaction control. */ export declare const stripTransactionWrapper: (sql: string) => string; /** Options controlling how {@link loadModuleSource} ingests a module. */ export interface LoadModuleSourceOptions { /** * Parsed plans of the other packages in the same workspace, keyed by * package name (`%project`). Lets a cross-package tag dependency * (`pkg:@tag`) resolve against the plan that defines the tag. Without it, * cross-package tags cannot be resolved from a single module's plan and are * left verbatim with a warning. */ crossPackagePlans?: Map; } /** * Load a pgpm module from disk: parse pgpm.plan and read each change's * deploy script, stripping pgpm headers and transaction wrappers so the * result can be flattened straight into the dials pipeline * (`restructureChanges` / `partitionUnits`). */ export declare const loadModuleSource: (moduleDir: string, options?: LoadModuleSourceOptions) => ModuleSource;