@kubb/ast 5.0.0-alpha.24 → 5.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +55 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +55 -7
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/{visitor-DsdLcLjR.d.ts → visitor-C2XD9px4.d.ts} +114 -12
- package/package.json +1 -1
- package/src/constants.ts +8 -0
- package/src/factory.ts +41 -5
- package/src/index.ts +1 -1
- package/src/nodes/index.ts +3 -0
- package/src/nodes/schema.ts +114 -6
- package/src/types.ts +3 -0
- package/src/utils.ts +23 -0
- package/src/visitor.ts +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/constants.ts","../src/factory.ts","../src/guards.ts","../src/printer.ts","../src/refs.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../src/visitor.ts","../src/resolvers.ts","../src/transformers.ts","../src/utils.ts"],"sourcesContent":["import type { NodeKind } from './nodes/base.ts'\nimport type { MediaType } from './nodes/http.ts'\nimport type { HttpMethod } from './nodes/operation.ts'\nimport type { ParameterLocation } from './nodes/parameter.ts'\nimport type { SchemaType } from './nodes/schema.ts'\n\n/**\n * Traversal depth used by AST visitor utilities.\n */\nexport type VisitorDepth = 'shallow' | 'deep'\n\nexport const visitorDepths = {\n shallow: 'shallow',\n deep: 'deep',\n} as const satisfies Record<VisitorDepth, VisitorDepth>\n\nexport const nodeKinds = {\n root: 'Root',\n operation: 'Operation',\n schema: 'Schema',\n property: 'Property',\n parameter: 'Parameter',\n response: 'Response',\n functionParameter: 'FunctionParameter',\n parameterGroup: 'ParameterGroup',\n functionParameters: 'FunctionParameters',\n} as const satisfies Record<string, NodeKind>\n\n/**\n * Canonical schema type strings used by AST schema nodes.\n *\n * These values are used across the AST as stable discriminators\n * (for example `schema.type === schemaTypes.object`).\n *\n * The map is grouped by intent:\n * - primitives (`string`, `number`, `boolean`, ...)\n * - structural/composite (`object`, `array`, `union`, ...)\n * - special OpenAPI-oriented types (`ref`, `datetime`, `uuid`, ...)\n */\nexport const schemaTypes = {\n /**\n * Text value.\n */\n string: 'string',\n /**\n * Floating-point number (`float`, `double`).\n */\n number: 'number',\n /**\n * Whole number (`int32`). Use `bigint` for `int64`.\n */\n integer: 'integer',\n /**\n * 64-bit integer (`int64`). Only used when `integerType` is set to `'bigint'`.\n */\n bigint: 'bigint',\n /**\n * Boolean value\n */\n boolean: 'boolean',\n /**\n * Explicit null value.\n */\n null: 'null',\n /**\n * Any value (no type restriction).\n */\n any: 'any',\n /**\n * Unknown value (must be narrowed before usage).\n */\n unknown: 'unknown',\n /**\n * No return value (`void`).\n */\n void: 'void',\n /**\n * Object with named properties.\n */\n object: 'object',\n /**\n * Sequential list of items.\n */\n array: 'array',\n /**\n * Fixed-length list with position-specific items.\n */\n tuple: 'tuple',\n /**\n * \"One of\" multiple schema members.\n */\n union: 'union',\n /**\n * \"All of\" multiple schema members.\n */\n intersection: 'intersection',\n /**\n * Enum schema.\n */\n enum: 'enum',\n /**\n * Reference to another schema.\n */\n ref: 'ref',\n /**\n * Calendar date (for example `2026-03-24`).\n */\n date: 'date',\n /**\n * Date-time value (for example `2026-03-24T09:00:00Z`).\n */\n datetime: 'datetime',\n /**\n * Time-only value (for example `09:00:00`).\n */\n time: 'time',\n /**\n * UUID value.\n */\n uuid: 'uuid',\n /**\n * Email address value.\n */\n email: 'email',\n /**\n * URL value.\n */\n url: 'url',\n /**\n * Binary/blob value.\n */\n blob: 'blob',\n /**\n * Impossible value (`never`).\n */\n never: 'never',\n} as const satisfies Record<SchemaType, SchemaType>\n\nexport type ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Primitive scalar schema types used when simplifying union members.\n */\nexport const SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\n/**\n * Returns `true` when `type` is a scalar primitive schema type.\n */\nexport function isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\nexport const httpMethods = {\n get: 'GET',\n post: 'POST',\n put: 'PUT',\n patch: 'PATCH',\n delete: 'DELETE',\n head: 'HEAD',\n options: 'OPTIONS',\n trace: 'TRACE',\n} as const satisfies Record<Lowercase<HttpMethod>, HttpMethod>\n\nexport const parameterLocations = {\n path: 'path',\n query: 'query',\n header: 'header',\n cookie: 'cookie',\n} as const satisfies Record<ParameterLocation, ParameterLocation>\n\n/**\n * Default maximum number of concurrent callbacks used by `walk`.\n *\n * 30 is chosen to allow enough parallelism to overlap I/O-bound resolver calls\n * without overwhelming the event loop or causing excessive memory pressure during\n * large spec traversals.\n *\n * @example\n * ```ts\n * walk(root, { concurrency: WALK_CONCURRENCY, root: () => {} })\n * ```\n */\nexport const WALK_CONCURRENCY = 30\n\n/**\n * Fallback response status code used for catch-all responses.\n *\n * @example\n * ```ts\n * const status = DEFAULT_STATUS_CODE // 'default'\n * ```\n */\nexport const DEFAULT_STATUS_CODE = 'default' as const\n\nexport const mediaTypes = {\n applicationJson: 'application/json',\n applicationXml: 'application/xml',\n applicationFormUrlEncoded: 'application/x-www-form-urlencoded',\n applicationOctetStream: 'application/octet-stream',\n applicationPdf: 'application/pdf',\n applicationZip: 'application/zip',\n applicationGraphql: 'application/graphql',\n multipartFormData: 'multipart/form-data',\n textPlain: 'text/plain',\n textHtml: 'text/html',\n textCsv: 'text/csv',\n textXml: 'text/xml',\n imagePng: 'image/png',\n imageJpeg: 'image/jpeg',\n imageGif: 'image/gif',\n imageWebp: 'image/webp',\n imageSvgXml: 'image/svg+xml',\n audioMpeg: 'audio/mpeg',\n videoMp4: 'video/mp4',\n} as const satisfies Record<string, MediaType>\n","import type { InferSchemaNode } from './infer.ts'\nimport type {\n FunctionParameterNode,\n FunctionParametersNode,\n ObjectSchemaNode,\n OperationNode,\n ParameterGroupNode,\n ParameterNode,\n PropertyNode,\n ResponseNode,\n RootNode,\n SchemaNode,\n TypeNode,\n} from './nodes/index.ts'\n\n/**\n * Syncs property/parameter schema optionality flags from `required` and `schema.nullable`.\n *\n * - `optional` is set for non-required, non-nullable schemas.\n * - `nullish` is set for non-required, nullable schemas.\n */\nexport function syncOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n\n/**\n * Distributive `Omit` that preserves each member of a union.\n *\n * @example\n * ```ts\n * type A = { kind: 'a'; keep: string; drop: number }\n * type B = { kind: 'b'; keep: boolean; drop: number }\n * type Result = DistributiveOmit<A | B, 'drop'>\n * // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }\n * ```\n */\nexport type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\ntype CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties'> & { properties?: Array<PropertyNode> }\ntype CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\ntype CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & { kind: 'Schema' }\n\n/**\n * Creates a `RootNode` with stable defaults for `schemas` and `operations`.\n *\n * @example\n * ```ts\n * const root = createRoot()\n * // { kind: 'Root', schemas: [], operations: [] }\n * ```\n *\n * @example\n * ```ts\n * const root = createRoot({ schemas: [petSchema] })\n * // keeps default operations: []\n * ```\n */\nexport function createRoot(overrides: Partial<Omit<RootNode, 'kind'>> = {}): RootNode {\n return {\n schemas: [],\n operations: [],\n ...overrides,\n kind: 'Root',\n }\n}\n\n/**\n * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.\n *\n * @example\n * ```ts\n * const operation = createOperation({\n * operationId: 'getPetById',\n * method: 'GET',\n * path: '/pet/{petId}',\n * })\n * // tags, parameters, and responses are []\n * ```\n *\n * @example\n * ```ts\n * const operation = createOperation({\n * operationId: 'findPets',\n * method: 'GET',\n * path: '/pet/findByStatus',\n * tags: ['pet'],\n * })\n * ```\n */\nexport function createOperation(\n props: Pick<OperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<OperationNode, 'kind' | 'operationId' | 'method' | 'path'>>,\n): OperationNode {\n return {\n tags: [],\n parameters: [],\n responses: [],\n ...props,\n kind: 'Operation',\n }\n}\n\n/**\n * Creates a `SchemaNode`, narrowed to the variant of `props.type`.\n * For object schemas, `properties` defaults to an empty array.\n *\n * @example\n * ```ts\n * const scalar = createSchema({ type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n * ```\n *\n * @example\n * ```ts\n * const object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', properties: [] }\n * ```\n *\n * @example\n * ```ts\n * const enumSchema = createSchema({\n * type: 'enum',\n * primitive: 'string',\n * enumValues: ['available', 'pending'],\n * })\n * ```\n */\nexport function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>\nexport function createSchema(props: CreateSchemaInput): SchemaNode\nexport function createSchema(props: CreateSchemaInput): SchemaNode {\n if (props['type'] === 'object') {\n return { properties: [], ...props, kind: 'Schema' } as CreateSchemaOutput<typeof props>\n }\n\n return { ...props, kind: 'Schema' } as CreateSchemaOutput<typeof props>\n}\n\n/**\n * Creates a `PropertyNode`.\n *\n * `required` defaults to `false`.\n * `schema.optional` and `schema.nullish` are derived from `required` and `schema.nullable`.\n *\n * @example\n * ```ts\n * const property = createProperty({\n * name: 'status',\n * schema: createSchema({ type: 'string' }),\n * })\n * // required=false, schema.optional=true\n * ```\n *\n * @example\n * ```ts\n * const property = createProperty({\n * name: 'status',\n * required: true,\n * schema: createSchema({ type: 'string', nullable: true }),\n * })\n * // required=true, no optional/nullish\n * ```\n */\nexport function createProperty(props: Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>): PropertyNode {\n const required = props.required ?? false\n\n return {\n ...props,\n kind: 'Property',\n required,\n schema: syncOptionality(props.schema, required),\n }\n}\n\n/**\n * Creates a `ParameterNode`.\n *\n * `required` defaults to `false`.\n * Nested schema flags are set from `required` and `schema.nullable`.\n *\n * @example\n * ```ts\n * const param = createParameter({\n * name: 'petId',\n * in: 'path',\n * required: true,\n * schema: createSchema({ type: 'string' }),\n * })\n * ```\n *\n * @example\n * ```ts\n * const param = createParameter({\n * name: 'status',\n * in: 'query',\n * schema: createSchema({ type: 'string', nullable: true }),\n * })\n * // required=false, schema.nullish=true\n * ```\n */\nexport function createParameter(\n props: Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>,\n): ParameterNode {\n const required = props.required ?? false\n return {\n ...props,\n kind: 'Parameter',\n required,\n schema: syncOptionality(props.schema, required),\n }\n}\n\n/**\n * Creates a `ResponseNode`.\n *\n * @example\n * ```ts\n * const response = createResponse({\n * statusCode: '200',\n * description: 'Success',\n * schema: createSchema({ type: 'object', properties: [] }),\n * })\n * ```\n */\nexport function createResponse(\n props: Pick<ResponseNode, 'statusCode' | 'schema'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'schema'>>,\n): ResponseNode {\n return {\n ...props,\n kind: 'Response',\n }\n}\n\n/**\n * Creates a `FunctionParameterNode`.\n *\n * `optional` defaults to `false`.\n *\n * @example Required typed param\n * ```ts\n * createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }) })\n * // → petId: string\n * ```\n *\n * @example Optional param\n * ```ts\n * createFunctionParameter({ name: 'params', type: createTypeNode({ variant: 'reference', name: 'QueryParams' }), optional: true })\n * // → params?: QueryParams\n * ```\n *\n * @example Param with default (implicitly optional; cannot combine with `optional: true`)\n * ```ts\n * createFunctionParameter({ name: 'config', type: createTypeNode({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })\n * // → config: RequestConfig = {}\n * ```\n */\nexport function createFunctionParameter(\n props: { name: string; type?: TypeNode; rest?: boolean } & ({ optional: true; default?: never } | { optional?: false; default?: string }),\n): FunctionParameterNode {\n return {\n optional: false,\n ...props,\n kind: 'FunctionParameter',\n } as FunctionParameterNode\n}\n\n/**\n * Creates a {@link TypeNode} representing a language-agnostic structured type expression.\n *\n * Use `variant: 'struct'` for inline anonymous types and `variant: 'member'` for a single\n * named field accessed from a group type. Each language's printer renders the variant\n * into its own syntax (TypeScript, Python, C#, Kotlin, …).\n *\n * @example Reference type (TypeScript: `QueryParams`)\n * ```ts\n * createTypeNode({ variant: 'reference', name: 'QueryParams' })\n * ```\n *\n * @example Struct type (TypeScript: `{ petId: string }`)\n * ```ts\n * createTypeNode({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createTypeNode({ variant: 'reference', name: 'string' }) }] })\n * ```\n *\n * @example Member type (TypeScript: `DeletePetPathParams['petId']`)\n * ```ts\n * createTypeNode({ variant: 'member', base: 'DeletePetPathParams', key: 'petId' })\n * ```\n */\nexport function createTypeNode(\n props:\n | { variant: 'reference'; name: string }\n | { variant: 'struct'; properties: Array<{ name: string; optional: boolean; type: TypeNode }> }\n | { variant: 'member'; base: string; key: string },\n): TypeNode {\n return { ...props, kind: 'Type' } as TypeNode\n}\n\n/**\n * Creates a `ParameterGroupNode` representing a group of related parameters treated as a unit.\n *\n * @example Grouped param (TypeScript declaration)\n * ```ts\n * createParameterGroup({\n * properties: [\n * createFunctionParameter({ name: 'id', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false }),\n * createFunctionParameter({ name: 'name', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: true }),\n * ],\n * default: '{}',\n * })\n * // declaration → { id, name? }: { id: string; name?: string } = {}\n * // call → { id, name }\n * ```\n *\n * @example Inline (spread) — children emitted as individual top-level parameters\n * ```ts\n * createParameterGroup({\n * properties: [createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false })],\n * inline: true,\n * })\n * // declaration → petId: string\n * // call → petId\n * ```\n */\nexport function createParameterGroup(\n props: Pick<ParameterGroupNode, 'properties'> & Partial<Omit<ParameterGroupNode, 'kind' | 'properties'>>,\n): ParameterGroupNode {\n return {\n ...props,\n kind: 'ParameterGroup',\n }\n}\n\n/**\n * Creates a `FunctionParametersNode` from an ordered list of parameters.\n *\n * @example\n * ```ts\n * createFunctionParameters({\n * params: [\n * createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false }),\n * createFunctionParameter({ name: 'config', type: createTypeNode({ variant: 'reference', name: 'RequestConfig' }), optional: false, default: '{}' }),\n * ],\n * })\n * ```\n *\n * @example\n * ```ts\n * const empty = createFunctionParameters()\n * // { kind: 'FunctionParameters', params: [] }\n * ```\n */\nexport function createFunctionParameters(props: Partial<Omit<FunctionParametersNode, 'kind'>> = {}): FunctionParametersNode {\n return {\n params: [],\n ...props,\n kind: 'FunctionParameters',\n }\n}\n","import type {\n FunctionParameterNode,\n FunctionParametersNode,\n Node,\n NodeKind,\n OperationNode,\n ParameterGroupNode,\n ParameterNode,\n PropertyNode,\n ResponseNode,\n RootNode,\n SchemaNode,\n SchemaNodeByType,\n} from './nodes/index.ts'\n\n/**\n * Narrows a `SchemaNode` to the variant that matches `type`.\n *\n * @example\n * ```ts\n * const schema = createSchema({ type: 'string' })\n * const stringNode = narrowSchema(schema, 'string') // StringSchemaNode | undefined\n * ```\n */\nexport function narrowSchema<T extends SchemaNode['type']>(node: SchemaNode | undefined, type: T): SchemaNodeByType[T] | undefined {\n return node?.type === type ? (node as SchemaNodeByType[T]) : undefined\n}\n\nfunction isKind<T extends Node>(kind: NodeKind) {\n return (node: unknown): node is T => (node as Node).kind === kind\n}\n\n/**\n * Returns `true` when the input is a `RootNode`.\n *\n * @example\n * ```ts\n * if (isRootNode(node)) {\n * console.log(node.schemas.length)\n * }\n * ```\n */\nexport const isRootNode = isKind<RootNode>('Root')\n\n/**\n * Returns `true` when the input is an `OperationNode`.\n *\n * @example\n * ```ts\n * if (isOperationNode(node)) {\n * console.log(node.operationId)\n * }\n * ```\n */\nexport const isOperationNode = isKind<OperationNode>('Operation')\n\n/**\n * Returns `true` when the input is a `SchemaNode`.\n *\n * @example\n * ```ts\n * if (isSchemaNode(node)) {\n * console.log(node.type)\n * }\n * ```\n */\nexport const isSchemaNode = isKind<SchemaNode>('Schema')\n\n/**\n * Returns `true` when the input is a `PropertyNode`.\n */\nexport const isPropertyNode = isKind<PropertyNode>('Property')\n\n/**\n * Returns `true` when the input is a `ParameterNode`.\n */\nexport const isParameterNode = isKind<ParameterNode>('Parameter')\n\n/**\n * Returns `true` when the input is a `ResponseNode`.\n */\nexport const isResponseNode = isKind<ResponseNode>('Response')\n\n/**\n * Returns `true` when the input is a `FunctionParameterNode`.\n */\nexport const isFunctionParameterNode = isKind<FunctionParameterNode>('FunctionParameter')\n\n/**\n * Returns `true` when the input is a `ParameterGroupNode`.\n */\nexport const isParameterGroupNode = isKind<ParameterGroupNode>('ParameterGroup')\n\n/**\n * Returns `true` when the input is a `FunctionParametersNode`.\n */\nexport const isFunctionParametersNode = isKind<FunctionParametersNode>('FunctionParameters')\n","import type { SchemaNode, SchemaNodeByType, SchemaType } from './nodes/index.ts'\n\n/**\n * Runtime context passed as `this` to printer handlers.\n *\n * `this.transform` dispatches to node-level handlers from `nodes`.\n *\n * @example\n * ```ts\n * const context: PrinterHandlerContext<string, {}> = {\n * options: {},\n * transform: () => 'value',\n * }\n * ```\n */\nexport type PrinterHandlerContext<TOutput, TOptions extends object> = {\n /**\n * Recursively transform a nested `SchemaNode` to `TOutput` using the node-level handlers.\n * Use `this.transform` inside `nodes` handlers and inside the `print` override.\n */\n transform: (node: SchemaNode) => TOutput | null | undefined\n /**\n * Options for this printer instance.\n */\n options: TOptions\n}\n\n/**\n * Handler for one schema node type.\n *\n * Use a regular function (not an arrow function) if you need `this`.\n *\n * @example\n * ```ts\n * const handler: PrinterHandler<string, {}, 'string'> = function () {\n * return 'string'\n * }\n * ```\n */\nexport type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = SchemaType> = (\n this: PrinterHandlerContext<TOutput, TOptions>,\n node: SchemaNodeByType[T],\n) => TOutput | null | undefined\n\n/**\n * Generic shape used by `definePrinter`.\n *\n * - `TName` — unique string identifier (e.g. `'zod'`, `'ts'`)\n * - `TOptions` — options passed to and stored on the printer instance\n * - `TOutput` — the type emitted by node handlers\n * - `TPrintOutput` — type returned by public `print` (defaults to `TOutput`)\n *\n * @example\n * ```ts\n * type MyPrinter = PrinterFactoryOptions<'my', { strict: boolean }, string>\n * ```\n */\nexport type PrinterFactoryOptions<TName extends string = string, TOptions extends object = object, TOutput = unknown, TPrintOutput = TOutput> = {\n name: TName\n options: TOptions\n output: TOutput\n printOutput: TPrintOutput\n}\n\n/**\n * Printer instance returned by a printer factory.\n *\n * @example\n * ```ts\n * const printer = definePrinter((options: {}) => ({ name: 'x', options, nodes: {} }))({})\n * ```\n */\nexport type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {\n /**\n * Unique identifier supplied at creation time.\n */\n name: T['name']\n /**\n * Options for this printer instance.\n */\n options: T['options']\n /**\n * Node-level dispatcher — converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.\n * Always dispatches through the `nodes` map; never calls the `print` override.\n * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.\n */\n transform: (node: SchemaNode) => T['output'] | null | undefined\n /**\n * Public printer. If the builder provides a root-level `print`, this calls that\n * higher-level function (which may produce full declarations).\n * Otherwise, falls back to the node-level dispatcher.\n */\n print: (node: SchemaNode) => T['printOutput'] | null | undefined\n}\n\n/**\n * Builder function passed to `definePrinter`.\n *\n * It receives resolved options and returns:\n * - `name`\n * - `options`\n * - `nodes` handlers\n * - optional top-level `print` override\n *\n * @example\n * ```ts\n * const build = (options: {}) => ({ name: 'x' as const, options, nodes: {} })\n * ```\n */\ntype PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) => {\n name: T['name']\n /**\n * Options to store on the printer.\n */\n options: T['options']\n nodes: Partial<{\n [K in SchemaType]: PrinterHandler<T['output'], T['options'], K>\n }>\n /**\n * Optional root-level print override. When provided, becomes the public `printer.print`.\n * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),\n * not the override itself — so recursion is safe.\n */\n print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null\n}\n\n/**\n * Creates a schema printer factory.\n *\n * This function wraps a builder and makes options optional at call sites.\n *\n * The builder receives resolved options and returns:\n * - `name` — a unique identifier for the printer\n * - `options` — options stored on the returned printer instance\n * - `nodes` — a map of `SchemaType` → handler functions that convert a `SchemaNode` to `TOutput`\n * - `print` _(optional)_ — top-level override exposed as `printer.print`\n * - Inside this function, use `this.transform(node)` to dispatch to the `nodes` map\n * - This keeps recursion safe and avoids self-calls\n *\n * When no `print` override is provided, `printer.print` falls back to `printer.transform` (the node-level dispatcher).\n *\n * @example Basic usage — Zod schema printer\n * ```ts\n * type ZodPrinter = PrinterFactoryOptions<'zod', { strict?: boolean }, string>\n *\n * export const zodPrinter = definePrinter<ZodPrinter>((options) => ({\n * name: 'zod',\n * options: { strict: options.strict ?? true },\n * nodes: {\n * string: () => 'z.string()',\n * object(node) {\n * const props = node.properties.map(p => `${p.name}: ${this.transform(p.schema)}`).join(', ')\n * return `z.object({ ${props} })`\n * },\n * },\n * }))\n * ```\n */\nexport function definePrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T> {\n return createPrinterFactory<SchemaNode, SchemaType, SchemaNodeByType>((node) => node.type)(build) as (options?: T['options']) => Printer<T>\n}\n\n/**\n * Generic printer-factory function used by `definePrinter` and `defineFunctionPrinter`.\n **\n * @example\n * ```ts\n * export const defineFunctionPrinter = createPrinterFactory<FunctionNode, FunctionNodeType, FunctionNodeByType>(\n * (node) => kindToHandlerKey[node.kind],\n * )\n * ```\n */\nexport function createPrinterFactory<TNode, TKey extends string, TNodeByKey extends Partial<Record<TKey, TNode>>>(getKey: (node: TNode) => TKey | undefined) {\n return function <T extends PrinterFactoryOptions>(\n build: (options: T['options']) => {\n name: T['name']\n options: T['options']\n nodes: Partial<{\n [K in TKey]: (\n this: { transform: (node: TNode) => T['output'] | null | undefined; options: T['options'] },\n node: TNodeByKey[K],\n ) => T['output'] | null | undefined\n }>\n print?: (this: { transform: (node: TNode) => T['output'] | null | undefined; options: T['options'] }, node: TNode) => T['printOutput'] | null | undefined\n },\n ): (options?: T['options']) => {\n name: T['name']\n options: T['options']\n transform: (node: TNode) => T['output'] | null | undefined\n print: (node: TNode) => T['printOutput'] | null | undefined\n } {\n return (options) => {\n const { name, options: resolvedOptions, nodes, print: printOverride } = build(options ?? ({} as T['options']))\n\n const context = {\n options: resolvedOptions,\n transform: (node: TNode): T['output'] | null | undefined => {\n const key = getKey(node)\n if (key === undefined) return null\n\n const handler = nodes[key]\n\n if (!handler) return null\n\n return (handler as (this: typeof context, node: TNode) => T['output'] | null | undefined).call(context, node)\n },\n }\n\n return {\n name,\n options: resolvedOptions,\n transform: context.transform,\n print: (printOverride ? printOverride.bind(context) : context.transform) as (node: TNode) => T['printOutput'] | null | undefined,\n }\n }\n }\n}\n","import type { RootNode } from './nodes/root.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Lookup map from schema name to `SchemaNode`.\n */\nexport type RefMap = Map<string, SchemaNode>\n\n/**\n * Returns the last path segment of a reference string.\n *\n * Example: `#/components/schemas/Pet` becomes `Pet`.\n *\n * @example\n * ```ts\n * extractRefName('#/components/schemas/Pet') // 'Pet'\n * ```\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Builds a `RefMap` from `root.schemas` using each schema's `name`.\n *\n * Unnamed schemas are skipped.\n *\n * @example\n * ```ts\n * const refMap = buildRefMap(root)\n * const pet = refMap.get('Pet')\n * ```\n */\nexport function buildRefMap(root: RootNode): RefMap {\n const map: RefMap = new Map()\n\n for (const schema of root.schemas) {\n if (schema.name) {\n map.set(schema.name, schema)\n }\n }\n return map\n}\n\n/**\n * Resolves a schema by name from a `RefMap`.\n *\n * @example\n * ```ts\n * const petSchema = resolveRef(refMap, 'Pet')\n * ```\n */\nexport function resolveRef(refMap: RefMap, ref: string): SchemaNode | undefined {\n return refMap.get(ref)\n}\n\n/**\n * Converts a `RefMap` into a plain object.\n *\n * @example\n * ```ts\n * const refsObject = refMapToObject(refMap)\n * ```\n */\nexport function refMapToObject(refMap: RefMap): Record<string, SchemaNode> {\n return Object.fromEntries(refMap)\n}\n","type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Prefixes `word` with `_` when it is a reserved JavaScript/Java identifier or starts with a digit.\n *\n * @example\n * ```ts\n * transformReservedWord('class') // '_class'\n * transformReservedWord('42foo') // '_42foo'\n * transformReservedWord('status') // 'status'\n * ```\n */\nexport function transformReservedWord(word: string): string {\n const firstChar = word.charCodeAt(0)\n if (word && (reservedWords.has(word as 'valueOf') || (firstChar >= 48 && firstChar <= 57))) {\n return `_${word}`\n }\n return word\n}\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n try {\n new Function(`var ${name}`)\n } catch {\n return false\n }\n return true\n}\n","import type { VisitorDepth } from './constants.ts'\nimport { visitorDepths, WALK_CONCURRENCY } from './constants.ts'\nimport { createParameter, createProperty } from './factory.ts'\nimport type { Node, OperationNode, ParameterNode, PropertyNode, ResponseNode, RootNode, SchemaNode } from './nodes/index.ts'\n\n/**\n * Creates a small async concurrency limiter.\n *\n * At most `concurrency` tasks are in flight at once. Extra tasks are queued.\n *\n * @example\n * ```ts\n * const limit = createLimit(2)\n * await Promise.all([\n * limit(() => taskA()),\n * limit(() => taskB()),\n * limit(() => taskC()),\n * ])\n * // only 2 tasks run at the same time\n * ```\n */\nfunction createLimit(concurrency: number) {\n let active = 0\n const queue: Array<() => void> = []\n\n function next() {\n if (active < concurrency && queue.length > 0) {\n active++\n queue.shift()!()\n }\n }\n\n return function limit<T>(fn: () => Promise<T> | T): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n queue.push(() => {\n Promise.resolve(fn())\n .then(resolve, reject)\n .finally(() => {\n active--\n next()\n })\n })\n next()\n })\n }\n}\n\ntype LimitFn = ReturnType<typeof createLimit>\n\n/**\n * Ordered mapping of `[NodeType, ParentType]` pairs.\n *\n * `ParentOf` uses this map to find parent types.\n */\ntype ParentNodeMap = [\n [RootNode, undefined],\n [OperationNode, RootNode],\n [SchemaNode, RootNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode],\n [PropertyNode, SchemaNode],\n [ParameterNode, OperationNode],\n [ResponseNode, OperationNode],\n]\n\n/**\n * Resolves the parent node type for a given AST node type.\n *\n * This is used by visitor context so `ctx.parent` is correctly typed\n * for each callback.\n *\n * @example\n * ```ts\n * type RootParent = ParentOf<RootNode>\n * // undefined\n * ```\n *\n * @example\n * ```ts\n * type PropertyParent = ParentOf<PropertyNode>\n * // SchemaNode\n * ```\n *\n * @example\n * ```ts\n * type SchemaParent = ParentOf<SchemaNode>\n * // RootNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode\n * ```\n */\nexport type ParentOf<T extends Node, TEntries extends ReadonlyArray<[Node, unknown]> = ParentNodeMap> = TEntries extends [\n infer TEntry extends [Node, unknown],\n ...infer TRest extends ReadonlyArray<[Node, unknown]>,\n]\n ? T extends TEntry[0]\n ? TEntry[1]\n : ParentOf<T, TRest>\n : Node\n\n/**\n * Traversal context passed as the second argument to every visitor callback.\n * `parent` is typed from the current node type.\n *\n * @example\n * ```ts\n * const visitor: Visitor = {\n * schema(node, { parent }) {\n * // parent type is narrowed by node kind\n * },\n * }\n * ```\n */\nexport type VisitorContext<T extends Node = Node> = {\n /**\n * Parent node of the currently visited node.\n * For `RootNode`, this is `undefined`.\n */\n parent?: ParentOf<T>\n}\n\n/**\n * Synchronous visitor used by `transform`.\n *\n * @example\n * ```ts\n * const visitor: Visitor = {\n * operation(node) {\n * return { ...node, operationId: `x_${node.operationId}` }\n * },\n * }\n * ```\n */\nexport type Visitor = {\n root?(node: RootNode, context: VisitorContext<RootNode>): void | RootNode\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): void | OperationNode\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): void | SchemaNode\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): void | PropertyNode\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): void | ParameterNode\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): void | ResponseNode\n}\n\n/**\n * Utility type for values that can be returned directly or asynchronously.\n */\ntype MaybePromise<T> = T | Promise<T>\n\n/**\n * Async visitor for `walk`. Synchronous `Visitor` objects are compatible.\n *\n * @example\n * ```ts\n * const visitor: AsyncVisitor = {\n * async operation(node) {\n * await Promise.resolve(node.operationId)\n * },\n * }\n * ```\n */\nexport type AsyncVisitor = {\n root?(node: RootNode, context: VisitorContext<RootNode>): MaybePromise<void | RootNode>\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<void | OperationNode>\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<void | SchemaNode>\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<void | PropertyNode>\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<void | ParameterNode>\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<void | ResponseNode>\n}\n\n/**\n * Visitor used by `collect`.\n *\n * @example\n * ```ts\n * const visitor: CollectVisitor<string> = {\n * operation(node) {\n * return node.operationId\n * },\n * }\n * ```\n */\nexport type CollectVisitor<T> = {\n root?(node: RootNode, context: VisitorContext<RootNode>): T | undefined\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | undefined\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | undefined\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | undefined\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | undefined\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | undefined\n}\n\n/**\n * Options for `transform`.\n *\n * @example\n * ```ts\n * const options: TransformOptions = { depth: 'deep', schema: (node) => node }\n * ```\n *\n * @example\n * ```ts\n * // Only transform the current node, not nested children\n * const options: TransformOptions = { depth: 'shallow', schema: (node) => node }\n * ```\n */\nexport type TransformOptions = Visitor & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Internal parent override used during recursion.\n */\n parent?: Node\n}\n\n/**\n * Options for `walk`.\n *\n * @example\n * ```ts\n * const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }\n * ```\n */\nexport type WalkOptions = AsyncVisitor & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Maximum number of sibling nodes visited concurrently.\n * @default 30\n */\n concurrency?: number\n}\n\n/**\n * Options for `collect`.\n *\n * @example\n * ```ts\n * const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }\n * ```\n */\nexport type CollectOptions<T> = CollectVisitor<T> & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Internal parent override used during recursion.\n */\n parent?: Node\n}\n\n/**\n * Returns the immediate traversable children of `node`.\n *\n * For `Schema` nodes, children (`properties`, `items`, `members`, and non-boolean\n * `additionalProperties`) are only included\n * when `recurse` is `true`; shallow mode skips them.\n *\n * @example\n * ```ts\n * const children = getChildren(operationNode, true)\n * // returns parameters, requestBody schema (if present), and responses\n * ```\n */\nfunction getChildren(node: Node, recurse: boolean): Array<Node> {\n switch (node.kind) {\n case 'Root':\n return [...node.schemas, ...node.operations]\n case 'Operation':\n return [...node.parameters, ...(node.requestBody?.schema ? [node.requestBody.schema] : []), ...node.responses]\n case 'Schema': {\n const children: Array<Node> = []\n\n if (!recurse) return []\n\n if ('properties' in node && node.properties.length > 0) children.push(...node.properties)\n if ('items' in node && node.items) children.push(...node.items)\n if ('members' in node && node.members) children.push(...node.members)\n if ('additionalProperties' in node && node.additionalProperties && node.additionalProperties !== true) children.push(node.additionalProperties)\n\n return children\n }\n case 'Property':\n return [node.schema]\n case 'Parameter':\n return [node.schema]\n case 'Response':\n return node.schema ? [node.schema] : []\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n case 'Type':\n return []\n }\n}\n\n/**\n * Depth-first traversal for side effects. Visitor return values are ignored.\n * Sibling nodes at each level are visited concurrently up to `options.concurrency`\n * (default: `WALK_CONCURRENCY`).\n *\n * @example\n * ```ts\n * await walk(root, {\n * operation(node) {\n * console.log(node.operationId)\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Visit only the current node\n * await walk(root, { depth: 'shallow', root: () => {} })\n * ```\n */\nexport async function walk(node: Node, options: WalkOptions): Promise<void> {\n const recurse = (options.depth ?? visitorDepths.deep) === visitorDepths.deep\n const limit = createLimit(options.concurrency ?? WALK_CONCURRENCY)\n\n return _walk(node, options, recurse, limit, undefined)\n}\n\nasync function _walk(node: Node, visitor: AsyncVisitor, recurse: boolean, limit: LimitFn, parent: Node | undefined): Promise<void> {\n switch (node.kind) {\n case 'Root':\n await limit(() => visitor.root?.(node, { parent: parent as ParentOf<RootNode> }))\n break\n case 'Operation':\n await limit(() => visitor.operation?.(node, { parent: parent as ParentOf<OperationNode> }))\n break\n case 'Schema':\n await limit(() => visitor.schema?.(node, { parent: parent as ParentOf<SchemaNode> }))\n break\n case 'Property':\n await limit(() => visitor.property?.(node, { parent: parent as ParentOf<PropertyNode> }))\n break\n case 'Parameter':\n await limit(() => visitor.parameter?.(node, { parent: parent as ParentOf<ParameterNode> }))\n break\n case 'Response':\n await limit(() => visitor.response?.(node, { parent: parent as ParentOf<ResponseNode> }))\n break\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n break\n }\n\n const children = getChildren(node, recurse)\n await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit, node)))\n}\n\n/**\n * Runs a depth-first immutable transform.\n *\n * If a visitor returns a node, it replaces the current node.\n * If it returns `undefined`, the current node stays the same.\n *\n * @example\n * ```ts\n * const next = transform(root, {\n * operation(node) {\n * return { ...node, operationId: `prefixed_${node.operationId}` }\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Shallow mode: only transform the input node\n * const next = transform(root, { depth: 'shallow', root: (node) => node })\n * ```\n */\nexport function transform(node: RootNode, options: TransformOptions): RootNode\nexport function transform(node: OperationNode, options: TransformOptions): OperationNode\nexport function transform(node: SchemaNode, options: TransformOptions): SchemaNode\nexport function transform(node: PropertyNode, options: TransformOptions): PropertyNode\nexport function transform(node: ParameterNode, options: TransformOptions): ParameterNode\nexport function transform(node: ResponseNode, options: TransformOptions): ResponseNode\nexport function transform(node: Node, options: TransformOptions): Node\nexport function transform(node: Node, options: TransformOptions): Node {\n const { depth, parent, ...visitor } = options\n const recurse = (depth ?? visitorDepths.deep) === visitorDepths.deep\n\n switch (node.kind) {\n case 'Root': {\n let root = node\n const replaced = visitor.root?.(root, { parent: parent as ParentOf<RootNode> })\n if (replaced) root = replaced\n\n return {\n ...root,\n schemas: root.schemas.map((s) => transform(s, { ...options, parent: root })),\n operations: root.operations.map((op) => transform(op, { ...options, parent: root })),\n }\n }\n case 'Operation': {\n let op = node\n const replaced = visitor.operation?.(op, { parent: parent as ParentOf<OperationNode> })\n if (replaced) op = replaced\n\n return {\n ...op,\n parameters: op.parameters.map((p) => transform(p, { ...options, parent: op })),\n requestBody: op.requestBody\n ? { ...op.requestBody, schema: op.requestBody.schema ? transform(op.requestBody.schema, { ...options, parent: op }) : undefined }\n : undefined,\n responses: op.responses.map((r) => transform(r, { ...options, parent: op })),\n }\n }\n case 'Schema': {\n let schema = node\n const replaced = visitor.schema?.(schema, { parent: parent as ParentOf<SchemaNode> })\n if (replaced) schema = replaced\n\n const childOptions = { ...options, parent: schema }\n\n return {\n ...schema,\n ...('properties' in schema && recurse ? { properties: schema.properties.map((p) => transform(p, childOptions)) } : {}),\n ...('items' in schema && recurse ? { items: schema.items?.map((i) => transform(i, childOptions)) } : {}),\n ...('members' in schema && recurse ? { members: schema.members?.map((m) => transform(m, childOptions)) } : {}),\n ...('additionalProperties' in schema && recurse && schema.additionalProperties && schema.additionalProperties !== true\n ? { additionalProperties: transform(schema.additionalProperties, childOptions) }\n : {}),\n } as SchemaNode\n }\n case 'Property': {\n let prop = node\n const replaced = visitor.property?.(prop, { parent: parent as ParentOf<PropertyNode> })\n if (replaced) prop = replaced\n\n return createProperty({\n ...prop,\n schema: transform(prop.schema, { ...options, parent: prop }),\n })\n }\n case 'Parameter': {\n let param = node\n const replaced = visitor.parameter?.(param, { parent: parent as ParentOf<ParameterNode> })\n if (replaced) param = replaced\n\n return createParameter({\n ...param,\n schema: transform(param.schema, { ...options, parent: param }),\n })\n }\n case 'Response': {\n let response = node\n const replaced = visitor.response?.(response, { parent: parent as ParentOf<ResponseNode> })\n if (replaced) response = replaced\n\n return {\n ...response,\n schema: transform(response.schema, { ...options, parent: response }),\n }\n }\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n case 'Type':\n return node\n }\n}\n\n/**\n * Composes multiple visitors into one visitor, applied left to right.\n *\n * For each node kind, output from one visitor is input to the next.\n * If a visitor returns `undefined`, the previous node value is kept.\n *\n * @example\n * ```ts\n * const visitor = composeTransformers(\n * { operation: (node) => ({ ...node, operationId: `a_${node.operationId}` }) },\n * { operation: (node) => ({ ...node, operationId: `b_${node.operationId}` }) },\n * )\n * ```\n */\nexport function composeTransformers(...visitors: Array<Visitor>): Visitor {\n return {\n root(node, context) {\n return visitors.reduce<RootNode>((acc, v) => v.root?.(acc, context) ?? acc, node)\n },\n operation(node, context) {\n return visitors.reduce<OperationNode>((acc, v) => v.operation?.(acc, context) ?? acc, node)\n },\n schema(node, context) {\n return visitors.reduce<SchemaNode>((acc, v) => v.schema?.(acc, context) ?? acc, node)\n },\n property(node, context) {\n return visitors.reduce<PropertyNode>((acc, v) => v.property?.(acc, context) ?? acc, node)\n },\n parameter(node, context) {\n return visitors.reduce<ParameterNode>((acc, v) => v.parameter?.(acc, context) ?? acc, node)\n },\n response(node, context) {\n return visitors.reduce<ResponseNode>((acc, v) => v.response?.(acc, context) ?? acc, node)\n },\n }\n}\n\n/**\n * Runs a depth-first synchronous collection pass.\n *\n * Non-`undefined` values returned by visitor callbacks are appended to the result.\n *\n * @example\n * ```ts\n * const ids = collect(root, {\n * operation(node) {\n * return node.operationId\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Collect from only the current node\n * const values = collect(root, { depth: 'shallow', root: () => 'root' })\n * ```\n */\nexport function collect<T>(node: Node, options: CollectOptions<T>): Array<T> {\n const { depth, parent, ...visitor } = options\n const recurse = (depth ?? visitorDepths.deep) === visitorDepths.deep\n const results: Array<T> = []\n\n let v: T | undefined\n switch (node.kind) {\n case 'Root':\n v = visitor.root?.(node, { parent: parent as ParentOf<RootNode> })\n break\n case 'Operation':\n v = visitor.operation?.(node, { parent: parent as ParentOf<OperationNode> })\n break\n case 'Schema':\n v = visitor.schema?.(node, { parent: parent as ParentOf<SchemaNode> })\n break\n case 'Property':\n v = visitor.property?.(node, { parent: parent as ParentOf<PropertyNode> })\n break\n case 'Parameter':\n v = visitor.parameter?.(node, { parent: parent as ParentOf<ParameterNode> })\n break\n case 'Response':\n v = visitor.response?.(node, { parent: parent as ParentOf<ResponseNode> })\n break\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n break\n }\n if (v !== undefined) results.push(v)\n\n for (const child of getChildren(node, recurse)) {\n for (const item of collect(child, { ...options, parent: node })) {\n results.push(item)\n }\n }\n\n return results\n}\n","import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from './guards.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\nimport { extractRefName } from './refs.ts'\nimport { collect } from './visitor.ts'\n\nexport function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string | null {\n if (!mapping || !ref) return null\n return Object.entries(mapping).find(([, value]) => value === ref)?.[0] ?? null\n}\n\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Collects import entries for all `ref` schema nodes in `node`.\n */\nexport function collectImports<TImport>({\n node,\n nameMapping,\n resolve,\n}: {\n node: SchemaNode\n nameMapping: Map<string, string>\n resolve: (schemaName: string) => TImport | undefined\n}): Array<TImport> {\n return collect<TImport>(node, {\n schema(schemaNode): TImport | undefined {\n const schemaRef = narrowSchema(schemaNode, 'ref')\n if (!schemaRef?.ref) return\n\n const rawName = extractRefName(schemaRef.ref)\n const schemaName = nameMapping.get(rawName) ?? rawName\n const result = resolve(schemaName)\n if (!result) return\n\n return result\n },\n })\n}\n","import { isScalarPrimitive } from './constants.ts'\nimport { createProperty, createSchema } from './factory.ts'\nimport { narrowSchema } from './guards.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\nimport { enumPropName } from './resolvers.ts'\n\n/**\n * Replaces a discriminator property's schema with a string enum of allowed values.\n *\n * If `node` is not an object schema, or if the property does not exist, the input\n * node is returned as-is.\n *\n * @example\n * ```ts\n * const schema = createSchema({\n * type: 'object',\n * properties: [createProperty({ name: 'type', required: true, schema: createSchema({ type: 'string' }) })],\n * })\n * const result = setDiscriminatorEnum({ node: schema, propertyName: 'type', values: ['dog', 'cat'] })\n * ```\n */\nexport function setDiscriminatorEnum({\n node,\n propertyName,\n values,\n enumName,\n}: {\n node: SchemaNode\n propertyName: string\n values: Array<string>\n enumName?: string\n}): SchemaNode {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) {\n return node\n }\n\n const hasProperty = objectNode.properties.some((prop) => prop.name === propertyName)\n if (!hasProperty) {\n return node\n }\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) {\n return prop\n }\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n}\n\n/**\n * Merges adjacent anonymous object members into a single anonymous object member.\n *\n * @example\n * ```ts\n * const merged = mergeAdjacentObjects([\n * createSchema({ type: 'object', properties: [createProperty({ name: 'a', schema: createSchema({ type: 'string' }) })] }),\n * createSchema({ type: 'object', properties: [createProperty({ name: 'b', schema: createSchema({ type: 'number' }) })] }),\n * ])\n * ```\n */\nexport function mergeAdjacentObjects(members: Array<SchemaNode>): Array<SchemaNode> {\n return members.reduce<Array<SchemaNode>>((acc, member) => {\n const objectMember = narrowSchema(member, 'object')\n if (objectMember && !objectMember.name) {\n const previous = acc.at(-1)\n const previousObject = previous ? narrowSchema(previous, 'object') : undefined\n\n if (previousObject && !previousObject.name) {\n acc[acc.length - 1] = createSchema({\n ...previousObject,\n properties: [...(previousObject.properties ?? []), ...(objectMember.properties ?? [])],\n })\n return acc\n }\n }\n\n acc.push(member)\n return acc\n }, [])\n}\n\n/**\n * Removes enum members that are covered by broader scalar primitives in the same union.\n *\n * @example\n * ```ts\n * const simplified = simplifyUnion([\n * createSchema({ type: 'enum', primitive: 'string', enumValues: ['active'] }),\n * createSchema({ type: 'string' }),\n * ])\n * // keeps only string member\n * ```\n */\nexport function simplifyUnion(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n\n if (!scalarPrimitives.size) {\n return members\n }\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) {\n return true\n }\n\n const primitive = enumNode.primitive\n if (!primitive) {\n return true\n }\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) {\n return true\n }\n\n if (scalarPrimitives.has(primitive)) {\n return false\n }\n\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) {\n return false\n }\n\n return true\n })\n}\n\nexport function setEnumName(propNode: SchemaNode, parentName: string | null | undefined, propName: string, enumSuffix: string): SchemaNode {\n const enumNode = narrowSchema(propNode, 'enum')\n\n if (enumNode?.primitive === 'boolean') {\n return { ...propNode, name: undefined }\n }\n\n if (enumNode) {\n return { ...propNode, name: enumPropName(parentName, propName, enumSuffix) }\n }\n\n return propNode\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\n\nimport { createFunctionParameter, createFunctionParameters, createParameterGroup, createProperty, createSchema, createTypeNode } from './factory.ts'\nimport { narrowSchema } from './guards.ts'\nimport type { FunctionParameterNode, FunctionParametersNode, OperationNode, ParameterGroupNode, ParameterNode, SchemaNode, TypeNode } from './nodes/index.ts'\nimport type { SchemaType } from './nodes/schema.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns `true` when a schema is emitted as a plain `string` type.\n *\n * - `string`, `uuid`, `email`, `url`, `datetime` are always plain strings.\n * - `date` and `time` are plain strings when their `representation` is `'string'` rather than `'date'`.\n *\n * @example\n * ```ts\n * isStringType(createSchema({ type: 'uuid' })) // true\n * isStringType(createSchema({ type: 'date', representation: 'date' })) // false\n * ```\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Applies casing rules to parameter names and returns a new parameter array.\n *\n * The input array is not mutated.\n * If `casing` is not set, the original array is returned unchanged.\n *\n * Use this before passing parameters to schema builders so that property keys\n * in generated output match the desired casing while preserving\n * `OperationNode.parameters` for other consumers.\n *\n * @example\n * ```ts\n * const params = [createParameter({ name: 'pet_id', in: 'query', schema: createSchema({ type: 'string' }) })]\n * const cased = caseParams(params, 'camelcase')\n * // cased[0].name === 'petId'\n * ```\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) {\n return params\n }\n\n return params.map((param) => {\n const transformed = casing === 'camelcase' || !isValidVarName(param.name) ? camelCase(param.name) : param.name\n\n return { ...param, name: transformed }\n })\n}\n\n/**\n * Creates a single-property object schema used as a discriminator literal.\n *\n * @example\n * ```ts\n * createDiscriminantNode({ propertyName: 'type', value: 'dog' })\n * // -> { type: 'object', properties: [{ name: 'type', required: true, schema: enum('dog') }] }\n * ```\n */\nexport function createDiscriminantNode({ propertyName, value }: { propertyName: string; value: string }): SchemaNode {\n return createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n createProperty({\n name: propertyName,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: [value],\n }),\n required: true,\n }),\n ],\n })\n}\n\n/**\n * Named type for a group of parameters (query or header) emitted as a single typed parameter.\n */\nexport type ParamGroupType = {\n /**\n * TypeNode for the group type.\n */\n type: TypeNode\n /**\n * Whether the parameter group is optional.\n */\n optional: boolean\n}\n\n/**\n * Resolver interface for {@link createOperationParams}.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\n resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string\n}\n\n/**\n * Options for {@link createOperationParams}.\n */\nexport type CreateOperationParamsOptions = {\n /**\n * How all operation parameters are grouped in the function signature.\n * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`\n * - `'inline'` emits each param category as a separate top-level parameter\n */\n paramsType: 'object' | 'inline'\n /**\n * How path parameters are emitted when `paramsType` is `'inline'`.\n * - `'object'` groups them as `{ petId, storeId }: PathParams`\n * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`\n * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`\n */\n pathParamsType: 'object' | 'inline' | 'inlineSpread'\n /**\n * Converts parameter names to camelCase before output.\n */\n paramsCasing?: 'camelcase'\n /**\n * Resolver for parameter and request body type names.\n * Pass `ResolverTs` from `@kubb/plugin-ts` directly.\n * When omitted, falls back to the schema primitive or `'unknown'`.\n */\n resolver?: OperationParamsResolver\n /**\n * Default value for the path parameters binding when `pathParamsType` is `'object'`.\n * Falls back to `'{}'` when all path params are optional.\n */\n pathParamsDefault?: string\n /**\n * Extra parameters appended after the standard operation parameters.\n *\n * @example Plugin-specific trailing parameter\n * ```ts\n * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]\n * ```\n */\n extraParams?: Array<FunctionParameterNode | ParameterGroupNode>\n /**\n * Override the default parameter names used for body, query, header, and rest-path groups.\n *\n * Useful when targeting languages or frameworks with different naming conventions.\n *\n * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }\n */\n paramNames?: {\n /**\n * Name for the request body parameter.\n * @default 'data'\n */\n data?: string\n /**\n * Name for the query parameters group parameter.\n * @default 'params'\n */\n params?: string\n /**\n * Name for the header parameters group parameter.\n * @default 'headers'\n */\n headers?: string\n /**\n * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.\n * @default 'pathParams'\n */\n path?: string\n }\n /**\n * Applies a uniform transformation to every resolved type name before it is used\n * in a parameter node. Use this for framework-level type wrappers.\n *\n * @example Vue Query — wrap every parameter type with `MaybeRefOrGetter`\n * `typeWrapper: (t) => \\`MaybeRefOrGetter<${t}>\\``\n */\n typeWrapper?: (type: string) => string\n}\n\nfunction resolveType({ node, param, resolver }: { node: OperationNode; param: ParameterNode; resolver: OperationParamsResolver | undefined }): TypeNode {\n if (!resolver) {\n return createTypeNode({ variant: 'reference', name: param.schema.primitive ?? 'unknown' })\n }\n\n const individualName = resolver.resolveParamName(node, param)\n\n const groupLocation = param.in === 'path' || param.in === 'query' || param.in === 'header' ? param.in : undefined\n\n const groupResolvers = {\n path: resolver.resolvePathParamsName,\n query: resolver.resolveQueryParamsName,\n header: resolver.resolveHeaderParamsName,\n } as const\n\n const groupName = groupLocation ? groupResolvers[groupLocation].call(resolver, node, param) : undefined\n\n if (groupName && groupName !== individualName) {\n return createTypeNode({ variant: 'member', base: groupName, key: param.name })\n }\n\n return createTypeNode({ variant: 'reference', name: individualName })\n}\n\n/**\n * Converts an {@link OperationNode} into a {@link FunctionParametersNode}.\n *\n * Centralizes the per-plugin `getParams()` pattern. Provide a `resolver` for\n * type resolution and `extraParams` for plugin-specific trailing parameters.\n *\n * @example\n * ```ts\n * const params = createOperationParams(node, {\n * paramsType: 'inline',\n * pathParamsType: 'inline',\n * resolver: tsResolver,\n * extraParams: [createFunctionParameter({ name: 'options', type: createTypeNode({ variant: 'reference', name: 'Partial<RequestOptions>' }), default: '{}' })],\n * })\n * ```\n */\nexport function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode {\n const { paramsType, pathParamsType, paramsCasing, resolver, pathParamsDefault, extraParams = [], paramNames, typeWrapper } = options\n\n const dataName = paramNames?.data ?? 'data'\n const paramsName = paramNames?.params ?? 'params'\n const headersName = paramNames?.headers ?? 'headers'\n const pathName = paramNames?.path ?? 'pathParams'\n\n const wrapType = (type: string): TypeNode => createTypeNode({ variant: 'reference', name: typeWrapper ? typeWrapper(type) : type })\n // Only reference TypeNodes are wrapped (they hold a plain type name string).\n // Member and struct TypeNodes are pre-resolved structured expressions and are passed through unchanged.\n const wrapTypeNode = (type: TypeNode): TypeNode => (type.variant === 'reference' ? wrapType(type.name) : type)\n\n const casedParams = caseParams(node.parameters, paramsCasing)\n const pathParams = casedParams.filter((p) => p.in === 'path')\n const queryParams = casedParams.filter((p) => p.in === 'query')\n const headerParams = casedParams.filter((p) => p.in === 'header')\n\n const bodyType = node.requestBody?.schema ? wrapType(resolver?.resolveDataName(node) ?? 'unknown') : undefined\n const bodyRequired = node.requestBody?.required ?? false\n\n const queryGroupType = resolver ? resolveGroupType({ node, params: queryParams, groupMethod: resolver.resolveQueryParamsName, resolver }) : undefined\n const headerGroupType = resolver ? resolveGroupType({ node, params: headerParams, groupMethod: resolver.resolveHeaderParamsName, resolver }) : undefined\n\n const params: Array<FunctionParameterNode | ParameterGroupNode> = []\n\n if (paramsType === 'object') {\n const children: Array<FunctionParameterNode> = [\n ...pathParams.map((p) => {\n const type = resolveType({ node, param: p, resolver })\n return createFunctionParameter({ name: p.name, type: wrapTypeNode(type), optional: !p.required })\n }),\n ...(bodyType ? [createFunctionParameter({ name: dataName, type: bodyType, optional: !bodyRequired })] : []),\n ...buildGroupParam({ name: paramsName, node, params: queryParams, groupType: queryGroupType, resolver, wrapType }),\n ...buildGroupParam({ name: headersName, node, params: headerParams, groupType: headerGroupType, resolver, wrapType }),\n ]\n\n if (children.length) {\n params.push(createParameterGroup({ properties: children, default: children.every((c) => c.optional) ? '{}' : undefined }))\n }\n } else {\n if (pathParams.length) {\n if (pathParamsType === 'inlineSpread') {\n const spreadType = resolver?.resolvePathParamsName(node, pathParams[0]!) ?? undefined\n params.push(createFunctionParameter({ name: pathName, type: spreadType ? wrapType(spreadType) : undefined, rest: true }))\n } else {\n const pathChildren = pathParams.map((p) => {\n const type = resolveType({ node, param: p, resolver })\n return createFunctionParameter({ name: p.name, type: wrapTypeNode(type), optional: !p.required })\n })\n params.push(\n createParameterGroup({\n properties: pathChildren,\n inline: pathParamsType === 'inline',\n default: pathParamsDefault ?? (pathChildren.every((c) => c.optional) ? '{}' : undefined),\n }),\n )\n }\n }\n\n if (bodyType) {\n params.push(createFunctionParameter({ name: dataName, type: bodyType, optional: !bodyRequired }))\n }\n\n params.push(...buildGroupParam({ name: paramsName, node, params: queryParams, groupType: queryGroupType, resolver, wrapType }))\n params.push(...buildGroupParam({ name: headersName, node, params: headerParams, groupType: headerGroupType, resolver, wrapType }))\n }\n\n params.push(...extraParams)\n\n return createFunctionParameters({ params })\n}\n\n/**\n * Builds a single {@link FunctionParameterNode} for a query or header group.\n * Returns an empty array when there are no params to emit.\n *\n * If a pre-resolved `groupType` is provided it emits `name: GroupType`.\n * Otherwise, it builds an inline struct from the individual params.\n */\nfunction buildGroupParam({\n name,\n node,\n params,\n groupType,\n resolver,\n wrapType,\n}: {\n name: string\n node: OperationNode\n params: Array<ParameterNode>\n groupType: ParamGroupType | undefined\n resolver: OperationParamsResolver | undefined\n wrapType: (type: string) => TypeNode\n}): Array<FunctionParameterNode> {\n if (groupType) {\n const type = groupType.type.variant === 'reference' ? wrapType(groupType.type.name) : groupType.type\n return [createFunctionParameter({ name, type, optional: groupType.optional })]\n }\n if (params.length) {\n return [\n createFunctionParameter({\n name,\n type: toStructType({ node, params, resolver }),\n optional: params.every((p) => !p.required),\n }),\n ]\n }\n return []\n}\n\n/**\n * Derives a {@link ParamGroupType} from the resolver's group method.\n * Returns `undefined` when the group name equals the individual param name (no real group).\n */\nfunction resolveGroupType({\n node,\n params,\n groupMethod,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n groupMethod: (_node: OperationNode, _param: ParameterNode) => string\n resolver: OperationParamsResolver\n}): ParamGroupType | undefined {\n if (!params.length) {\n return undefined\n }\n const firstParam = params[0]!\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return undefined\n }\n const allOptional = params.every((p) => !p.required)\n return { type: createTypeNode({ variant: 'reference', name: groupName }), optional: allOptional }\n}\n\n/**\n * Builds a {@link TypeNode} with `variant: 'struct'` for an inline anonymous type grouping named fields.\n *\n * Used when query or header parameters have no dedicated group type name.\n * Each language printer renders this appropriately (TypeScript: `{ petId: string; name?: string }`).\n */\nfunction toStructType({\n node,\n params,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n resolver: OperationParamsResolver | undefined\n}): TypeNode {\n return createTypeNode({\n variant: 'struct',\n properties: params.map((p) => ({ name: p.name, optional: !p.required, type: resolveType({ node, param: p, resolver })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
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/constants.ts","../src/factory.ts","../src/guards.ts","../src/printer.ts","../src/refs.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../src/visitor.ts","../src/resolvers.ts","../src/transformers.ts","../src/utils.ts"],"sourcesContent":["import type { NodeKind } from './nodes/base.ts'\nimport type { MediaType } from './nodes/http.ts'\nimport type { HttpMethod } from './nodes/operation.ts'\nimport type { ParameterLocation } from './nodes/parameter.ts'\nimport type { SchemaType } from './nodes/schema.ts'\n\n/**\n * Traversal depth used by AST visitor utilities.\n */\nexport type VisitorDepth = 'shallow' | 'deep'\n\nexport const visitorDepths = {\n shallow: 'shallow',\n deep: 'deep',\n} as const satisfies Record<VisitorDepth, VisitorDepth>\n\nexport const nodeKinds = {\n root: 'Root',\n operation: 'Operation',\n schema: 'Schema',\n property: 'Property',\n parameter: 'Parameter',\n response: 'Response',\n functionParameter: 'FunctionParameter',\n parameterGroup: 'ParameterGroup',\n functionParameters: 'FunctionParameters',\n} as const satisfies Record<string, NodeKind>\n\n/**\n * Canonical schema type strings used by AST schema nodes.\n *\n * These values are used across the AST as stable discriminators\n * (for example `schema.type === schemaTypes.object`).\n *\n * The map is grouped by intent:\n * - primitives (`string`, `number`, `boolean`, ...)\n * - structural/composite (`object`, `array`, `union`, ...)\n * - special OpenAPI-oriented types (`ref`, `datetime`, `uuid`, ...)\n */\nexport const schemaTypes = {\n /**\n * Text value.\n */\n string: 'string',\n /**\n * Floating-point number (`float`, `double`).\n */\n number: 'number',\n /**\n * Whole number (`int32`). Use `bigint` for `int64`.\n */\n integer: 'integer',\n /**\n * 64-bit integer (`int64`). Only used when `integerType` is set to `'bigint'`.\n */\n bigint: 'bigint',\n /**\n * Boolean value\n */\n boolean: 'boolean',\n /**\n * Explicit null value.\n */\n null: 'null',\n /**\n * Any value (no type restriction).\n */\n any: 'any',\n /**\n * Unknown value (must be narrowed before usage).\n */\n unknown: 'unknown',\n /**\n * No return value (`void`).\n */\n void: 'void',\n /**\n * Object with named properties.\n */\n object: 'object',\n /**\n * Sequential list of items.\n */\n array: 'array',\n /**\n * Fixed-length list with position-specific items.\n */\n tuple: 'tuple',\n /**\n * \"One of\" multiple schema members.\n */\n union: 'union',\n /**\n * \"All of\" multiple schema members.\n */\n intersection: 'intersection',\n /**\n * Enum schema.\n */\n enum: 'enum',\n /**\n * Reference to another schema.\n */\n ref: 'ref',\n /**\n * Calendar date (for example `2026-03-24`).\n */\n date: 'date',\n /**\n * Date-time value (for example `2026-03-24T09:00:00Z`).\n */\n datetime: 'datetime',\n /**\n * Time-only value (for example `09:00:00`).\n */\n time: 'time',\n /**\n * UUID value.\n */\n uuid: 'uuid',\n /**\n * Email address value.\n */\n email: 'email',\n /**\n * URL value.\n */\n url: 'url',\n /**\n * IPv4 address value.\n */\n ipv4: 'ipv4',\n /**\n * IPv6 address value.\n */\n ipv6: 'ipv6',\n /**\n * Binary/blob value.\n */\n blob: 'blob',\n /**\n * Impossible value (`never`).\n */\n never: 'never',\n} as const satisfies Record<SchemaType, SchemaType>\n\nexport type ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Primitive scalar schema types used when simplifying union members.\n */\nexport const SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\n/**\n * Returns `true` when `type` is a scalar primitive schema type.\n */\nexport function isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\nexport const httpMethods = {\n get: 'GET',\n post: 'POST',\n put: 'PUT',\n patch: 'PATCH',\n delete: 'DELETE',\n head: 'HEAD',\n options: 'OPTIONS',\n trace: 'TRACE',\n} as const satisfies Record<Lowercase<HttpMethod>, HttpMethod>\n\nexport const parameterLocations = {\n path: 'path',\n query: 'query',\n header: 'header',\n cookie: 'cookie',\n} as const satisfies Record<ParameterLocation, ParameterLocation>\n\n/**\n * Default maximum number of concurrent callbacks used by `walk`.\n *\n * 30 is chosen to allow enough parallelism to overlap I/O-bound resolver calls\n * without overwhelming the event loop or causing excessive memory pressure during\n * large spec traversals.\n *\n * @example\n * ```ts\n * walk(root, { concurrency: WALK_CONCURRENCY, root: () => {} })\n * ```\n */\nexport const WALK_CONCURRENCY = 30\n\n/**\n * Fallback response status code used for catch-all responses.\n *\n * @example\n * ```ts\n * const status = DEFAULT_STATUS_CODE // 'default'\n * ```\n */\nexport const DEFAULT_STATUS_CODE = 'default' as const\n\nexport const mediaTypes = {\n applicationJson: 'application/json',\n applicationXml: 'application/xml',\n applicationFormUrlEncoded: 'application/x-www-form-urlencoded',\n applicationOctetStream: 'application/octet-stream',\n applicationPdf: 'application/pdf',\n applicationZip: 'application/zip',\n applicationGraphql: 'application/graphql',\n multipartFormData: 'multipart/form-data',\n textPlain: 'text/plain',\n textHtml: 'text/html',\n textCsv: 'text/csv',\n textXml: 'text/xml',\n imagePng: 'image/png',\n imageJpeg: 'image/jpeg',\n imageGif: 'image/gif',\n imageWebp: 'image/webp',\n imageSvgXml: 'image/svg+xml',\n audioMpeg: 'audio/mpeg',\n videoMp4: 'video/mp4',\n} as const satisfies Record<string, MediaType>\n","import type { InferSchemaNode } from './infer.ts'\nimport type {\n FunctionParameterNode,\n FunctionParametersNode,\n ObjectSchemaNode,\n OperationNode,\n ParameterGroupNode,\n ParameterNode,\n PrimitiveSchemaType,\n PropertyNode,\n ResponseNode,\n RootNode,\n SchemaNode,\n TypeNode,\n} from './nodes/index.ts'\n\n/**\n * Syncs property/parameter schema optionality flags from `required` and `schema.nullable`.\n *\n * - `optional` is set for non-required, non-nullable schemas.\n * - `nullish` is set for non-required, nullable schemas.\n */\nexport function syncOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n\n/**\n * Distributive `Omit` that preserves each member of a union.\n *\n * @example\n * ```ts\n * type A = { kind: 'a'; keep: string; drop: number }\n * type B = { kind: 'b'; keep: boolean; drop: number }\n * type Result = DistributiveOmit<A | B, 'drop'>\n * // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }\n * ```\n */\nexport type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\ntype CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & { properties?: Array<PropertyNode>; primitive?: 'object' }\ntype CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\ntype CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & { kind: 'Schema' }\n\n/**\n * Creates a `RootNode` with stable defaults for `schemas` and `operations`.\n *\n * @example\n * ```ts\n * const root = createRoot()\n * // { kind: 'Root', schemas: [], operations: [] }\n * ```\n *\n * @example\n * ```ts\n * const root = createRoot({ schemas: [petSchema] })\n * // keeps default operations: []\n * ```\n */\nexport function createRoot(overrides: Partial<Omit<RootNode, 'kind'>> = {}): RootNode {\n return {\n schemas: [],\n operations: [],\n ...overrides,\n kind: 'Root',\n }\n}\n\n/**\n * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.\n *\n * @example\n * ```ts\n * const operation = createOperation({\n * operationId: 'getPetById',\n * method: 'GET',\n * path: '/pet/{petId}',\n * })\n * // tags, parameters, and responses are []\n * ```\n *\n * @example\n * ```ts\n * const operation = createOperation({\n * operationId: 'findPets',\n * method: 'GET',\n * path: '/pet/findByStatus',\n * tags: ['pet'],\n * })\n * ```\n */\nexport function createOperation(\n props: Pick<OperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<OperationNode, 'kind' | 'operationId' | 'method' | 'path'>>,\n): OperationNode {\n return {\n tags: [],\n parameters: [],\n responses: [],\n ...props,\n kind: 'Operation',\n }\n}\n\n/**\n * Maps schema `type` to its underlying `primitive`.\n * Primitive types map to themselves; special string formats map to `'string'`.\n * Complex types (`ref`, `enum`, `union`, `intersection`, `tuple`, `blob`) are left unset.\n */\nconst TYPE_TO_PRIMITIVE: Partial<Record<SchemaNode['type'], PrimitiveSchemaType>> = {\n string: 'string',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n boolean: 'boolean',\n null: 'null',\n any: 'any',\n unknown: 'unknown',\n void: 'void',\n never: 'never',\n object: 'object',\n array: 'array',\n date: 'date',\n uuid: 'string',\n email: 'string',\n url: 'string',\n datetime: 'string',\n time: 'string',\n}\n\n/**\n * Creates a `SchemaNode`, narrowed to the variant of `props.type`.\n * For object schemas, `properties` defaults to an empty array.\n * `primitive` is automatically inferred from `type` when not explicitly provided.\n *\n * @example\n * ```ts\n * const scalar = createSchema({ type: 'string' })\n * // { kind: 'Schema', type: 'string', primitive: 'string' }\n * ```\n *\n * @example\n * ```ts\n * const uuid = createSchema({ type: 'uuid' })\n * // { kind: 'Schema', type: 'uuid', primitive: 'string' }\n * ```\n *\n * @example\n * ```ts\n * const object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }\n * ```\n *\n * @example\n * ```ts\n * const enumSchema = createSchema({\n * type: 'enum',\n * primitive: 'string',\n * enumValues: ['available', 'pending'],\n * })\n * ```\n */\nexport function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>\nexport function createSchema(props: CreateSchemaInput): SchemaNode\nexport function createSchema(props: CreateSchemaInput): SchemaNode {\n const inferredPrimitive = TYPE_TO_PRIMITIVE[props.type as keyof typeof TYPE_TO_PRIMITIVE]\n\n if (props['type'] === 'object') {\n return { properties: [], primitive: 'object', ...props, kind: 'Schema' } as CreateSchemaOutput<typeof props>\n }\n\n return { primitive: inferredPrimitive, ...props, kind: 'Schema' } as CreateSchemaOutput<typeof props>\n}\n\n/**\n * Creates a `PropertyNode`.\n *\n * `required` defaults to `false`.\n * `schema.optional` and `schema.nullish` are derived from `required` and `schema.nullable`.\n *\n * @example\n * ```ts\n * const property = createProperty({\n * name: 'status',\n * schema: createSchema({ type: 'string' }),\n * })\n * // required=false, schema.optional=true\n * ```\n *\n * @example\n * ```ts\n * const property = createProperty({\n * name: 'status',\n * required: true,\n * schema: createSchema({ type: 'string', nullable: true }),\n * })\n * // required=true, no optional/nullish\n * ```\n */\nexport function createProperty(props: Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>): PropertyNode {\n const required = props.required ?? false\n\n return {\n ...props,\n kind: 'Property',\n required,\n schema: syncOptionality(props.schema, required),\n }\n}\n\n/**\n * Creates a `ParameterNode`.\n *\n * `required` defaults to `false`.\n * Nested schema flags are set from `required` and `schema.nullable`.\n *\n * @example\n * ```ts\n * const param = createParameter({\n * name: 'petId',\n * in: 'path',\n * required: true,\n * schema: createSchema({ type: 'string' }),\n * })\n * ```\n *\n * @example\n * ```ts\n * const param = createParameter({\n * name: 'status',\n * in: 'query',\n * schema: createSchema({ type: 'string', nullable: true }),\n * })\n * // required=false, schema.nullish=true\n * ```\n */\nexport function createParameter(\n props: Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>,\n): ParameterNode {\n const required = props.required ?? false\n return {\n ...props,\n kind: 'Parameter',\n required,\n schema: syncOptionality(props.schema, required),\n }\n}\n\n/**\n * Creates a `ResponseNode`.\n *\n * @example\n * ```ts\n * const response = createResponse({\n * statusCode: '200',\n * description: 'Success',\n * schema: createSchema({ type: 'object', properties: [] }),\n * })\n * ```\n */\nexport function createResponse(\n props: Pick<ResponseNode, 'statusCode' | 'schema'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'schema'>>,\n): ResponseNode {\n return {\n ...props,\n kind: 'Response',\n }\n}\n\n/**\n * Creates a `FunctionParameterNode`.\n *\n * `optional` defaults to `false`.\n *\n * @example Required typed param\n * ```ts\n * createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }) })\n * // → petId: string\n * ```\n *\n * @example Optional param\n * ```ts\n * createFunctionParameter({ name: 'params', type: createTypeNode({ variant: 'reference', name: 'QueryParams' }), optional: true })\n * // → params?: QueryParams\n * ```\n *\n * @example Param with default (implicitly optional; cannot combine with `optional: true`)\n * ```ts\n * createFunctionParameter({ name: 'config', type: createTypeNode({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })\n * // → config: RequestConfig = {}\n * ```\n */\nexport function createFunctionParameter(\n props: { name: string; type?: TypeNode; rest?: boolean } & ({ optional: true; default?: never } | { optional?: false; default?: string }),\n): FunctionParameterNode {\n return {\n optional: false,\n ...props,\n kind: 'FunctionParameter',\n } as FunctionParameterNode\n}\n\n/**\n * Creates a {@link TypeNode} representing a language-agnostic structured type expression.\n *\n * Use `variant: 'struct'` for inline anonymous types and `variant: 'member'` for a single\n * named field accessed from a group type. Each language's printer renders the variant\n * into its own syntax (TypeScript, Python, C#, Kotlin, …).\n *\n * @example Reference type (TypeScript: `QueryParams`)\n * ```ts\n * createTypeNode({ variant: 'reference', name: 'QueryParams' })\n * ```\n *\n * @example Struct type (TypeScript: `{ petId: string }`)\n * ```ts\n * createTypeNode({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createTypeNode({ variant: 'reference', name: 'string' }) }] })\n * ```\n *\n * @example Member type (TypeScript: `DeletePetPathParams['petId']`)\n * ```ts\n * createTypeNode({ variant: 'member', base: 'DeletePetPathParams', key: 'petId' })\n * ```\n */\nexport function createTypeNode(\n props:\n | { variant: 'reference'; name: string }\n | { variant: 'struct'; properties: Array<{ name: string; optional: boolean; type: TypeNode }> }\n | { variant: 'member'; base: string; key: string },\n): TypeNode {\n return { ...props, kind: 'Type' } as TypeNode\n}\n\n/**\n * Creates a `ParameterGroupNode` representing a group of related parameters treated as a unit.\n *\n * @example Grouped param (TypeScript declaration)\n * ```ts\n * createParameterGroup({\n * properties: [\n * createFunctionParameter({ name: 'id', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false }),\n * createFunctionParameter({ name: 'name', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: true }),\n * ],\n * default: '{}',\n * })\n * // declaration → { id, name? }: { id: string; name?: string } = {}\n * // call → { id, name }\n * ```\n *\n * @example Inline (spread) — children emitted as individual top-level parameters\n * ```ts\n * createParameterGroup({\n * properties: [createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false })],\n * inline: true,\n * })\n * // declaration → petId: string\n * // call → petId\n * ```\n */\nexport function createParameterGroup(\n props: Pick<ParameterGroupNode, 'properties'> & Partial<Omit<ParameterGroupNode, 'kind' | 'properties'>>,\n): ParameterGroupNode {\n return {\n ...props,\n kind: 'ParameterGroup',\n }\n}\n\n/**\n * Creates a `FunctionParametersNode` from an ordered list of parameters.\n *\n * @example\n * ```ts\n * createFunctionParameters({\n * params: [\n * createFunctionParameter({ name: 'petId', type: createTypeNode({ variant: 'reference', name: 'string' }), optional: false }),\n * createFunctionParameter({ name: 'config', type: createTypeNode({ variant: 'reference', name: 'RequestConfig' }), optional: false, default: '{}' }),\n * ],\n * })\n * ```\n *\n * @example\n * ```ts\n * const empty = createFunctionParameters()\n * // { kind: 'FunctionParameters', params: [] }\n * ```\n */\nexport function createFunctionParameters(props: Partial<Omit<FunctionParametersNode, 'kind'>> = {}): FunctionParametersNode {\n return {\n params: [],\n ...props,\n kind: 'FunctionParameters',\n }\n}\n","import type {\n FunctionParameterNode,\n FunctionParametersNode,\n Node,\n NodeKind,\n OperationNode,\n ParameterGroupNode,\n ParameterNode,\n PropertyNode,\n ResponseNode,\n RootNode,\n SchemaNode,\n SchemaNodeByType,\n} from './nodes/index.ts'\n\n/**\n * Narrows a `SchemaNode` to the variant that matches `type`.\n *\n * @example\n * ```ts\n * const schema = createSchema({ type: 'string' })\n * const stringNode = narrowSchema(schema, 'string') // StringSchemaNode | undefined\n * ```\n */\nexport function narrowSchema<T extends SchemaNode['type']>(node: SchemaNode | undefined, type: T): SchemaNodeByType[T] | undefined {\n return node?.type === type ? (node as SchemaNodeByType[T]) : undefined\n}\n\nfunction isKind<T extends Node>(kind: NodeKind) {\n return (node: unknown): node is T => (node as Node).kind === kind\n}\n\n/**\n * Returns `true` when the input is a `RootNode`.\n *\n * @example\n * ```ts\n * if (isRootNode(node)) {\n * console.log(node.schemas.length)\n * }\n * ```\n */\nexport const isRootNode = isKind<RootNode>('Root')\n\n/**\n * Returns `true` when the input is an `OperationNode`.\n *\n * @example\n * ```ts\n * if (isOperationNode(node)) {\n * console.log(node.operationId)\n * }\n * ```\n */\nexport const isOperationNode = isKind<OperationNode>('Operation')\n\n/**\n * Returns `true` when the input is a `SchemaNode`.\n *\n * @example\n * ```ts\n * if (isSchemaNode(node)) {\n * console.log(node.type)\n * }\n * ```\n */\nexport const isSchemaNode = isKind<SchemaNode>('Schema')\n\n/**\n * Returns `true` when the input is a `PropertyNode`.\n */\nexport const isPropertyNode = isKind<PropertyNode>('Property')\n\n/**\n * Returns `true` when the input is a `ParameterNode`.\n */\nexport const isParameterNode = isKind<ParameterNode>('Parameter')\n\n/**\n * Returns `true` when the input is a `ResponseNode`.\n */\nexport const isResponseNode = isKind<ResponseNode>('Response')\n\n/**\n * Returns `true` when the input is a `FunctionParameterNode`.\n */\nexport const isFunctionParameterNode = isKind<FunctionParameterNode>('FunctionParameter')\n\n/**\n * Returns `true` when the input is a `ParameterGroupNode`.\n */\nexport const isParameterGroupNode = isKind<ParameterGroupNode>('ParameterGroup')\n\n/**\n * Returns `true` when the input is a `FunctionParametersNode`.\n */\nexport const isFunctionParametersNode = isKind<FunctionParametersNode>('FunctionParameters')\n","import type { SchemaNode, SchemaNodeByType, SchemaType } from './nodes/index.ts'\n\n/**\n * Runtime context passed as `this` to printer handlers.\n *\n * `this.transform` dispatches to node-level handlers from `nodes`.\n *\n * @example\n * ```ts\n * const context: PrinterHandlerContext<string, {}> = {\n * options: {},\n * transform: () => 'value',\n * }\n * ```\n */\nexport type PrinterHandlerContext<TOutput, TOptions extends object> = {\n /**\n * Recursively transform a nested `SchemaNode` to `TOutput` using the node-level handlers.\n * Use `this.transform` inside `nodes` handlers and inside the `print` override.\n */\n transform: (node: SchemaNode) => TOutput | null | undefined\n /**\n * Options for this printer instance.\n */\n options: TOptions\n}\n\n/**\n * Handler for one schema node type.\n *\n * Use a regular function (not an arrow function) if you need `this`.\n *\n * @example\n * ```ts\n * const handler: PrinterHandler<string, {}, 'string'> = function () {\n * return 'string'\n * }\n * ```\n */\nexport type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = SchemaType> = (\n this: PrinterHandlerContext<TOutput, TOptions>,\n node: SchemaNodeByType[T],\n) => TOutput | null | undefined\n\n/**\n * Generic shape used by `definePrinter`.\n *\n * - `TName` — unique string identifier (e.g. `'zod'`, `'ts'`)\n * - `TOptions` — options passed to and stored on the printer instance\n * - `TOutput` — the type emitted by node handlers\n * - `TPrintOutput` — type returned by public `print` (defaults to `TOutput`)\n *\n * @example\n * ```ts\n * type MyPrinter = PrinterFactoryOptions<'my', { strict: boolean }, string>\n * ```\n */\nexport type PrinterFactoryOptions<TName extends string = string, TOptions extends object = object, TOutput = unknown, TPrintOutput = TOutput> = {\n name: TName\n options: TOptions\n output: TOutput\n printOutput: TPrintOutput\n}\n\n/**\n * Printer instance returned by a printer factory.\n *\n * @example\n * ```ts\n * const printer = definePrinter((options: {}) => ({ name: 'x', options, nodes: {} }))({})\n * ```\n */\nexport type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {\n /**\n * Unique identifier supplied at creation time.\n */\n name: T['name']\n /**\n * Options for this printer instance.\n */\n options: T['options']\n /**\n * Node-level dispatcher — converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.\n * Always dispatches through the `nodes` map; never calls the `print` override.\n * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.\n */\n transform: (node: SchemaNode) => T['output'] | null | undefined\n /**\n * Public printer. If the builder provides a root-level `print`, this calls that\n * higher-level function (which may produce full declarations).\n * Otherwise, falls back to the node-level dispatcher.\n */\n print: (node: SchemaNode) => T['printOutput'] | null | undefined\n}\n\n/**\n * Builder function passed to `definePrinter`.\n *\n * It receives resolved options and returns:\n * - `name`\n * - `options`\n * - `nodes` handlers\n * - optional top-level `print` override\n *\n * @example\n * ```ts\n * const build = (options: {}) => ({ name: 'x' as const, options, nodes: {} })\n * ```\n */\ntype PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) => {\n name: T['name']\n /**\n * Options to store on the printer.\n */\n options: T['options']\n nodes: Partial<{\n [K in SchemaType]: PrinterHandler<T['output'], T['options'], K>\n }>\n /**\n * Optional root-level print override. When provided, becomes the public `printer.print`.\n * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),\n * not the override itself — so recursion is safe.\n */\n print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null\n}\n\n/**\n * Creates a schema printer factory.\n *\n * This function wraps a builder and makes options optional at call sites.\n *\n * The builder receives resolved options and returns:\n * - `name` — a unique identifier for the printer\n * - `options` — options stored on the returned printer instance\n * - `nodes` — a map of `SchemaType` → handler functions that convert a `SchemaNode` to `TOutput`\n * - `print` _(optional)_ — top-level override exposed as `printer.print`\n * - Inside this function, use `this.transform(node)` to dispatch to the `nodes` map\n * - This keeps recursion safe and avoids self-calls\n *\n * When no `print` override is provided, `printer.print` falls back to `printer.transform` (the node-level dispatcher).\n *\n * @example Basic usage — Zod schema printer\n * ```ts\n * type ZodPrinter = PrinterFactoryOptions<'zod', { strict?: boolean }, string>\n *\n * export const zodPrinter = definePrinter<ZodPrinter>((options) => ({\n * name: 'zod',\n * options: { strict: options.strict ?? true },\n * nodes: {\n * string: () => 'z.string()',\n * object(node) {\n * const props = node.properties.map(p => `${p.name}: ${this.transform(p.schema)}`).join(', ')\n * return `z.object({ ${props} })`\n * },\n * },\n * }))\n * ```\n */\nexport function definePrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T> {\n return createPrinterFactory<SchemaNode, SchemaType, SchemaNodeByType>((node) => node.type)(build) as (options?: T['options']) => Printer<T>\n}\n\n/**\n * Generic printer-factory function used by `definePrinter` and `defineFunctionPrinter`.\n **\n * @example\n * ```ts\n * export const defineFunctionPrinter = createPrinterFactory<FunctionNode, FunctionNodeType, FunctionNodeByType>(\n * (node) => kindToHandlerKey[node.kind],\n * )\n * ```\n */\nexport function createPrinterFactory<TNode, TKey extends string, TNodeByKey extends Partial<Record<TKey, TNode>>>(getKey: (node: TNode) => TKey | undefined) {\n return function <T extends PrinterFactoryOptions>(\n build: (options: T['options']) => {\n name: T['name']\n options: T['options']\n nodes: Partial<{\n [K in TKey]: (\n this: { transform: (node: TNode) => T['output'] | null | undefined; options: T['options'] },\n node: TNodeByKey[K],\n ) => T['output'] | null | undefined\n }>\n print?: (this: { transform: (node: TNode) => T['output'] | null | undefined; options: T['options'] }, node: TNode) => T['printOutput'] | null | undefined\n },\n ): (options?: T['options']) => {\n name: T['name']\n options: T['options']\n transform: (node: TNode) => T['output'] | null | undefined\n print: (node: TNode) => T['printOutput'] | null | undefined\n } {\n return (options) => {\n const { name, options: resolvedOptions, nodes, print: printOverride } = build(options ?? ({} as T['options']))\n\n const context = {\n options: resolvedOptions,\n transform: (node: TNode): T['output'] | null | undefined => {\n const key = getKey(node)\n if (key === undefined) return null\n\n const handler = nodes[key]\n\n if (!handler) return null\n\n return (handler as (this: typeof context, node: TNode) => T['output'] | null | undefined).call(context, node)\n },\n }\n\n return {\n name,\n options: resolvedOptions,\n transform: context.transform,\n print: (printOverride ? printOverride.bind(context) : context.transform) as (node: TNode) => T['printOutput'] | null | undefined,\n }\n }\n }\n}\n","import type { RootNode } from './nodes/root.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Lookup map from schema name to `SchemaNode`.\n */\nexport type RefMap = Map<string, SchemaNode>\n\n/**\n * Returns the last path segment of a reference string.\n *\n * Example: `#/components/schemas/Pet` becomes `Pet`.\n *\n * @example\n * ```ts\n * extractRefName('#/components/schemas/Pet') // 'Pet'\n * ```\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Builds a `RefMap` from `root.schemas` using each schema's `name`.\n *\n * Unnamed schemas are skipped.\n *\n * @example\n * ```ts\n * const refMap = buildRefMap(root)\n * const pet = refMap.get('Pet')\n * ```\n */\nexport function buildRefMap(root: RootNode): RefMap {\n const map: RefMap = new Map()\n\n for (const schema of root.schemas) {\n if (schema.name) {\n map.set(schema.name, schema)\n }\n }\n return map\n}\n\n/**\n * Resolves a schema by name from a `RefMap`.\n *\n * @example\n * ```ts\n * const petSchema = resolveRef(refMap, 'Pet')\n * ```\n */\nexport function resolveRef(refMap: RefMap, ref: string): SchemaNode | undefined {\n return refMap.get(ref)\n}\n\n/**\n * Converts a `RefMap` into a plain object.\n *\n * @example\n * ```ts\n * const refsObject = refMapToObject(refMap)\n * ```\n */\nexport function refMapToObject(refMap: RefMap): Record<string, SchemaNode> {\n return Object.fromEntries(refMap)\n}\n","type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Prefixes `word` with `_` when it is a reserved JavaScript/Java identifier or starts with a digit.\n *\n * @example\n * ```ts\n * transformReservedWord('class') // '_class'\n * transformReservedWord('42foo') // '_42foo'\n * transformReservedWord('status') // 'status'\n * ```\n */\nexport function transformReservedWord(word: string): string {\n const firstChar = word.charCodeAt(0)\n if (word && (reservedWords.has(word as 'valueOf') || (firstChar >= 48 && firstChar <= 57))) {\n return `_${word}`\n }\n return word\n}\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n try {\n new Function(`var ${name}`)\n } catch {\n return false\n }\n return true\n}\n","import type { VisitorDepth } from './constants.ts'\nimport { visitorDepths, WALK_CONCURRENCY } from './constants.ts'\nimport { createParameter, createProperty } from './factory.ts'\nimport type { Node, OperationNode, ParameterNode, PropertyNode, ResponseNode, RootNode, SchemaNode } from './nodes/index.ts'\n\n/**\n * Creates a small async concurrency limiter.\n *\n * At most `concurrency` tasks are in flight at once. Extra tasks are queued.\n *\n * @example\n * ```ts\n * const limit = createLimit(2)\n * for (const task of [taskA, taskB, taskC]) {\n * await limit(() => task())\n * }\n * // only 2 tasks run at the same time\n * ```\n */\nfunction createLimit(concurrency: number) {\n let active = 0\n const queue: Array<() => void> = []\n\n function next() {\n if (active < concurrency && queue.length > 0) {\n active++\n queue.shift()!()\n }\n }\n\n return function limit<T>(fn: () => Promise<T> | T): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n queue.push(() => {\n Promise.resolve(fn())\n .then(resolve, reject)\n .finally(() => {\n active--\n next()\n })\n })\n next()\n })\n }\n}\n\ntype LimitFn = ReturnType<typeof createLimit>\n\n/**\n * Ordered mapping of `[NodeType, ParentType]` pairs.\n *\n * `ParentOf` uses this map to find parent types.\n */\ntype ParentNodeMap = [\n [RootNode, undefined],\n [OperationNode, RootNode],\n [SchemaNode, RootNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode],\n [PropertyNode, SchemaNode],\n [ParameterNode, OperationNode],\n [ResponseNode, OperationNode],\n]\n\n/**\n * Resolves the parent node type for a given AST node type.\n *\n * This is used by visitor context so `ctx.parent` is correctly typed\n * for each callback.\n *\n * @example\n * ```ts\n * type RootParent = ParentOf<RootNode>\n * // undefined\n * ```\n *\n * @example\n * ```ts\n * type PropertyParent = ParentOf<PropertyNode>\n * // SchemaNode\n * ```\n *\n * @example\n * ```ts\n * type SchemaParent = ParentOf<SchemaNode>\n * // RootNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode\n * ```\n */\nexport type ParentOf<T extends Node, TEntries extends ReadonlyArray<[Node, unknown]> = ParentNodeMap> = TEntries extends [\n infer TEntry extends [Node, unknown],\n ...infer TRest extends ReadonlyArray<[Node, unknown]>,\n]\n ? T extends TEntry[0]\n ? TEntry[1]\n : ParentOf<T, TRest>\n : Node\n\n/**\n * Traversal context passed as the second argument to every visitor callback.\n * `parent` is typed from the current node type.\n *\n * @example\n * ```ts\n * const visitor: Visitor = {\n * schema(node, { parent }) {\n * // parent type is narrowed by node kind\n * },\n * }\n * ```\n */\nexport type VisitorContext<T extends Node = Node> = {\n /**\n * Parent node of the currently visited node.\n * For `RootNode`, this is `undefined`.\n */\n parent?: ParentOf<T>\n}\n\n/**\n * Synchronous visitor used by `transform`.\n *\n * @example\n * ```ts\n * const visitor: Visitor = {\n * operation(node) {\n * return { ...node, operationId: `x_${node.operationId}` }\n * },\n * }\n * ```\n */\nexport type Visitor = {\n root?(node: RootNode, context: VisitorContext<RootNode>): void | RootNode\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): void | OperationNode\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): void | SchemaNode\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): void | PropertyNode\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): void | ParameterNode\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): void | ResponseNode\n}\n\n/**\n * Utility type for values that can be returned directly or asynchronously.\n */\ntype MaybePromise<T> = T | Promise<T>\n\n/**\n * Async visitor for `walk`. Synchronous `Visitor` objects are compatible.\n *\n * @example\n * ```ts\n * const visitor: AsyncVisitor = {\n * async operation(node) {\n * await Promise.resolve(node.operationId)\n * },\n * }\n * ```\n */\nexport type AsyncVisitor = {\n root?(node: RootNode, context: VisitorContext<RootNode>): MaybePromise<void | RootNode>\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<void | OperationNode>\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<void | SchemaNode>\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<void | PropertyNode>\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<void | ParameterNode>\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<void | ResponseNode>\n}\n\n/**\n * Visitor used by `collect`.\n *\n * @example\n * ```ts\n * const visitor: CollectVisitor<string> = {\n * operation(node) {\n * return node.operationId\n * },\n * }\n * ```\n */\nexport type CollectVisitor<T> = {\n root?(node: RootNode, context: VisitorContext<RootNode>): T | undefined\n operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | undefined\n schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | undefined\n property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | undefined\n parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | undefined\n response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | undefined\n}\n\n/**\n * Options for `transform`.\n *\n * @example\n * ```ts\n * const options: TransformOptions = { depth: 'deep', schema: (node) => node }\n * ```\n *\n * @example\n * ```ts\n * // Only transform the current node, not nested children\n * const options: TransformOptions = { depth: 'shallow', schema: (node) => node }\n * ```\n */\nexport type TransformOptions = Visitor & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Internal parent override used during recursion.\n */\n parent?: Node\n}\n\n/**\n * Options for `walk`.\n *\n * @example\n * ```ts\n * const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }\n * ```\n */\nexport type WalkOptions = AsyncVisitor & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Maximum number of sibling nodes visited concurrently.\n * @default 30\n */\n concurrency?: number\n}\n\n/**\n * Options for `collect`.\n *\n * @example\n * ```ts\n * const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }\n * ```\n */\nexport type CollectOptions<T> = CollectVisitor<T> & {\n /**\n * Traversal depth (`'deep'` by default).\n * @default 'deep'\n */\n depth?: VisitorDepth\n /**\n * Internal parent override used during recursion.\n */\n parent?: Node\n}\n\n/**\n * Returns the immediate traversable children of `node`.\n *\n * For `Schema` nodes, children (`properties`, `items`, `members`, and non-boolean\n * `additionalProperties`) are only included\n * when `recurse` is `true`; shallow mode skips them.\n *\n * @example\n * ```ts\n * const children = getChildren(operationNode, true)\n * // returns parameters, requestBody schema (if present), and responses\n * ```\n */\nfunction getChildren(node: Node, recurse: boolean): Array<Node> {\n switch (node.kind) {\n case 'Root':\n return [...node.schemas, ...node.operations]\n case 'Operation':\n return [...node.parameters, ...(node.requestBody?.schema ? [node.requestBody.schema] : []), ...node.responses]\n case 'Schema': {\n const children: Array<Node> = []\n\n if (!recurse) return []\n\n if ('properties' in node && node.properties.length > 0) children.push(...node.properties)\n if ('items' in node && node.items) children.push(...node.items)\n if ('members' in node && node.members) children.push(...node.members)\n if ('additionalProperties' in node && node.additionalProperties && node.additionalProperties !== true) children.push(node.additionalProperties)\n\n return children\n }\n case 'Property':\n return [node.schema]\n case 'Parameter':\n return [node.schema]\n case 'Response':\n return node.schema ? [node.schema] : []\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n case 'Type':\n return []\n }\n}\n\n/**\n * Depth-first traversal for side effects. Visitor return values are ignored.\n * Sibling nodes at each level are visited concurrently up to `options.concurrency`\n * (default: `WALK_CONCURRENCY`).\n *\n * @example\n * ```ts\n * await walk(root, {\n * operation(node) {\n * console.log(node.operationId)\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Visit only the current node\n * await walk(root, { depth: 'shallow', root: () => {} })\n * ```\n */\nexport async function walk(node: Node, options: WalkOptions): Promise<void> {\n const recurse = (options.depth ?? visitorDepths.deep) === visitorDepths.deep\n const limit = createLimit(options.concurrency ?? WALK_CONCURRENCY)\n\n return _walk(node, options, recurse, limit, undefined)\n}\n\nasync function _walk(node: Node, visitor: AsyncVisitor, recurse: boolean, limit: LimitFn, parent: Node | undefined): Promise<void> {\n switch (node.kind) {\n case 'Root':\n await limit(() => visitor.root?.(node, { parent: parent as ParentOf<RootNode> }))\n break\n case 'Operation':\n await limit(() => visitor.operation?.(node, { parent: parent as ParentOf<OperationNode> }))\n break\n case 'Schema':\n await limit(() => visitor.schema?.(node, { parent: parent as ParentOf<SchemaNode> }))\n break\n case 'Property':\n await limit(() => visitor.property?.(node, { parent: parent as ParentOf<PropertyNode> }))\n break\n case 'Parameter':\n await limit(() => visitor.parameter?.(node, { parent: parent as ParentOf<ParameterNode> }))\n break\n case 'Response':\n await limit(() => visitor.response?.(node, { parent: parent as ParentOf<ResponseNode> }))\n break\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n break\n }\n\n const children = getChildren(node, recurse)\n for (const child of children) {\n await _walk(child, visitor, recurse, limit, node)\n }\n}\n\n/**\n * Runs a depth-first immutable transform.\n *\n * If a visitor returns a node, it replaces the current node.\n * If it returns `undefined`, the current node stays the same.\n *\n * @example\n * ```ts\n * const next = transform(root, {\n * operation(node) {\n * return { ...node, operationId: `prefixed_${node.operationId}` }\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Shallow mode: only transform the input node\n * const next = transform(root, { depth: 'shallow', root: (node) => node })\n * ```\n */\nexport function transform(node: RootNode, options: TransformOptions): RootNode\nexport function transform(node: OperationNode, options: TransformOptions): OperationNode\nexport function transform(node: SchemaNode, options: TransformOptions): SchemaNode\nexport function transform(node: PropertyNode, options: TransformOptions): PropertyNode\nexport function transform(node: ParameterNode, options: TransformOptions): ParameterNode\nexport function transform(node: ResponseNode, options: TransformOptions): ResponseNode\nexport function transform(node: Node, options: TransformOptions): Node\nexport function transform(node: Node, options: TransformOptions): Node {\n const { depth, parent, ...visitor } = options\n const recurse = (depth ?? visitorDepths.deep) === visitorDepths.deep\n\n switch (node.kind) {\n case 'Root': {\n let root = node\n const replaced = visitor.root?.(root, { parent: parent as ParentOf<RootNode> })\n if (replaced) root = replaced\n\n return {\n ...root,\n schemas: root.schemas.map((s) => transform(s, { ...options, parent: root })),\n operations: root.operations.map((op) => transform(op, { ...options, parent: root })),\n }\n }\n case 'Operation': {\n let op = node\n const replaced = visitor.operation?.(op, { parent: parent as ParentOf<OperationNode> })\n if (replaced) op = replaced\n\n return {\n ...op,\n parameters: op.parameters.map((p) => transform(p, { ...options, parent: op })),\n requestBody: op.requestBody\n ? { ...op.requestBody, schema: op.requestBody.schema ? transform(op.requestBody.schema, { ...options, parent: op }) : undefined }\n : undefined,\n responses: op.responses.map((r) => transform(r, { ...options, parent: op })),\n }\n }\n case 'Schema': {\n let schema = node\n const replaced = visitor.schema?.(schema, { parent: parent as ParentOf<SchemaNode> })\n if (replaced) schema = replaced\n\n const childOptions = { ...options, parent: schema }\n\n return {\n ...schema,\n ...('properties' in schema && recurse ? { properties: schema.properties.map((p) => transform(p, childOptions)) } : {}),\n ...('items' in schema && recurse ? { items: schema.items?.map((i) => transform(i, childOptions)) } : {}),\n ...('members' in schema && recurse ? { members: schema.members?.map((m) => transform(m, childOptions)) } : {}),\n ...('additionalProperties' in schema && recurse && schema.additionalProperties && schema.additionalProperties !== true\n ? { additionalProperties: transform(schema.additionalProperties, childOptions) }\n : {}),\n } as SchemaNode\n }\n case 'Property': {\n let prop = node\n const replaced = visitor.property?.(prop, { parent: parent as ParentOf<PropertyNode> })\n if (replaced) prop = replaced\n\n return createProperty({\n ...prop,\n schema: transform(prop.schema, { ...options, parent: prop }),\n })\n }\n case 'Parameter': {\n let param = node\n const replaced = visitor.parameter?.(param, { parent: parent as ParentOf<ParameterNode> })\n if (replaced) param = replaced\n\n return createParameter({\n ...param,\n schema: transform(param.schema, { ...options, parent: param }),\n })\n }\n case 'Response': {\n let response = node\n const replaced = visitor.response?.(response, { parent: parent as ParentOf<ResponseNode> })\n if (replaced) response = replaced\n\n return {\n ...response,\n schema: transform(response.schema, { ...options, parent: response }),\n }\n }\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n case 'Type':\n return node\n }\n}\n\n/**\n * Composes multiple visitors into one visitor, applied left to right.\n *\n * For each node kind, output from one visitor is input to the next.\n * If a visitor returns `undefined`, the previous node value is kept.\n *\n * @example\n * ```ts\n * const visitor = composeTransformers(\n * { operation: (node) => ({ ...node, operationId: `a_${node.operationId}` }) },\n * { operation: (node) => ({ ...node, operationId: `b_${node.operationId}` }) },\n * )\n * ```\n */\nexport function composeTransformers(...visitors: Array<Visitor>): Visitor {\n return {\n root(node, context) {\n return visitors.reduce<RootNode>((acc, v) => v.root?.(acc, context) ?? acc, node)\n },\n operation(node, context) {\n return visitors.reduce<OperationNode>((acc, v) => v.operation?.(acc, context) ?? acc, node)\n },\n schema(node, context) {\n return visitors.reduce<SchemaNode>((acc, v) => v.schema?.(acc, context) ?? acc, node)\n },\n property(node, context) {\n return visitors.reduce<PropertyNode>((acc, v) => v.property?.(acc, context) ?? acc, node)\n },\n parameter(node, context) {\n return visitors.reduce<ParameterNode>((acc, v) => v.parameter?.(acc, context) ?? acc, node)\n },\n response(node, context) {\n return visitors.reduce<ResponseNode>((acc, v) => v.response?.(acc, context) ?? acc, node)\n },\n }\n}\n\n/**\n * Runs a depth-first synchronous collection pass.\n *\n * Non-`undefined` values returned by visitor callbacks are appended to the result.\n *\n * @example\n * ```ts\n * const ids = collect(root, {\n * operation(node) {\n * return node.operationId\n * },\n * })\n * ```\n *\n * @example\n * ```ts\n * // Collect from only the current node\n * const values = collect(root, { depth: 'shallow', root: () => 'root' })\n * ```\n */\nexport function collect<T>(node: Node, options: CollectOptions<T>): Array<T> {\n const { depth, parent, ...visitor } = options\n const recurse = (depth ?? visitorDepths.deep) === visitorDepths.deep\n const results: Array<T> = []\n\n let v: T | undefined\n switch (node.kind) {\n case 'Root':\n v = visitor.root?.(node, { parent: parent as ParentOf<RootNode> })\n break\n case 'Operation':\n v = visitor.operation?.(node, { parent: parent as ParentOf<OperationNode> })\n break\n case 'Schema':\n v = visitor.schema?.(node, { parent: parent as ParentOf<SchemaNode> })\n break\n case 'Property':\n v = visitor.property?.(node, { parent: parent as ParentOf<PropertyNode> })\n break\n case 'Parameter':\n v = visitor.parameter?.(node, { parent: parent as ParentOf<ParameterNode> })\n break\n case 'Response':\n v = visitor.response?.(node, { parent: parent as ParentOf<ResponseNode> })\n break\n case 'FunctionParameter':\n case 'ParameterGroup':\n case 'FunctionParameters':\n break\n }\n if (v !== undefined) results.push(v)\n\n for (const child of getChildren(node, recurse)) {\n for (const item of collect(child, { ...options, parent: node })) {\n results.push(item)\n }\n }\n\n return results\n}\n","import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from './guards.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\nimport { extractRefName } from './refs.ts'\nimport { collect } from './visitor.ts'\n\nexport function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string | null {\n if (!mapping || !ref) return null\n return Object.entries(mapping).find(([, value]) => value === ref)?.[0] ?? null\n}\n\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Collects import entries for all `ref` schema nodes in `node`.\n */\nexport function collectImports<TImport>({\n node,\n nameMapping,\n resolve,\n}: {\n node: SchemaNode\n nameMapping: Map<string, string>\n resolve: (schemaName: string) => TImport | undefined\n}): Array<TImport> {\n return collect<TImport>(node, {\n schema(schemaNode): TImport | undefined {\n const schemaRef = narrowSchema(schemaNode, 'ref')\n if (!schemaRef?.ref) return\n\n const rawName = extractRefName(schemaRef.ref)\n const schemaName = nameMapping.get(rawName) ?? rawName\n const result = resolve(schemaName)\n if (!result) return\n\n return result\n },\n })\n}\n","import { isScalarPrimitive } from './constants.ts'\nimport { createProperty, createSchema } from './factory.ts'\nimport { narrowSchema } from './guards.ts'\nimport type { SchemaNode } from './nodes/schema.ts'\nimport { enumPropName } from './resolvers.ts'\n\n/**\n * Replaces a discriminator property's schema with a string enum of allowed values.\n *\n * If `node` is not an object schema, or if the property does not exist, the input\n * node is returned as-is.\n *\n * @example\n * ```ts\n * const schema = createSchema({\n * type: 'object',\n * properties: [createProperty({ name: 'type', required: true, schema: createSchema({ type: 'string' }) })],\n * })\n * const result = setDiscriminatorEnum({ node: schema, propertyName: 'type', values: ['dog', 'cat'] })\n * ```\n */\nexport function setDiscriminatorEnum({\n node,\n propertyName,\n values,\n enumName,\n}: {\n node: SchemaNode\n propertyName: string\n values: Array<string>\n enumName?: string\n}): SchemaNode {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) {\n return node\n }\n\n const hasProperty = objectNode.properties.some((prop) => prop.name === propertyName)\n if (!hasProperty) {\n return node\n }\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) {\n return prop\n }\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n}\n\n/**\n * Merges adjacent anonymous object members into a single anonymous object member.\n *\n * @example\n * ```ts\n * const merged = mergeAdjacentObjects([\n * createSchema({ type: 'object', properties: [createProperty({ name: 'a', schema: createSchema({ type: 'string' }) })] }),\n * createSchema({ type: 'object', properties: [createProperty({ name: 'b', schema: createSchema({ type: 'number' }) })] }),\n * ])\n * ```\n */\nexport function mergeAdjacentObjects(members: Array<SchemaNode>): Array<SchemaNode> {\n return members.reduce<Array<SchemaNode>>((acc, member) => {\n const objectMember = narrowSchema(member, 'object')\n if (objectMember && !objectMember.name) {\n const previous = acc.at(-1)\n const previousObject = previous ? narrowSchema(previous, 'object') : undefined\n\n if (previousObject && !previousObject.name) {\n acc[acc.length - 1] = createSchema({\n ...previousObject,\n properties: [...(previousObject.properties ?? []), ...(objectMember.properties ?? [])],\n })\n return acc\n }\n }\n\n acc.push(member)\n return acc\n }, [])\n}\n\n/**\n * Removes enum members that are covered by broader scalar primitives in the same union.\n *\n * @example\n * ```ts\n * const simplified = simplifyUnion([\n * createSchema({ type: 'enum', primitive: 'string', enumValues: ['active'] }),\n * createSchema({ type: 'string' }),\n * ])\n * // keeps only string member\n * ```\n */\nexport function simplifyUnion(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n\n if (!scalarPrimitives.size) {\n return members\n }\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) {\n return true\n }\n\n const primitive = enumNode.primitive\n if (!primitive) {\n return true\n }\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) {\n return true\n }\n\n if (scalarPrimitives.has(primitive)) {\n return false\n }\n\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) {\n return false\n }\n\n return true\n })\n}\n\nexport function setEnumName(propNode: SchemaNode, parentName: string | null | undefined, propName: string, enumSuffix: string): SchemaNode {\n const enumNode = narrowSchema(propNode, 'enum')\n\n if (enumNode?.primitive === 'boolean') {\n return { ...propNode, name: undefined }\n }\n\n if (enumNode) {\n return { ...propNode, name: enumPropName(parentName, propName, enumSuffix) }\n }\n\n return propNode\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\n\nimport { createFunctionParameter, createFunctionParameters, createParameterGroup, createProperty, createSchema, createTypeNode } from './factory.ts'\nimport { narrowSchema } from './guards.ts'\nimport type { FunctionParameterNode, FunctionParametersNode, OperationNode, ParameterGroupNode, ParameterNode, SchemaNode, TypeNode } from './nodes/index.ts'\nimport type { SchemaType } from './nodes/schema.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns a merged schema view for a ref node, combining the resolved `node.schema`\n * (base from the referenced definition) with any usage-site sibling fields set directly\n * on the ref node (description, readOnly, nullable, deprecated, etc.).\n *\n * Usage-site fields take precedence over the resolved schema's own fields when both are defined.\n *\n * For non-ref nodes the node itself is returned unchanged.\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Returns `true` when a schema is emitted as a plain `string` type.\n *\n * - `string`, `uuid`, `email`, `url`, `datetime` are always plain strings.\n * - `date` and `time` are plain strings when their `representation` is `'string'` rather than `'date'`.\n *\n * @example\n * ```ts\n * isStringType(createSchema({ type: 'uuid' })) // true\n * isStringType(createSchema({ type: 'date', representation: 'date' })) // false\n * ```\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Applies casing rules to parameter names and returns a new parameter array.\n *\n * The input array is not mutated.\n * If `casing` is not set, the original array is returned unchanged.\n *\n * Use this before passing parameters to schema builders so that property keys\n * in generated output match the desired casing while preserving\n * `OperationNode.parameters` for other consumers.\n *\n * @example\n * ```ts\n * const params = [createParameter({ name: 'pet_id', in: 'query', schema: createSchema({ type: 'string' }) })]\n * const cased = caseParams(params, 'camelcase')\n * // cased[0].name === 'petId'\n * ```\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) {\n return params\n }\n\n return params.map((param) => {\n const transformed = casing === 'camelcase' || !isValidVarName(param.name) ? camelCase(param.name) : param.name\n\n return { ...param, name: transformed }\n })\n}\n\n/**\n * Creates a single-property object schema used as a discriminator literal.\n *\n * @example\n * ```ts\n * createDiscriminantNode({ propertyName: 'type', value: 'dog' })\n * // -> { type: 'object', properties: [{ name: 'type', required: true, schema: enum('dog') }] }\n * ```\n */\nexport function createDiscriminantNode({ propertyName, value }: { propertyName: string; value: string }): SchemaNode {\n return createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n createProperty({\n name: propertyName,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: [value],\n }),\n required: true,\n }),\n ],\n })\n}\n\n/**\n * Named type for a group of parameters (query or header) emitted as a single typed parameter.\n */\nexport type ParamGroupType = {\n /**\n * TypeNode for the group type.\n */\n type: TypeNode\n /**\n * Whether the parameter group is optional.\n */\n optional: boolean\n}\n\n/**\n * Resolver interface for {@link createOperationParams}.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: OperationNode, param: ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\n resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string\n}\n\n/**\n * Options for {@link createOperationParams}.\n */\nexport type CreateOperationParamsOptions = {\n /**\n * How all operation parameters are grouped in the function signature.\n * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`\n * - `'inline'` emits each param category as a separate top-level parameter\n */\n paramsType: 'object' | 'inline'\n /**\n * How path parameters are emitted when `paramsType` is `'inline'`.\n * - `'object'` groups them as `{ petId, storeId }: PathParams`\n * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`\n * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`\n */\n pathParamsType: 'object' | 'inline' | 'inlineSpread'\n /**\n * Converts parameter names to camelCase before output.\n */\n paramsCasing?: 'camelcase'\n /**\n * Resolver for parameter and request body type names.\n * Pass `ResolverTs` from `@kubb/plugin-ts` directly.\n * When omitted, falls back to the schema primitive or `'unknown'`.\n */\n resolver?: OperationParamsResolver\n /**\n * Default value for the path parameters binding when `pathParamsType` is `'object'`.\n * Falls back to `'{}'` when all path params are optional.\n */\n pathParamsDefault?: string\n /**\n * Extra parameters appended after the standard operation parameters.\n *\n * @example Plugin-specific trailing parameter\n * ```ts\n * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]\n * ```\n */\n extraParams?: Array<FunctionParameterNode | ParameterGroupNode>\n /**\n * Override the default parameter names used for body, query, header, and rest-path groups.\n *\n * Useful when targeting languages or frameworks with different naming conventions.\n *\n * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }\n */\n paramNames?: {\n /**\n * Name for the request body parameter.\n * @default 'data'\n */\n data?: string\n /**\n * Name for the query parameters group parameter.\n * @default 'params'\n */\n params?: string\n /**\n * Name for the header parameters group parameter.\n * @default 'headers'\n */\n headers?: string\n /**\n * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.\n * @default 'pathParams'\n */\n path?: string\n }\n /**\n * Applies a uniform transformation to every resolved type name before it is used\n * in a parameter node. Use this for framework-level type wrappers.\n *\n * @example Vue Query — wrap every parameter type with `MaybeRefOrGetter`\n * `typeWrapper: (t) => \\`MaybeRefOrGetter<${t}>\\``\n */\n typeWrapper?: (type: string) => string\n}\n\nfunction resolveType({ node, param, resolver }: { node: OperationNode; param: ParameterNode; resolver: OperationParamsResolver | undefined }): TypeNode {\n if (!resolver) {\n return createTypeNode({ variant: 'reference', name: param.schema.primitive ?? 'unknown' })\n }\n\n const individualName = resolver.resolveParamName(node, param)\n\n const groupLocation = param.in === 'path' || param.in === 'query' || param.in === 'header' ? param.in : undefined\n\n const groupResolvers = {\n path: resolver.resolvePathParamsName,\n query: resolver.resolveQueryParamsName,\n header: resolver.resolveHeaderParamsName,\n } as const\n\n const groupName = groupLocation ? groupResolvers[groupLocation].call(resolver, node, param) : undefined\n\n if (groupName && groupName !== individualName) {\n return createTypeNode({ variant: 'member', base: groupName, key: param.name })\n }\n\n return createTypeNode({ variant: 'reference', name: individualName })\n}\n\n/**\n * Converts an {@link OperationNode} into a {@link FunctionParametersNode}.\n *\n * Centralizes the per-plugin `getParams()` pattern. Provide a `resolver` for\n * type resolution and `extraParams` for plugin-specific trailing parameters.\n *\n * @example\n * ```ts\n * const params = createOperationParams(node, {\n * paramsType: 'inline',\n * pathParamsType: 'inline',\n * resolver: tsResolver,\n * extraParams: [createFunctionParameter({ name: 'options', type: createTypeNode({ variant: 'reference', name: 'Partial<RequestOptions>' }), default: '{}' })],\n * })\n * ```\n */\nexport function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode {\n const { paramsType, pathParamsType, paramsCasing, resolver, pathParamsDefault, extraParams = [], paramNames, typeWrapper } = options\n\n const dataName = paramNames?.data ?? 'data'\n const paramsName = paramNames?.params ?? 'params'\n const headersName = paramNames?.headers ?? 'headers'\n const pathName = paramNames?.path ?? 'pathParams'\n\n const wrapType = (type: string): TypeNode => createTypeNode({ variant: 'reference', name: typeWrapper ? typeWrapper(type) : type })\n // Only reference TypeNodes are wrapped (they hold a plain type name string).\n // Member and struct TypeNodes are pre-resolved structured expressions and are passed through unchanged.\n const wrapTypeNode = (type: TypeNode): TypeNode => (type.variant === 'reference' ? wrapType(type.name) : type)\n\n const casedParams = caseParams(node.parameters, paramsCasing)\n const pathParams = casedParams.filter((p) => p.in === 'path')\n const queryParams = casedParams.filter((p) => p.in === 'query')\n const headerParams = casedParams.filter((p) => p.in === 'header')\n\n const bodyType = node.requestBody?.schema ? wrapType(resolver?.resolveDataName(node) ?? 'unknown') : undefined\n const bodyRequired = node.requestBody?.required ?? false\n\n const queryGroupType = resolver ? resolveGroupType({ node, params: queryParams, groupMethod: resolver.resolveQueryParamsName, resolver }) : undefined\n const headerGroupType = resolver ? resolveGroupType({ node, params: headerParams, groupMethod: resolver.resolveHeaderParamsName, resolver }) : undefined\n\n const params: Array<FunctionParameterNode | ParameterGroupNode> = []\n\n if (paramsType === 'object') {\n const children: Array<FunctionParameterNode> = [\n ...pathParams.map((p) => {\n const type = resolveType({ node, param: p, resolver })\n return createFunctionParameter({ name: p.name, type: wrapTypeNode(type), optional: !p.required })\n }),\n ...(bodyType ? [createFunctionParameter({ name: dataName, type: bodyType, optional: !bodyRequired })] : []),\n ...buildGroupParam({ name: paramsName, node, params: queryParams, groupType: queryGroupType, resolver, wrapType }),\n ...buildGroupParam({ name: headersName, node, params: headerParams, groupType: headerGroupType, resolver, wrapType }),\n ]\n\n if (children.length) {\n params.push(createParameterGroup({ properties: children, default: children.every((c) => c.optional) ? '{}' : undefined }))\n }\n } else {\n if (pathParams.length) {\n if (pathParamsType === 'inlineSpread') {\n const spreadType = resolver?.resolvePathParamsName(node, pathParams[0]!) ?? undefined\n params.push(createFunctionParameter({ name: pathName, type: spreadType ? wrapType(spreadType) : undefined, rest: true }))\n } else {\n const pathChildren = pathParams.map((p) => {\n const type = resolveType({ node, param: p, resolver })\n return createFunctionParameter({ name: p.name, type: wrapTypeNode(type), optional: !p.required })\n })\n params.push(\n createParameterGroup({\n properties: pathChildren,\n inline: pathParamsType === 'inline',\n default: pathParamsDefault ?? (pathChildren.every((c) => c.optional) ? '{}' : undefined),\n }),\n )\n }\n }\n\n if (bodyType) {\n params.push(createFunctionParameter({ name: dataName, type: bodyType, optional: !bodyRequired }))\n }\n\n params.push(...buildGroupParam({ name: paramsName, node, params: queryParams, groupType: queryGroupType, resolver, wrapType }))\n params.push(...buildGroupParam({ name: headersName, node, params: headerParams, groupType: headerGroupType, resolver, wrapType }))\n }\n\n params.push(...extraParams)\n\n return createFunctionParameters({ params })\n}\n\n/**\n * Builds a single {@link FunctionParameterNode} for a query or header group.\n * Returns an empty array when there are no params to emit.\n *\n * If a pre-resolved `groupType` is provided it emits `name: GroupType`.\n * Otherwise, it builds an inline struct from the individual params.\n */\nfunction buildGroupParam({\n name,\n node,\n params,\n groupType,\n resolver,\n wrapType,\n}: {\n name: string\n node: OperationNode\n params: Array<ParameterNode>\n groupType: ParamGroupType | undefined\n resolver: OperationParamsResolver | undefined\n wrapType: (type: string) => TypeNode\n}): Array<FunctionParameterNode> {\n if (groupType) {\n const type = groupType.type.variant === 'reference' ? wrapType(groupType.type.name) : groupType.type\n return [createFunctionParameter({ name, type, optional: groupType.optional })]\n }\n if (params.length) {\n return [\n createFunctionParameter({\n name,\n type: toStructType({ node, params, resolver }),\n optional: params.every((p) => !p.required),\n }),\n ]\n }\n return []\n}\n\n/**\n * Derives a {@link ParamGroupType} from the resolver's group method.\n * Returns `undefined` when the group name equals the individual param name (no real group).\n */\nfunction resolveGroupType({\n node,\n params,\n groupMethod,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n groupMethod: (_node: OperationNode, _param: ParameterNode) => string\n resolver: OperationParamsResolver\n}): ParamGroupType | undefined {\n if (!params.length) {\n return undefined\n }\n const firstParam = params[0]!\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return undefined\n }\n const allOptional = params.every((p) => !p.required)\n return { type: createTypeNode({ variant: 'reference', name: groupName }), optional: allOptional }\n}\n\n/**\n * Builds a {@link TypeNode} with `variant: 'struct'` for an inline anonymous type grouping named fields.\n *\n * Used when query or header parameters have no dedicated group type name.\n * Each language printer renders this appropriately (TypeScript: `{ petId: string; name?: string }`).\n */\nfunction toStructType({\n node,\n params,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n resolver: OperationParamsResolver | undefined\n}): TypeNode {\n return createTypeNode({\n variant: 'struct',\n properties: params.map((p) => ({ name: p.name, optional: !p.required, type: resolveType({ node, param: p, resolver }) })),\n })\n}\n"],"mappings":";;AAWA,MAAa,gBAAgB;CAC3B,SAAS;CACT,MAAM;CACP;;;;;;;;;;;;AAyBD,MAAa,cAAc;CAIzB,QAAQ;CAIR,QAAQ;CAIR,SAAS;CAIT,QAAQ;CAIR,SAAS;CAIT,MAAM;CAIN,KAAK;CAIL,SAAS;CAIT,MAAM;CAIN,QAAQ;CAIR,OAAO;CAIP,OAAO;CAIP,OAAO;CAIP,cAAc;CAId,MAAM;CAIN,KAAK;CAIL,MAAM;CAIN,UAAU;CAIV,MAAM;CAIN,MAAM;CAIN,OAAO;CAIP,KAAK;CAIL,MAAM;CAIN,MAAM;CAIN,MAAM;CAIN,OAAO;CACR;;;;AAOD,MAAa,yBAAyB,IAAI,IAAqB;CAAC;CAAU;CAAU;CAAW;CAAU;CAAU,CAAC;;;;AAKpH,SAAgB,kBAAkB,MAAuC;AACvE,QAAO,uBAAuB,IAAI,KAAwB;;AAG5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AAM,EAAE;GAAM,UAAU,CAAC,EAAE;GAAU,MAAM,YAAY;IAAE;IAAM,OAAO;IAAG;IAAU,CAAC;GAAE,EAAE;EAC1H,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type ArraySchemaNode, type AsyncVisitor, type BaseNode, type CollectOptions, type CollectVisitor, type ComplexSchemaType, type DateSchemaNode, type DatetimeSchemaNode, type DistributiveOmit, type EnumSchemaNode, type EnumValueNode, type FunctionNode, type FunctionNodeType, type FunctionParameterNode, type FunctionParametersNode, type HttpMethod, type HttpStatusCode, type InferSchema, type InferSchemaNode, type IntersectionSchemaNode, type MediaType, type Node, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type ParameterGroupNode, type ParameterLocation, type ParameterNode, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PropertyNode, type RefMap, type RefSchemaNode, type ResponseNode, type RootMeta, type RootNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SpecialSchemaType, type StatusCode, type StringSchemaNode, type TimeSchemaNode, type TransformOptions, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type Visitor, type VisitorContext, type VisitorDepth, type WalkOptions };
|
|
1
|
+
import { $ as Ipv4SchemaNode, B as HttpStatusCode, Ct as NodeKind, F as RootMeta, G as ArraySchemaNode, H as StatusCode, I as RootNode, J as DatetimeSchemaNode, K as ComplexSchemaType, L as HttpMethod, M as InferSchemaNode, N as ParserOptions, P as Node, Q as IntersectionSchemaNode, R as OperationNode, St as BaseNode, Tt as VisitorDepth, U as ParameterLocation, V as MediaType, W as ParameterNode, X as EnumValueNode, Y as EnumSchemaNode, Z as FormatStringSchemaNode, _t as FunctionNodeType, a as TransformOptions, at as ScalarSchemaNode, bt as ParameterGroupNode, c as WalkOptions, ct as SchemaNodeByType, dt as StringSchemaNode, et as Ipv6SchemaNode, ft as TimeSchemaNode, g as PrinterFactoryOptions, gt as FunctionNode, h as Printer, ht as PropertyNode, i as ParentOf, it as RefSchemaNode, j as InferSchema, lt as SchemaType, mt as UrlSchemaNode, n as CollectOptions, nt as ObjectSchemaNode, o as Visitor, ot as ScalarSchemaType, p as RefMap, pt as UnionSchemaNode, q as DateSchemaNode, r as CollectVisitor, rt as PrimitiveSchemaType, s as VisitorContext, st as SchemaNode, t as AsyncVisitor, tt as NumberSchemaNode, ut as SpecialSchemaType, vt as FunctionParameterNode, xt as TypeNode, y as DistributiveOmit, yt as FunctionParametersNode, z as ResponseNode } from "./visitor-C2XD9px4.js";
|
|
2
|
+
export { type ArraySchemaNode, type AsyncVisitor, type BaseNode, type CollectOptions, type CollectVisitor, type ComplexSchemaType, type DateSchemaNode, type DatetimeSchemaNode, type DistributiveOmit, type EnumSchemaNode, type EnumValueNode, type FormatStringSchemaNode, type FunctionNode, type FunctionNodeType, type FunctionParameterNode, type FunctionParametersNode, type HttpMethod, type HttpStatusCode, type InferSchema, type InferSchemaNode, type IntersectionSchemaNode, type Ipv4SchemaNode, type Ipv6SchemaNode, type MediaType, type Node, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type ParameterGroupNode, type ParameterLocation, type ParameterNode, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PropertyNode, type RefMap, type RefSchemaNode, type ResponseNode, type RootMeta, type RootNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SpecialSchemaType, type StatusCode, type StringSchemaNode, type TimeSchemaNode, type TransformOptions, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type Visitor, type VisitorContext, type VisitorDepth, type WalkOptions };
|