import { OperationOutput, PageOutput, PagesBuilder, PagesBuilderConfig, WebhookOutput } from "./builder.js"; import { DistributiveOmit } from "../../types.js"; //#region src/utils/pages/preset-auto.d.ts interface OperationConfig extends BaseConfig { /** * Generate a page for each API endpoint/operation (default). */ per?: 'operation'; /** * Group output using folders (Only works on `operation` mode) * - tag: `{tag}/{file}` * - route: `{endpoint}/{method}` (it will ignore the `name` option) * - none: `{file}` (default) * - a function that aligns group name (folder path) to each entry * * @defaultValue 'none' */ groupBy?: 'tag' | 'route' | 'none' | ((entry: DistributiveOmit) => string); /** * Specify name for output file */ name?: NameFn | NameFnOptions; } interface TagConfig extends BaseConfig { /** * Generate a page for each tag. */ per: 'tag'; /** * Specify name for output file */ name?: NameFn | NameFnOptions; } interface SchemaConfig extends BaseConfig { /** * Generate a page for each schema file. */ per: 'file'; /** * Specify name for output file */ name?: NameFn | NameFnOptions; } type SchemaToPagesOptions = SchemaConfig | TagConfig | OperationConfig | ({ per: 'custom'; } & PagesBuilderConfig); type NameFn = (this: PagesBuilder, output: DistributiveOmit) => string; interface NameFnOptions { /** * The version of algorithm used to generate file paths. * * v1: Fumadocs OpenAPI v8 * v2: Fumadocs OpenAPI v9 * * @defaultValue v2 */ algorithm?: 'v2' | 'v1'; } interface BaseConfig { /** * Custom function to convert names into file names. * * By default, it only escapes whitespaces and upper case (English) characters */ slugify?: (name: string) => string; } //#endregion export { SchemaToPagesOptions };