import { n as __name } from "./rolldown-runtime-CNktS9qV.js"; import { KubbReactNode } from "kubb/jsx"; import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit"; import ts from "typescript"; import "@kubb/adapter-oas"; //#region src/printers/printerTs.d.ts /** * Partial map of node-type overrides for the TypeScript printer. * * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`). The function * replaces the built-in handler for that node type. Use `this.transform` to * recurse into nested schema nodes, and `this.options` to read printer options. * * @example Override the `date` handler * ```ts * pluginTs({ * printer: { * nodes: { * date(node) { * return ts.factory.createTypeReferenceNode('Date', []) * }, * }, * }, * }) * ``` */ type PrinterTsNodes = ast.PrinterPartial; type PrinterTsOptions = { /** * Mark parameters as optional with `?` or `| undefined`. * - `'questionToken'` adds `?` to properties * - `'undefined'` adds `| undefined` to types * * @default `'questionToken'` */ optionalType: PluginTs['resolvedOptions']['optionalType']; /** * Array representation style. * - `'array'` uses bracket notation (`T[]`) * - `'generic'` uses generic syntax (`Array`) * * @default `'array'` */ arrayType: PluginTs['resolvedOptions']['arrayType']; /** * Grouped enum settings. The printer emits references to enums, not the enum declarations, so only * `type` (the output format) and `typeSuffix` (the enum key reference suffix) matter here. * `constCasing` and `keyCasing` are ignored. */ enum: PluginTs['resolvedOptions']['enum']; /** * Syntax for generated declarations. * - `'type'` generates type aliases * - `'interface'` generates interface declarations * * @default `'type'` */ syntaxType?: PluginTs['resolvedOptions']['syntaxType']; /** * Exported name for the type declaration. * When omitted, returns only the raw type node. */ name?: string; /** * JSDoc comment to attach to the generated type. */ description?: string; /** * Properties to exclude using `Omit`. * Forces type alias syntax regardless of `syntaxType` setting. */ keysToOmit?: Array | null; /** * Transforms raw schema names into valid TypeScript identifiers. */ resolver: ResolverTs; /** * Schema names that represent enums for suffixed key references. */ enumSchemaNames?: Set; /** * Custom handler map for node type overrides. */ nodes?: PrinterTsNodes; }; /** * TypeScript printer factory options: maps `SchemaNode` → `ts.TypeNode` (raw) or `ts.Node` (full declaration). */ type PrinterTsFactory = ast.PrinterFactoryOptions<'typescript', PrinterTsOptions, ts.TypeNode, string>; /** * TypeScript type printer built with `definePrinter`. * * Converts a `SchemaNode` AST node into a TypeScript AST node: * - **`printer.print(node)`** — when `options.typeName` is set, returns a full * `type Name = …` or `interface Name { … }` declaration (`ts.Node`). * Without `typeName`, returns the raw `ts.TypeNode` for the schema. * * Dispatches on `node.type` to the appropriate handler in `nodes`. Options are closed * over per printer instance, so each call to `printerTs(options)` produces an independent printer. * * @example Raw type node (no `typeName`) * ```ts * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' } }) * const typeNode = printer.print(schemaNode) // ts.TypeNode * ``` * * @example Full declaration (with `typeName`) * ```ts * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' }, typeName: 'MyType' }) * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration * ``` */ export declare const printerTs: (options?: PrinterTsOptions | undefined) => ast.Printer; //#endregion //#region src/types.d.ts /** * The concrete resolver type for `@kubb/plugin-ts`. * Extends the base `Resolver` (which provides `default` naming and option helpers, the top-level * `name` casing, and the `file` builder) with plugin-specific naming namespaces for operation * parameters, responses, and enum schemas. */ type ResolverTs = Resolver & { /** * Naming for an operation's parameters, grouped by location. */ param: { /** * Resolves the type name for an individual parameter. * * @example Individual parameter name * `resolver.param.name(node, param) // → 'DeletePetPathPetId'` */ name(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the name for an operation's grouped path parameters type. * * @example Path parameters names * `resolver.param.path(node, param) // → 'GetPetByIdPath'` */ path(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the name for an operation's grouped query parameters type. * * @example Query parameters names * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'` */ query(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the name for an operation's grouped header parameters type. * * @example Header parameters names * `resolver.param.headers(node, param) // → 'DeletePetHeaders'` */ headers(node: ast.OperationNode, param: ast.ParameterNode): string; }; /** * Naming for an operation's request and response types. */ response: { /** * Resolves the name for an operation response by status code. * Encapsulates the ` Status ` template with PascalCase applied to the result. * * @example Response status names * `resolver.response.status(node, 200) // → 'ListPetsStatus200'` */ status(node: ast.OperationNode, statusCode: ast.StatusCode): string; /** * Resolves the name for an operation's grouped request options type (`Options`), the * `{ body, path, query, headers }` bag passed to call an operation. * * @example Options type names * `resolver.response.options(node) // → 'ListPetsOptions'` */ options(node: ast.OperationNode): string; /** * Resolves the name for the collection of all operation responses (`Responses`). * * @example Responses collection names * `resolver.response.responses(node) // → 'ListPetsResponses'` */ responses(node: ast.OperationNode): string; /** * Resolves the name for the union of all operation responses (`Response`). * * @example Response union names * `resolver.response.response(node) // → 'ListPetsResponse'` */ response(node: ast.OperationNode): string; /** * Resolves the request body type name. * * @example Request body type name * `resolver.response.body(node) // → 'CreatePetBody'` */ body(node: ast.OperationNode): string; }; /** * Naming for enum schemas. */ enum: { /** * Resolves the TypeScript type alias name for an enum schema's key variant. * Appends `enumTypeSuffix` (default `'key'`) after applying the default naming convention. * * @example Enum key names with different suffixes * ```ts * resolver.enum.keyName(node, 'Key') // → 'PetStatusKey' * resolver.enum.keyName(node, 'Value') // → 'PetStatusValue' * resolver.enum.keyName(node, '') // → 'PetStatus' * ``` */ keyName(node: { name?: string | null; }, enumTypeSuffix?: string): string; }; }; type EnumKeyCasing = 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none'; type EnumConstCasing = 'camelCase' | 'pascalCase'; /** * Grouped enum settings. Each `type` uses only some of the other fields. * * - `'asConst'` emits a `const` object plus a `typeof` type alias, so `constCasing`, `typeSuffix`, and `keyCasing` all apply. * - `'enum'` and `'constEnum'` emit a TypeScript enum, so only `keyCasing` (the member names) applies. * - `'literal'` and `'inlineLiteral'` emit union literals and drop the keys, so none of the other fields apply. * * @example Share one name between the const and the type * ```ts * enum: { type: 'asConst', constCasing: 'pascalCase', typeSuffix: '' } * // export const VehicleType = { … } as const * // export type VehicleType = (typeof VehicleType)[keyof typeof VehicleType] * ``` */ type EnumOptions$1 = { /** * Emit a `const` object asserted with `as const`, paired with a `typeof` type alias. * This is tree-shakeable and adds no enum runtime. * * @default 'asConst' */ type?: 'asConst'; /** * Casing of the generated const variable. * - 'camelCase' names the const `vehicleType`. * - 'pascalCase' names the const `VehicleType`, matching the schema name. * * @default 'camelCase' */ constCasing?: EnumConstCasing; /** * Suffix appended to the generated type alias name. Only the type alias is renamed. The const * object name stays the same. Set it to `''` together with `constCasing: 'pascalCase'` to merge * the const and type under the schema's exact name. * * @default 'Key' * @example A custom suffix * `typeSuffix: 'Value'` renames the alias to `PetStatusValue` */ typeSuffix?: string; /** * Choose the casing for enum key names. * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format. * - 'snakeCase' generates keys in snake_case format. * - 'pascalCase' generates keys in PascalCase format. * - 'camelCase' generates keys in camelCase format. * - 'none' uses the enum value as-is without transformation. * @default 'none' */ keyCasing?: EnumKeyCasing; } | { /** * Emit a TypeScript `enum` (`'enum'`) or `const enum` (`'constEnum'`) declaration. * * @default 'asConst' */ type?: 'enum' | 'constEnum'; /** * `constCasing` has no effect for this `type`. Only `'asConst'` emits a const object. */ constCasing?: never; /** * `typeSuffix` has no effect for this `type`. Only `'asConst'` emits a separate type alias. */ typeSuffix?: never; /** * Choose the casing for enum member names. * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format. * - 'snakeCase' generates keys in snake_case format. * - 'pascalCase' generates keys in PascalCase format. * - 'camelCase' generates keys in camelCase format. * - 'none' uses the enum value as-is without transformation. * @default 'none' */ keyCasing?: EnumKeyCasing; } | { /** * Emit a union of literals as a named alias (`'literal'`) or inline the union at every usage * site (`'inlineLiteral'`). * * @default 'asConst' * @note In Kubb v5, 'inlineLiteral' becomes the default. */ type?: 'literal' | 'inlineLiteral'; /** * `constCasing` has no effect for this `type`; literal modes emit no const object. */ constCasing?: never; /** * `typeSuffix` has no effect for this `type`; literal modes emit no separate type alias. */ typeSuffix?: never; /** * `keyCasing` has no effect for this `type`. Literal and inlineLiteral modes emit only values, * so the keys are discarded. */ keyCasing?: never; }; /** * Where the generated `.ts` files are written and how they are exported, plus the optional * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories. * * @default { path: 'types', barrel: { type: 'named' } } */ type Options = OutputOptions & { /** * Skip operations matching at least one entry in the list. */ exclude?: Array; /** * Restrict generation to operations matching at least one entry in the list. */ include?: Array; /** * Apply a different options object to operations matching a pattern. */ override?: Array>; /** * Whether object schemas are emitted as `type` aliases or `interface` declarations. * - `'type'` emits closed type aliases. Safer default for generated code. * - `'interface'` emits interfaces. Useful when consumers rely on declaration merging. * * @default 'type' * @see https://www.totaltypescript.com/type-vs-interface-which-should-you-use */ syntaxType?: 'type' | 'interface'; /** * How optional properties are written in generated types. * - `'questionToken'` — `type?: string`. The property may be missing. * - `'undefined'` — `type: string | undefined`. Required to exist, may be `undefined`. * - `'questionTokenAndUndefined'` — `type?: string | undefined`. Strictest. * * @default 'questionToken' * @note Pick `'questionTokenAndUndefined'` when `exactOptionalPropertyTypes` is on in `tsconfig.json`. */ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'; /** * Syntax used for array types. * - `'array'` — `Type[]`. Shorter. * - `'generic'` — `Array`. More readable for complex element types. * * @default 'array' */ arrayType?: 'generic' | 'array'; /** * Override how names and file paths are built for generated symbols. * Methods you omit fall back to the default `resolverTs`. `this` is bound to the * full resolver, so `this.default.name(name)` delegates to the built-in implementation. */ resolver?: ResolverPatch; /** * Macros applied to each schema or operation node before printing. * Callbacks you omit fall back to the preset behavior. * * @example Drop writeOnly properties from response types * ```ts * macros: [ * { * name: 'drop-write-only', * property(node) { * if (node.schema.writeOnly) return undefined * }, * }, * ] * ``` */ macros?: Array; /** * Replace the TypeScript handler for a specific schema type (`'integer'`, `'date'`, ...). * Each handler returns a TypeScript AST node for that schema type. Use `this.transform` * to recurse into nested schema nodes. * * @example Use the JavaScript `Date` object for date schemas * ```ts * import ts from 'typescript' * pluginTs({ * printer: { * nodes: { * date() { * return ts.factory.createTypeReferenceNode('Date', []) * }, * }, * }, * }) * ``` */ printer?: { nodes?: PrinterTsNodes; }; /** * How OpenAPI enums are represented in the generated TypeScript, and how their names are cased. */ enum?: EnumOptions$1; }; type ResolvedEnumOptions = { type: NonNullable; constCasing: EnumConstCasing; typeSuffix: string; keyCasing: EnumKeyCasing; }; type ResolvedOptions = { output: Output; exclude: Array; include: Array | undefined; override: Array>; group: Group | null; enum: ResolvedEnumOptions; optionalType: NonNullable; arrayType: NonNullable; syntaxType: NonNullable; printer: Options['printer']; }; type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, ResolverTs>; declare global { namespace Kubb { interface PluginRegistry { 'plugin-ts': PluginTs; } } } //#endregion //#region src/components/Enum.d.ts type EnumOptions = PluginTs['resolvedOptions']['enum']; type Props$1 = { node: ast.EnumSchemaNode; enum: EnumOptions; resolver: ResolverTs; key?: string | number | null; }; /** * Renders the enum declaration(s) for a single named `EnumSchemaNode`. * * Depending on `enum.type` this may emit: * - A runtime object (`asConst`) plus a `typeof` type alias * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`) * - A union literal type alias (`literal`) * * The emitted `File.Source` nodes carry the resolved names so that the barrel * index picks up the correct export identifiers. */ export declare function Enum({ node, enum: enumOptions, resolver }: Props$1): KubbReactNode; //#endregion //#region src/components/Type.d.ts type Props = { name: string; node: ast.SchemaNode; /** * Pre-configured printer instance created by the generator. * Created with `printerTs({ ..., nodes: options.printer?.nodes })`. */ printer: ast.Printer; enum: PluginTs['resolvedOptions']['enum']; resolver: ResolverTs; }; export declare function Type({ name, node, printer, enum: enumOptions, resolver }: Props): KubbReactNode; //#endregion //#region src/generators/typeGenerator.d.ts /** * Built-in generator for `@kubb/plugin-ts`. Emits one TypeScript file per * schema in the spec plus per-operation request, response, and parameter * types. Drop-replace with a custom `Generator` to change how * TypeScript output is produced. */ export declare const typeGenerator: import("kubb/kit").Generator; //#endregion //#region src/plugin.d.ts /** * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and * cross-plugin dependency references. */ export declare const pluginTsName = "plugin-ts"; /** * Generates TypeScript `type` aliases and `interface` declarations from an * OpenAPI spec. The foundation that every other Kubb plugin builds on: * clients, query hooks, mocks, and validators all reference the names this * plugin produces. * * @example * ```ts * import { defineConfig } from 'kubb/config' * import { pluginTs } from '@kubb/plugin-ts' * * export default defineConfig({ * input: './petStore.yaml', * output: { path: './src/gen' }, * plugins: [ * pluginTs({ * output: { path: './types' }, * enum: { type: 'asConst' }, * optionalType: 'questionTokenAndUndefined', * }), * ], * }) * ``` */ export declare const pluginTs: (options?: Options | undefined) => import("kubb/kit").Plugin; //#endregion //#region src/printers/functionParams.d.ts /** * A type expression used as a function parameter type annotation. * * - a plain `string` is a type reference rendered as-is, e.g. `'string'`, `'QueryParams'`, `'Partial'` * - a {@link TypeLiteralNode} is an inline anonymous type, e.g. `{ petId: string; name?: string }` * - an {@link IndexedAccessTypeNode} is a single field accessed from a named type, e.g. `PathParams['petId']` */ type TypeExpression = string | TypeLiteralNode | IndexedAccessTypeNode; /** * An inline anonymous object type grouping named fields. * Renders as `{ key: Type; other?: OtherType }`. */ type TypeLiteralNode = { kind: 'TypeLiteral'; /** * Members of the object type, rendered in order. */ members: Array<{ /** * Member key. */ name: string; /** * Member type expression. */ type: TypeExpression; /** * Whether the member is optional, rendered with `?`. */ optional?: boolean; }>; }; /** * A single field accessed from a named group type. Renders as `target['key']`. */ type IndexedAccessTypeNode = { kind: 'IndexedAccessType'; /** * Name of the type being indexed, e.g. `'GetPetPathParams'`. */ target: string; /** * Field key to access, e.g. `'petId'`. */ key: string; }; /** * An object destructuring binding, used as the name of a grouped function parameter. * Renders as `{ id, name }` or `{ id: renamed }` when `propertyName` differs. */ type ObjectBindingPatternNode = { kind: 'ObjectBindingPattern'; /** * Bound elements, rendered in order. */ elements: Array<{ /** * Local binding name. */ name: string; /** * Source key when it differs from the binding name, rendered as `propertyName: name`. */ propertyName?: string; }>; }; /** * One function parameter. * * A simple parameter has a `string` name. A destructured group has an * {@link ObjectBindingPatternNode} name paired with a {@link TypeLiteralNode} type. * * @example Required parameter * `name: Type` * * @example Optional parameter * `name?: Type` * * @example Parameter with default value * `name: Type = defaultValue` * * @example Rest parameter * `...name: Type[]` * * @example Destructured group * `{ id, name? }: { id: string; name?: string } = {}` */ type FunctionParameterNode = { kind: 'FunctionParameter'; /** * Parameter name, or an {@link ObjectBindingPatternNode} for a destructured group. */ name: string | ObjectBindingPatternNode; /** * Type annotation as a {@link TypeExpression}. Omit for untyped output. */ type?: TypeExpression; /** * Whether the parameter is optional, rendered with `?`. */ optional?: boolean; /** * Default value, written verbatim after `=`. Commonly `'{}'` for a destructured group. */ default?: string; /** * When `true` the parameter is emitted as a rest parameter, e.g. `...name: Type[]`. */ rest?: boolean; }; /** * A complete function parameter list. * * Printers are responsible for sorting (`required` → `optional` → `defaulted`). */ type FunctionParametersNode = { kind: 'FunctionParameters'; /** * Ordered parameter nodes. */ params: ReadonlyArray; }; /** * Creates a {@link TypeLiteralNode} representing an inline anonymous object type. * * @example * ```ts * createTypeLiteral({ members: [{ name: 'petId', type: 'string', optional: false }] }) * // { petId: string } * ``` */ export declare function createTypeLiteral(props: Omit): TypeLiteralNode; /** * Creates an {@link IndexedAccessTypeNode} representing a single field accessed from a named type. * * @example * ```ts * createIndexedAccessType({ target: 'DeletePetPathParams', key: 'petId' }) * // DeletePetPathParams['petId'] * ``` */ export declare function createIndexedAccessType(props: Omit): IndexedAccessTypeNode; /** * Creates an {@link ObjectBindingPatternNode} for a destructured parameter binding. * * @example * ```ts * createObjectBindingPattern({ elements: [{ name: 'id' }, { name: 'name' }] }) * // { id, name } * ``` */ export declare function createObjectBindingPattern(props: Omit): ObjectBindingPatternNode; /** * Plain property descriptor for a destructured group built by {@link createFunctionParameter}. */ type FunctionParameterProperty = { name: string; type: TypeExpression; optional?: boolean; }; type FunctionParameterInput = { name: string | ObjectBindingPatternNode; type?: TypeExpression; optional?: boolean; default?: string; rest?: boolean; } | { properties: Array; optional?: boolean; default?: string; }; /** * Creates a {@link FunctionParameterNode}. `optional` defaults to `false`. * Passing `properties` builds a destructured group: an {@link ObjectBindingPatternNode} name * paired with a {@link TypeLiteralNode} type. * * @example Optional param * ```ts * createFunctionParameter({ name: 'params', type: 'QueryParams', optional: true }) * // → params?: QueryParams * ``` * * @example Destructured group * ```ts * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' }) * // → { id, name }: { id: string; name?: string } = {} * ``` */ export declare function createFunctionParameter(input: FunctionParameterInput): FunctionParameterNode; /** * Creates a {@link FunctionParametersNode} from an ordered list of parameters. * * @example * ```ts * const empty = createFunctionParameters() * // { params: [] } * ``` */ export declare function createFunctionParameters(props?: Partial>): FunctionParametersNode; //#endregion //#region src/printers/functionPrinter.d.ts /** * Renders a {@link TypeExpression} to its TypeScript source. * * - a `string` is a type reference, returned as-is * - an `IndexedAccessType` becomes `objectType['indexType']` * - a `TypeLiteral` becomes `{ key: Type; key?: Type }` * * `transformType` is applied once to the fully rendered type, matching how the * printer wrapped reference types before the `ts.factory` model. */ export declare function renderType(type: TypeExpression, transformType?: (type: string) => string): string; type FunctionPrinterOptions = { /** * Rendering modes supported by `functionPrinter`. * * | Mode | Output example | Use case | * |---------------|-----------------------------------|--------------------------------| * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration | * | `call` | `id, { method, url }` | Function call arguments | */ mode: 'declaration' | 'call'; /** * Optional transformation applied to every parameter name before printing. */ transformName?: (name: string) => string; /** * Optional transformation applied to every type string before printing. */ transformType?: (type: string) => string; }; /** * Default function-signature printer. Renders a parameter list in one of two modes: * `declaration` for the function signature and `call` for the call arguments. * * @example * ```ts * const printer = functionPrinter({ mode: 'declaration' }) * * const sig = createFunctionParameters({ * params: [ * createFunctionParameter({ name: 'petId', type: 'string', optional: false }), * createFunctionParameter({ name: 'config', type: 'Config', optional: false, default: '{}' }), * ], * }) * * printer.print(sig) // → "petId: string, config: Config = {}" * ``` */ export declare function functionPrinter(options: FunctionPrinterOptions): { name: "functionParameters"; options: FunctionPrinterOptions; print(node: FunctionParametersNode): string; }; //#endregion //#region ../../internals/shared/src/operation.d.ts /** * Resolver interface for building operation parameters. * * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly. */ type OperationParamsResolver = { /** * Naming for an operation's parameters, grouped by location. */ param: { /** * Resolves the type name for an individual parameter. * * @example Individual path parameter name * `resolver.param.name(node, param) // → 'DeletePetPathPetId'` */ name(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the grouped path parameters type name. * When the return value equals `resolver.param.name`, no indexed access is emitted. * * @example Grouped path params type name * `resolver.param.path(node, param) // → 'DeletePetPath'` */ path(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the grouped query parameters type name. * When the return value equals `resolver.param.name`, an inline struct type is emitted instead. * * @example Grouped query params type name * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'` */ query(node: ast.OperationNode, param: ast.ParameterNode): string; /** * Resolves the grouped header parameters type name. * When the return value equals `resolver.param.name`, an inline struct type is emitted instead. * * @example Grouped header params type name * `resolver.param.headers(node, param) // → 'DeletePetHeaders'` */ headers(node: ast.OperationNode, param: ast.ParameterNode): string; }; /** * Naming for an operation's request and response types. */ response: { /** * Resolves the request body type name. * * @example Request body type name * `resolver.response.body(node) // → 'CreatePetBody'` */ body(node: ast.OperationNode): string; }; }; //#endregion //#region src/printers/operationParams.d.ts /** * Options for {@link createOperationParams}. */ type CreateOperationParamsOptions = { /** * How all operation parameters are grouped in the function signature. * - `'object'` wraps all params into a single destructured object `{ petId, data, params }` * - `'inline'` emits each param category as a separate top-level parameter */ paramsType: 'object' | 'inline'; /** * How path parameters are emitted when `paramsType` is `'inline'`. * - `'object'` groups them as `{ petId, storeId }: PathParams` * - `'inline'` spreads them as individual parameters `petId: string, storeId: string` * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams` */ pathParamsType: 'object' | 'inline' | 'inlineSpread'; /** * Resolver for parameter and request body type names. * Pass `ResolverTs` from `@kubb/plugin-ts` directly. * When omitted, falls back to the schema primitive or `'unknown'`. */ resolver?: OperationParamsResolver; /** * Default value for the path parameters binding when `pathParamsType` is `'object'`. * Falls back to `'{}'` when all path params are optional. */ pathParamsDefault?: string; /** * Extra parameters appended after the standard operation parameters. * * @example Plugin-specific trailing parameter * ```ts * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial', default: '{}' })] * ``` */ extraParams?: Array; /** * Override the default parameter names used for body, query, header, and rest-path groups. * * Useful when targeting languages or frameworks with different naming conventions. * * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' } */ paramNames?: { /** * Name for the request body parameter. * @default 'data' */ data?: string; /** * Name for the query parameters group parameter. * @default 'params' */ params?: string; /** * Name for the header parameters group parameter. * @default 'headers' */ headers?: string; /** * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`. * @default 'pathParams' */ path?: string; }; /** * Transforms every resolved type name before it lands in a parameter node, for framework-level * type wrappers. * * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter` * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\`` */ typeWrapper?: (type: string) => string; }; /** * Converts an `OperationNode` into function parameters for code generation. * * Centralizes parameter grouping logic for all plugins. `paramsType` chooses between one * destructured object parameter (`object`) and separate top-level parameters (`inline`), while * `pathParamsType` controls how path params render in inline mode. Provide a `resolver` for type * name resolution and `extraParams` for plugin-specific trailing parameters such as an `options` object. */ export declare function createOperationParams(node: ast.OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode; //#endregion //#region src/resolvers/resolverTs.d.ts /** * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths * for every generated TypeScript type. Import this in other plugins that need * to reference the exact names `plugin-ts` produces without duplicating the * casing/file-layout rules. * * The `default` helpers are supplied by `createResolver`. This plugin overrides the top-level `name` * to use PascalCase for value and type names and `file` to write PascalCase file paths (dotted names * become `/`-joined), and groups the operation-specific naming under the `param`, `response`, and * `enum` namespaces. * * @example Resolve a type and file name * ```ts * import { resolverTs } from '@kubb/plugin-ts' * * resolverTs.name('list pets') // 'ListPets' * resolverTs.response.status(node, 200) // 'ListPetsStatus200' * ``` */ export declare const resolverTs: ResolverTs; //#endregion //#region src/utils.d.ts type BuildParamsSchemaOptions = { params: Array; }; /** * Builds the object schema for a group of parameters sharing one `in` location (path, query, or * header), embedding each param's own schema (and JSDoc) directly rather than referencing a * separate per-param type — the group itself is the only type these params get exported as. */ export declare function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode; //#endregion export { type CreateOperationParamsOptions, type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, type TypeExpression, type TypeLiteralNode, pluginTs as default }; //# sourceMappingURL=index.d.ts.map