import { t as __name } from "./rolldown-runtime-C0LytTxp.js"; import { SchemaNode, ast, ast as ast$1 } from "@kubb/ast"; import { Adapter, AdapterFactoryOptions, AdapterSource, BannerMeta, Config, Diagnostics, Exclude, Generator as Generator$1, GeneratorContext, Group, Hookable, Include, KubbHooks, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, NodeCache, Output, OutputOptions, Override, Parser, Plugin, PluginFactoryOptions, Renderer, RendererFactory, ResolveFileOptions, ResolveImportsOptions, ResolvePathOptions, Resolver, ResolverFile, ResolverFileParams, ResolverFilePathParams, ResolverPatch, Storage, createAdapter, createRenderer, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fsStorage, memoryStorage } from "@kubb/core"; //#region ../../internals/utils/src/Url.d.ts type URLObject = { /** * The resolved URL string (Express-style or template literal, depending on context). */ url: string; /** * Extracted path parameters as a key-value map, or `null` when the path has none. */ params: Record | null; }; type TemplateOptions = { /** * Literal text prepended inside the template literal, e.g. a base URL. */ prefix?: string | null; /** * Transform applied to each extracted parameter name before interpolation. */ replacer?: (pathParam: string) => string; }; type ObjectOptions = { /** * Controls whether the `url` is rendered as an Express path or a template literal. * @default 'path' */ type?: 'path' | 'template'; /** * Transform applied to each extracted parameter name. */ replacer?: (pathParam: string) => string; /** * When `true`, the result is serialized to a string expression instead of a plain object. */ stringify?: boolean; }; /** * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`. */ declare class Url { /** * Converts an OpenAPI/Swagger path to Express-style colon syntax. * * @example * Url.toPath('/pet/{petId}') // '/pet/:petId' * * @example * Url.toPath('/point/{point-id}') // '/point/:pointId' */ static toPath(path: string): string; /** * Converts an OpenAPI/Swagger path to a TypeScript template literal string. * `prefix` is prepended inside the literal, and `replacer` transforms each parameter name. * * @example * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`' * * @example * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`' */ static toTemplateString(path: string, { prefix, replacer }?: TemplateOptions): string; /** * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off a * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``. * Parameter names are kept exactly as they appear in the OpenAPI path; a name falls back to * bracket access (`` path['pet-id'] ``) only when it isn't a valid JS identifier. * `prefix` is prepended inside the literal. Shared by generators that pass a grouped `path` object. * * @example * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`' * * @example * Url.toGroupedTemplateString('/user/{monetary-account-id}') // '`/user/${path["monetary-account-id"]}`' */ static toGroupedTemplateString(path: string, { prefix }?: { prefix?: string | null; }): string; /** * Returns the path and its extracted params as a structured `URLObject`, or as a stringified * expression when `stringify` is set. * * @example * Url.toObject('/pet/{petId}') * // { url: '/pet/:petId', params: { petId: 'petId' } } */ static toObject(path: string, { type, replacer, stringify }?: ObjectOptions): URLObject | string; } //#endregion //#region src/macros/macroDiscriminatorEnum.d.ts type Props$2 = { propertyName: string; values: Array; enumName?: string; }; /** * Builds a macro that replaces a discriminator property's schema with a string enum of the given * values. Object schemas that lack the property are returned unchanged. * * @example * ```ts * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] }) * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' }) * ``` */ declare function macroDiscriminatorEnum({ propertyName, values, enumName }: Props$2): ast$1.Macro; //#endregion //#region src/macros/macroEnumName.d.ts type Props$1 = { parentName: string | null | undefined; propName: string; enumSuffix: string; }; /** * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums * are left anonymous. Non-enum nodes are returned unchanged. * * @example * ```ts * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' }) * const named = applyMacros(propSchema, [macro], { depth: 'shallow' }) * ``` */ declare function macroEnumName({ parentName, propName, enumSuffix }: Props$1): ast$1.Macro; //#endregion //#region src/macros/macroRenameSchema.d.ts type Props = { from: string; to: string; }; /** * Builds a macro that renames a schema consistently: the declaration (`name`) and every ref * pointing at it (`targetName`) change together, so imports and printed references stay in * sync. Renaming only one side by hand produces imports for files that are never generated. * * @example * `const macro = macroRenameSchema({ from: 'Order', to: 'StoreOrder' })` */ declare function macroRenameSchema({ from, to }: Props): ast$1.Macro; //#endregion //#region src/macros/macroSimplifyUnion.d.ts /** * Removes union members a broader scalar primitive already covers, such as a multi-value string enum * sitting next to a plain `string`. Single-value enums are kept. * * @example * ```ts * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' }) * ``` */ declare const macroSimplifyUnion: ast$1.Macro; //#endregion //#region src/utils/mergeAdjacentSchemas.d.ts /** * Merges a run of adjacent anonymous object members into one. Named or non-object members break the * run and pass through unchanged. The merge follows member order, so callers control which members * combine by where they place them in the sequence. * * @example * ```ts * const merged = [...mergeAdjacentObjectsLazy([objectA, objectB])] * ``` */ declare function mergeAdjacentObjectsLazy(members: Iterable): Generator; //#endregion //#region src/utils/refs.d.ts /** * Returns the last path segment of a reference string. * * @example * `extractRefName('#/components/schemas/Pet') // 'Pet'` */ declare function extractRefName(ref: string): string; /** * Builds a PascalCase child schema name by joining a parent name and property name. * Returns `null` when there is no parent to nest under. * * @example Nested under a parent * `childName('Order', 'shipping_address') // 'OrderShippingAddress'` * * @example No parent * `childName(undefined, 'params') // null` */ declare function childName(parentName: string | null | undefined, propName: string): string | null; /** * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any * empty parts. * * @example * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'` */ declare function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string; /** * Merges a ref node with its resolved schema, giving usage-site fields precedence. * * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`, * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref * nodes and refs without a resolved `schema` are returned unchanged. * * @example * ```ts * const ref = ast.factory.createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' }) * const merged = syncSchemaRef(ref) // merges with resolved Pet schema * ``` */ declare function syncSchemaRef(node: SchemaNode): SchemaNode; /** * Returns `true` when a schema emits as a plain `string` type. * * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time` * types, returns `true` only when `representation` is `'string'` rather than `'date'`. */ declare function isStringType(node: SchemaNode): boolean; //#endregion //#region src/utils/schemaGraph.d.ts /** * Returns `true` when a schema, or anything nested inside it, references a circular schema. * * Pass `excludeName` to skip refs to a specific schema, which helps when self-references are handled * on their own. Pair it with `ast.findCircularSchemas()` to decide where lazy wrappers go. * * @note Stops at the first matching circular ref. */ declare function containsCircularRef(node: SchemaNode | undefined, { circularSchemas, excludeName }: { circularSchemas: ReadonlySet; excludeName?: string; }): boolean; //#endregion export { type Adapter, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type Config, Diagnostics, type Exclude, type Generator$1 as Generator, type GeneratorContext, type Group, Hookable, type Include, type KubbHooks, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type NodeCache, type Output, type OutputOptions, type Override, type Parser, type Plugin, type PluginFactoryOptions, type Renderer, type RendererFactory, type ResolveFileOptions, type ResolveImportsOptions, type ResolvePathOptions, Resolver, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type Storage, Url, ast, childName, containsCircularRef, createAdapter, createRenderer, createResolver, createStorage, defineGenerator, defineParser, definePlugin, enumPropName, extractRefName, fsStorage, isStringType, macroDiscriminatorEnum, macroEnumName, macroRenameSchema, macroSimplifyUnion, memoryStorage, mergeAdjacentObjectsLazy, syncSchemaRef }; //# sourceMappingURL=index.d.ts.map