import type { LimitedUserConfig } from "./cli.mjs"; import { CodegenError } from "./errors.mjs"; export type FileChangeStatus = "added" | "modified" | "removed"; export type FileChange = { /** Path of the file in the existing output, relative to cwd, `/`-separated. */ path: string; /** * - `added`: regeneration would create it (missing from the existing output) * - `modified`: content differs * - `removed`: present in the existing output but no longer generated */ status: FileChangeStatus; }; export type CheckResult = { upToDate: boolean; files: FileChange[]; }; /** Name prefix of the throwaway directory `check` generates into. */ export declare const scratchPrefix = ".openapi-rq-check-"; /** * Compare a freshly generated directory with the existing one. * Returned paths are `displayRoot` joined with the file's relative path. */ export declare function diffDirectories({ expectedRoot, actualRoot, displayRoot, }: { expectedRoot: string; actualRoot: string; displayRoot: string; }): Promise; /** * Pick where the throwaway generation goes. * * `--format`/`--lint` run on the scratch `queries/` files, and formatter and * linter configuration is matched by path (overrides, ignore rules). So the * scratch directory is created inside the existing `/queries`, and * the output's own path is repeated underneath it: * * src/openapi/queries/.openapi-rq-check-XXXX/src/openapi/queries/*.ts * * A rule for `src/openapi/**` or `src/openapi/queries/**` matches through the * leading part, a rule for a folder named `openapi` or for * `**\/openapi/queries/*.ts` through the trailing part. Only a rule anchored * at the project root that also pins the depth or file name (for example * `src/openapi/queries/*.ts`) does not carry over. * * When there is no `queries/` yet every query file is reported as `added` * whatever its content, so the scratch directory goes next to the output, or * into the OS temp dir when the parent does not exist either. */ export declare function createScratchOutput(output: string): Promise<{ scratchRoot: string; scratchOutput: string; }>; /** * Generate into a temporary location and compare it with the existing * output under `options.output`. Never modifies the existing files. * Rejects only with {@link CodegenError}. */ export declare function check(options: LimitedUserConfig, version: string): Promise; export declare function outOfDateError(files: FileChange[]): CodegenError;