/** * Pre-deploy checks for a generated service: generate the migration from the * deployed schema, run it and check for drift (TypeScript only, on PGlite), * and smoke test the endpoints. The CLI and the in-browser editor (which runs * the CLI in a WebContainer) share these steps. */ /// /// /// /// /// /// /// /// /// import { Entity } from "../types/entity"; import { TargetLanguage } from "../types/generator"; import { RelationshipMap } from "../types/relationship"; export interface Step { name: string; ok: boolean; output?: string; } export declare function run(cmd: string, args: string[], cwd: string, env?: NodeJS.ProcessEnv): Promise<{ ok: boolean; output: string; }>; /** Env that points the service's orm.config at a file-backed PGlite database. */ export declare const pgliteEnv: (dataDir: string) => NodeJS.ProcessEnv; /** * Load the deployed schema into a fresh PGlite database at dataDir: scaffold * the baseline .apsorc in a copy of the project (sharing node_modules), build * it, and schema:sync. */ export declare function buildBaseline(projectDir: string, baselineApsorc: string, dataDir: string, cliBin: string): Promise; /** * Why `apso migrate` can't run for this project's language, or undefined. * ponytail: Python (Alembic) and Go (goose) have no local scratch database to * build the baseline on; add when they get one like PGlite for TypeScript. */ export declare const migrateUnsupported: (language?: TargetLanguage) => string | undefined; export interface GenerateResult { ok: boolean; needed: boolean; file?: string; steps: Step[]; } /** Generate a migration from the deployed schema (baselineApsorc) to the project's entities. */ export declare function generateMigration(projectDir: string, baselineApsorc: string, name: string, cliBin: string): Promise; export interface CheckResult { ok: boolean; steps: Step[]; } export declare function supportsPglite(projectDir: string): boolean; /** * Run a migration on a fresh copy of the deployed schema, then check that the * database matches the project's entities (a second generate finds nothing). */ export declare function verifyMigration(projectDir: string, baselineApsorc: string, migrationFile: string, cliBin: string, skipBuild?: boolean): Promise; /** The route each language's generated controller serves an entity on. */ export declare const entityRoute: (language: TargetLanguage, name: string) => string; export interface SmokeOptions { skipBuild?: boolean; timeoutMs?: number; language?: TargetLanguage; } /** * Start the service and call GET /health, every entity's list endpoint, and a * create/read/delete of one row per entity. TypeScript services run on a * PGlite database synced to their entities; Python and Go services run on the * database in DATABASE_URL. */ export declare function smokeTest(projectDir: string, entities: Entity[], relationships?: RelationshipMap, { skipBuild, timeoutMs, language, }?: SmokeOptions): Promise; /** KEY=value lines of the project's .env; no interpolation. */ export declare function readDotEnv(projectDir: string): Record; /** The CLI's own entry point, for running `generate` in the baseline copy. */ export declare const cliBinPath: (root: string) => string; /** Print a check's steps (or JSON) through the command's logger. */ export declare function report(log: (s: string) => void, result: CheckResult, json: boolean, summary?: string): void;