import { z } from "zod"; import type { FrameworkConfig } from "./types/FrameworkConfig.ts"; import type { OnPageComplete } from "./types/util.ts"; export declare function setSettings(newSettings: Settings): void; export declare function getSettings(): Settings; type InternalSettings = { typeScriptPackageName?: string; pythonWheelName?: string; onPageComplete?: OnPageComplete; }; export declare function getInternalSetting(key: Key): NonNullable; export declare function setInternalSetting(key: Key, value: InternalSettings[Key]): void; export declare const settingsSchema: z.ZodObject<{ /** * The path to the OpenAPI spec file in JSON or YAML format. * * If you wish to load the spec from a location other than a file on disk, * use `specData` instead. */ spec: z.ZodOptional; /** * The text contents of the OpenAPI spec file, in JSON or YAML format. * * You can use this property instead of `spec` if you wish to load the file * from a location other than a file on disk. */ specData: z.ZodOptional; /** * Configuration for the output of the generated site. */ output: z.ZodObject<{ /** * The location to put generated markdown page files. * * Examples: * - Docusaurus: `./docs/api` * - Next.js: `./src/app/api` */ pageOutDir: z.ZodString; /** * The location to put generated markdown embed files. This setting is only * required if `display.maxNestingLevel` is specified. * * These files should _not_ go in a folder that the site framework * interprets as a page route. For example, if you are using Docusaurus, * you should not put embed files in a folder that is a child of * `docs`. */ embedOutDir: z.ZodOptional; /** * The site framework you are using. This can be either a string for a * preconfigured framework, or a custom configuration for use in any * framework. */ framework: z.ZodUnion<[z.ZodEnum<["docusaurus", "nextra", "llms"]>, z.ZodObject<{ /** * The base renderer type to use. If you are using an MDX capable * framework, then specifying `mdx` will use React versions of our * components. If you are using a Markdown capable framework, then * specifying `markdown` will use web component versions of our * components. */ rendererType: z.ZodEnum<["mdx", "markdown"]>; /** * For use with the `mdx` renderer only. This property is the module * name of the package containing components. Defaults to * `@speakeasy-api/docs-md-react`. * * If you wish to override components, then you can set this to a local * import, e.g. `@/components/my-custom-docs-components`. Note that * this path cannot be relative due to varying nesting levels of pages. */ componentPackageName: z.ZodDefault>; /** * A function that builds a path to a file on disk to compute a page * page. File-based routing frameworks all have their own quirks and * requirements, so this function exists to customize pathing to match. * * This function takes in two arguments: * - `slug`: The slug of the page relative to `outDir` without a leading * slash, e.g. `endpoints/myTag` * - `options`: An object containing optional properties * - `options.appendIndex`: Whether or not this indicates an "index" * or root-level page, e.g. the compiled `/outDir/index.html` page * * The function should return an absolute path to a file on disk, * including file extension, that we will save markdown to. */ buildPagePath: z.ZodFunction, z.ZodUnknown>; /** * A function that works just like `buildPagePath`, but for embed files. * This function is only called when `display.maxNestingLevel` is * specified. */ buildEmbedPath: z.ZodOptional, z.ZodUnknown>>; /** * A function that builds a page preamble. You can add anything here * that you would like at the start of a markdown file, such as metadata * for the page (title, ordering, etc.). You can also add global imports * of files in MDX pages, etc. */ buildPagePreamble: z.ZodFunction, z.ZodUnknown>; /** * A function that is called after all pages have been generated. * Metadata about all pages is passed in, which you can do things like * creating a left navigation menu, metadata files for frameworks (such * as `_category_.json` in Docusaurus), etc. */ postProcess: z.ZodOptional, z.ZodUnknown>>; /** * A function that formats a heading ID. Different markdown parsers and * plugins have different syntax for formatting a heading ID. * * This function defaults to the most common format, which looks like: * * ``` * # Heading Text \{#heading-id\} * ``` * * The default function returns ` \\{#${id}\\}`. * * If you are using a framework that uses a different syntax, you can * override this function to conform to your framework. */ formatHeadingId: z.ZodOptional, z.ZodUnknown>>; /** * The separator to use between elements in an ID. Defaults to "+". */ elementIdSeparator: z.ZodOptional; }, "strip", z.ZodTypeAny, { rendererType: "markdown" | "mdx"; componentPackageName: string; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }, { rendererType: "markdown" | "mdx"; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; componentPackageName?: string | undefined; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }>]>; /** * Whether or not to generate an "About" page. This page is generated * automatically and contains information about the API, such as its * description, version, servers, etc. */ aboutPage: z.ZodDefault>; /** * Whether or not to generate a single-page site. If this is set to true, * then all pages will be generated in a single markdown file. * * WARNING: we do not provide any virtualization of the page. Enabling this * on large specs will cause significant performance problems unless you * implement your own virtualization strategy. * * As such, this option is only available for custom frameworks. */ singlePage: z.ZodDefault>; /** * Whether or not to auto generate request body examples. */ generateRequestBodyExamples: z.ZodDefault>; /** * Whether or not to auto generate response body examples. */ generateResponseExamples: z.ZodDefault>; }, "strict", z.ZodTypeAny, { pageOutDir: string; framework: "docusaurus" | "nextra" | "llms" | { rendererType: "markdown" | "mdx"; componentPackageName: string; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }; aboutPage: boolean; singlePage: boolean; generateRequestBodyExamples: boolean; generateResponseExamples: boolean; embedOutDir?: string | undefined; }, { pageOutDir: string; framework: "docusaurus" | "nextra" | "llms" | { rendererType: "markdown" | "mdx"; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; componentPackageName?: string | undefined; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }; embedOutDir?: string | undefined; aboutPage?: boolean | undefined; singlePage?: boolean | undefined; generateRequestBodyExamples?: boolean | undefined; generateResponseExamples?: boolean | undefined; }>; /** * Configuration for the display of the generated site. */ display: z.ZodDefault>; /** * Whether or not to show debug placeholders. Debug placeholders are a UI * placeholder in generated files that indicate a value was not supplied * in the spec, along with tips on how to add it. * * This is useful if you are wondering why, e.g. an object property does * not contain a description. * * This should not be enabled in production. */ showDebugPlaceholders: z.ZodDefault; /** * Whether or not to expand top-level properties by default on page load. */ expandTopLevelPropertiesOnPageLoad: z.ZodDefault; /** * The maximum nesting level to show. If this is set, then any properties * that are nested deeper than this will be shown inside of a modal * instead of inline in the page. * * If you notice that generated pages are too big, or indentation takes * up too much horizontal space, you can use this setting to fix it. * * When this setting is enabled, you must also set `output.embedOutDir` */ maxNestingLevel: z.ZodOptional; }, "strict", z.ZodTypeAny, { visibleResponses: "success" | "explicit" | "all"; showDebugPlaceholders: boolean; expandTopLevelPropertiesOnPageLoad: boolean; maxNestingLevel?: number | undefined; }, { visibleResponses?: "success" | "explicit" | "all" | undefined; showDebugPlaceholders?: boolean | undefined; expandTopLevelPropertiesOnPageLoad?: boolean | undefined; maxNestingLevel?: number | undefined; }>>; /** * Configuration for code samples. */ codeSamples: z.ZodOptional; /** * Whether or not to enable Try It Now. */ tryItNow: z.ZodDefault>; }, "strip", z.ZodTypeAny, { language: "curl"; tryItNow: boolean; }, { language: "curl"; tryItNow?: boolean | undefined; }>, z.ZodObject<{ /** * The path to a tarball file of the SDK. Use this option if, for example, * you are downloading an SDK from GitHub releases. */ sdkTarballPath: z.ZodOptional; /** * The path to a folder containing the SDK. Use this option if, for example, * your SDK is located in the same repo as docs. */ sdkFolder: z.ZodOptional; /** * The language to use for the code sample. */ language: z.ZodLiteral<"typescript">; /** * Configuration for Try It Now, if supplied. If this object is not supplied, * then Try It Now will be disabled. */ tryItNow: z.ZodOptional>; }, "strip", z.ZodTypeAny, { language: "typescript"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }, { language: "typescript"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }>, z.ZodObject<{ /** * The path to a tarball file of the SDK. Use this option if, for example, * you are downloading an SDK from GitHub releases. */ sdkTarballPath: z.ZodOptional; /** * The path to a folder containing the SDK. Use this option if, for example, * your SDK is located in the same repo as docs. */ sdkFolder: z.ZodOptional; /** * The language to use for the code sample. */ language: z.ZodLiteral<"python">; /** * Configuration for Try It Now, if supplied. If this object is not supplied, * then Try It Now will be disabled. */ tryItNow: z.ZodOptional>; }, "strip", z.ZodTypeAny, { language: "python"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }, { language: "python"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }>, z.ZodObject<{ /** * The path to a tarball file of the SDK. Use this option if, for example, * you are downloading an SDK from GitHub releases. */ sdkTarballPath: z.ZodOptional; /** * The path to a folder containing the SDK. Use this option if, for example, * your SDK is located in the same repo as docs. */ sdkFolder: z.ZodOptional; /** * The language to use for the code sample. */ language: z.ZodEnum<["go", "java", "csharp", "terraform", "unity", "php", "swift", "ruby", "postman"]>; }, "strip", z.ZodTypeAny, { language: "go" | "java" | "csharp" | "terraform" | "unity" | "php" | "swift" | "ruby" | "postman"; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }, { language: "go" | "java" | "csharp" | "terraform" | "unity" | "php" | "swift" | "ruby" | "postman"; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; }>]>, "many">>; }, "strict", z.ZodTypeAny, { output: { pageOutDir: string; framework: "docusaurus" | "nextra" | "llms" | { rendererType: "markdown" | "mdx"; componentPackageName: string; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }; aboutPage: boolean; singlePage: boolean; generateRequestBodyExamples: boolean; generateResponseExamples: boolean; embedOutDir?: string | undefined; }; display: { visibleResponses: "success" | "explicit" | "all"; showDebugPlaceholders: boolean; expandTopLevelPropertiesOnPageLoad: boolean; maxNestingLevel?: number | undefined; }; spec?: string | undefined; specData?: string | undefined; codeSamples?: ({ language: "curl"; tryItNow: boolean; } | { language: "typescript"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; } | { language: "python"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; } | { language: "go" | "java" | "csharp" | "terraform" | "unity" | "php" | "swift" | "ruby" | "postman"; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; })[] | undefined; }, { output: { pageOutDir: string; framework: "docusaurus" | "nextra" | "llms" | { rendererType: "markdown" | "mdx"; buildPagePath: (...args: unknown[]) => unknown; buildPagePreamble: (...args: unknown[]) => unknown; componentPackageName?: string | undefined; buildEmbedPath?: ((...args: unknown[]) => unknown) | undefined; postProcess?: ((...args: unknown[]) => unknown) | undefined; formatHeadingId?: ((...args: unknown[]) => unknown) | undefined; elementIdSeparator?: string | undefined; }; embedOutDir?: string | undefined; aboutPage?: boolean | undefined; singlePage?: boolean | undefined; generateRequestBodyExamples?: boolean | undefined; generateResponseExamples?: boolean | undefined; }; spec?: string | undefined; specData?: string | undefined; display?: { visibleResponses?: "success" | "explicit" | "all" | undefined; showDebugPlaceholders?: boolean | undefined; expandTopLevelPropertiesOnPageLoad?: boolean | undefined; maxNestingLevel?: number | undefined; } | undefined; codeSamples?: ({ language: "curl"; tryItNow?: boolean | undefined; } | { language: "typescript"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; } | { language: "python"; tryItNow?: { outDir: string; urlPrefix: string; } | undefined; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; } | { language: "go" | "java" | "csharp" | "terraform" | "unity" | "php" | "swift" | "ruby" | "postman"; sdkTarballPath?: string | undefined; sdkFolder?: string | undefined; })[] | undefined; }>; type ZodSettings = z.infer; export type Settings = Omit & { output: Omit & { /** * The site framework you are using. This can be either a string for a * preconfigured framework, or a custom configuration for use in any * framework. */ framework: "docusaurus" | "nextra" | "llms" | FrameworkConfig; }; }; export {}; //# sourceMappingURL=settings.d.ts.map