import { type FileBaseName } from "../utils.js"; import { type ValidEnvName, type ValidScriptFileName, type ValidScriptFormat, type ValidScriptName, type ValidScriptTimestamp } from "./name-component-validation.js"; export type ParsedScriptMetadata = { date: Date; type: "migration"; format: ValidScriptFormat; env?: undefined; name: ValidScriptName; } | { date: Date; type: "seed"; format: ValidScriptFormat; env: ValidEnvName; name: ValidScriptName; } | { date: Date; type: "snapshot"; format: ValidScriptFormat; env: ValidEnvName | undefined; name?: undefined; }; /** * Parses a script filename to extract its components. This is the inverse of * {@link nameScript}. Throws if the filename doesn't match any known script * pattern. * * Accepts a FileBaseName to ensure callers have explicitly extracted the * basename. Use {@link toFileBaseName} to convert a path to a FileBaseName. */ export declare function parseScriptName(scriptName: FileBaseName): ParsedScriptMetadata; export declare function parseTimestamp(timestamp: ValidScriptTimestamp): Date; /** * Generates the full filename for a script file from (already validated) * components. This function enforces a naming convention that allows us to * identify the script type and, for seeds, which environment it should run in. */ export declare function nameScript(opts: ParsedScriptMetadata): ValidScriptFileName; //# sourceMappingURL=script-name-parsing.d.ts.map