@kubb/ast 5.29.5 → 5.30.1

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.
Files changed (55) hide show
  1. package/dist/factory.cjs +3 -3
  2. package/dist/{file-Db_PYobC.cjs → file-BcFabTOU.cjs} +4 -4
  3. package/dist/{file-Db_PYobC.cjs.map → file-BcFabTOU.cjs.map} +1 -1
  4. package/dist/{file-DVw2Htda.cjs → file-Cw25Jrxs.cjs} +4 -4
  5. package/dist/{file-DVw2Htda.cjs.map → file-Cw25Jrxs.cjs.map} +1 -1
  6. package/dist/file.cjs +2 -2
  7. package/dist/{graph-CymJtC1M.cjs → graph-CE8A4hmx.cjs} +5 -5
  8. package/dist/{graph-CymJtC1M.cjs.map → graph-CE8A4hmx.cjs.map} +1 -1
  9. package/dist/graph.cjs +1 -1
  10. package/dist/{guards-4drgx10i.cjs → guards-C6i6KL0l.cjs} +2 -2
  11. package/dist/{guards-4drgx10i.cjs.map → guards-C6i6KL0l.cjs.map} +1 -1
  12. package/dist/{http-Dv8py6wh.cjs → http-Dn8k_gED.cjs} +3 -3
  13. package/dist/http-Dn8k_gED.cjs.map +1 -0
  14. package/dist/http.cjs +2 -2
  15. package/dist/index.cjs +17 -17
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/{isRecord-CwlfDtHp.cjs → isRecord-VQAD9N9o.cjs} +2 -2
  20. package/dist/{isRecord-CwlfDtHp.cjs.map → isRecord-VQAD9N9o.cjs.map} +1 -1
  21. package/dist/{json-mEYdjumm.cjs → json-BiA7qy0-.cjs} +3 -3
  22. package/dist/{json-mEYdjumm.cjs.map → json-BiA7qy0-.cjs.map} +1 -1
  23. package/dist/json.cjs +1 -1
  24. package/dist/{macro-h3bm9G48.cjs → macro-CzvAEb1n.cjs} +3 -3
  25. package/dist/{macro-h3bm9G48.cjs.map → macro-CzvAEb1n.cjs.map} +1 -1
  26. package/dist/macro.cjs +1 -1
  27. package/dist/{mediaType-BbIfudh0.cjs → mediaType-KZ2opR9i.cjs} +2 -2
  28. package/dist/{mediaType-BbIfudh0.cjs.map → mediaType-KZ2opR9i.cjs.map} +1 -1
  29. package/dist/mediaType.cjs +1 -1
  30. package/dist/{node-Dhh4jTDv.cjs → node-B9iQCMgg.cjs} +4 -4
  31. package/dist/{node-Dhh4jTDv.cjs.map → node-B9iQCMgg.cjs.map} +1 -1
  32. package/dist/node.cjs +3 -3
  33. package/dist/{nodeText-DH4dLGUb.cjs → nodeText-DDKtSA4q.cjs} +2 -2
  34. package/dist/{nodeText-DH4dLGUb.cjs.map → nodeText-DDKtSA4q.cjs.map} +1 -1
  35. package/dist/{nodes-BjVv21pb.cjs → nodes-BJzvlvwk.cjs} +5 -5
  36. package/dist/{nodes-BjVv21pb.cjs.map → nodes-BJzvlvwk.cjs.map} +1 -1
  37. package/dist/{optionality-C-qULYxo.cjs → optionality-DZfBHn-q.cjs} +2 -2
  38. package/dist/{optionality-C-qULYxo.cjs.map → optionality-DZfBHn-q.cjs.map} +1 -1
  39. package/dist/{promise-DMQPWp6M.cjs → promise-srRwNz0i.cjs} +2 -2
  40. package/dist/{promise-DMQPWp6M.cjs.map → promise-srRwNz0i.cjs.map} +1 -1
  41. package/dist/{ref-CGeCLkAk.cjs → ref-B4s-S3RK.cjs} +5 -5
  42. package/dist/{ref-CGeCLkAk.cjs.map → ref-B4s-S3RK.cjs.map} +1 -1
  43. package/dist/ref.cjs +2 -2
  44. package/dist/{refs-CJZBa9hL.cjs → refs-BcbdyOMu.cjs} +3 -3
  45. package/dist/{refs-CJZBa9hL.cjs.map → refs-BcbdyOMu.cjs.map} +1 -1
  46. package/dist/{rolldown-runtime-BV8xUvPy.cjs → rolldown-runtime-CbDVJ4mO.cjs} +8 -6
  47. package/dist/{schema-0YJZqRXb.cjs → schema-BNlJ7DEx.cjs} +2 -2
  48. package/dist/{schema-0YJZqRXb.cjs.map → schema-BNlJ7DEx.cjs.map} +1 -1
  49. package/dist/{schema-CMe0Dvgd.cjs → schema-aUVOrRjr.cjs} +7 -7
  50. package/dist/{schema-CMe0Dvgd.cjs.map → schema-aUVOrRjr.cjs.map} +1 -1
  51. package/dist/schema.cjs +4 -4
  52. package/dist/{visitor-DT712cxr.cjs → visitor-DVsp084s.cjs} +4 -4
  53. package/dist/{visitor-DT712cxr.cjs.map → visitor-DVsp084s.cjs.map} +1 -1
  54. package/package.json +2 -2
  55. package/dist/http-Dv8py6wh.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nodes-BjVv21pb.cjs","names":["nodeFactory","nodeKinds","nodeFactory","nodeKinds","nodeKinds","nodeFactory","nodeKinds","nodeKinds","applyOptionality","nodeKinds","applyOptionality","nodeKinds","nodeKinds"],"sources":["../src/nodes/code.ts","../src/nodes/content.ts","../src/nodes/input.ts","../src/nodes/requestBody.ts","../src/nodes/operation.ts","../src/nodes/parameter.ts","../src/nodes/property.ts","../src/nodes/response.ts","../src/nodes/index.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\n\n/**\n * JSDoc documentation metadata attached to code declarations.\n */\nexport type JSDocNode = {\n /**\n * JSDoc comment lines. `undefined` entries are filtered out during rendering.\n *\n * @example\n * ```ts\n * ['@description A pet resource', '@deprecated']\n * ```\n */\n comments?: Array<string | undefined>\n}\n\n/**\n * AST node representing a TypeScript `const` declaration.\n *\n * Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createConst({ name: 'pet', export: true, asConst: true })\n * // export const pet = ... as const\n * ```\n */\nexport type ConstNode = BaseNode & {\n kind: 'Const'\n /**\n * Name of the constant declaration.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * Explicit type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n type?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Whether to append `as const` to the declaration.\n */\n asConst?: boolean | null\n /**\n * Child nodes representing the value of the constant (children of the `Const` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `type` alias declaration.\n *\n * Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport type TypeNode = BaseNode & {\n kind: 'Type'\n /**\n * Name of the type alias.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * How the declaration is written.\n * - `'type'` declares `type Name = …`\n * - `'interface'` declares `interface Name { … }`, so the body must be an object type\n *\n * @default 'type'\n */\n syntax?: 'type' | 'interface' | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the type body (children of the `Type` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `function` declaration.\n *\n * Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createFunction({ name: 'getPet', export: true, async: true, returnType: 'Pet' })\n * // export async function getPet(): Promise<Pet> { ... }\n * ```\n */\nexport type FunctionNode = BaseNode & {\n kind: 'Function'\n /**\n * Name of the function.\n */\n name: string\n /**\n * Whether the function is a default export.\n */\n default?: boolean | null\n /**\n * Function parameter list as a pre-rendered string, written verbatim between the parentheses.\n *\n * @example\n * `'id: string, config: Config = {}'`\n */\n params?: string | null\n /**\n * Whether the function should be exported.\n */\n export?: boolean | null\n /**\n * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.\n */\n async?: boolean | null\n /**\n * TypeScript generic type parameters.\n *\n * @example Constrained generics\n * `['T', 'U extends string']`\n */\n generics?: string | Array<string> | null\n /**\n * Return type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n returnType?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the function body (children of the `Function` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript arrow function (`const name = () => { ... }`).\n *\n * Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'getPet', export: true, singleLine: true })\n * // export const getPet = () => ...\n * ```\n */\nexport type ArrowFunctionNode = Omit<FunctionNode, 'kind'> & {\n kind: 'ArrowFunction'\n /**\n * Render the arrow function body as a single-line expression.\n */\n singleLine?: boolean | null\n}\n\n/**\n * AST node representing a raw text/string fragment in the source output.\n *\n * Used instead of bare `string` values so that all entries in `nodes` arrays\n * are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport type TextNode = BaseNode & {\n kind: 'Text'\n /**\n * The raw string content.\n */\n value: string\n}\n\n/**\n * AST node representing a blank line in the source output.\n *\n * Corresponds to `<br/>` in JSX components. `printNodes` turns a `Break` between two\n * statements into one blank line. Consecutive breaks, and breaks at the start or end of\n * the list, are folded away, so a `Break` never produces more than one blank line.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport type BreakNode = BaseNode & {\n kind: 'Break'\n}\n\n/**\n * AST node representing a raw JSX fragment in the source output.\n *\n * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup\n * (including fragments `<>…</>`) directly in generated code.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport type JsxNode = BaseNode & {\n kind: 'Jsx'\n /**\n * The raw JSX string content.\n */\n value: string\n}\n\n/**\n * Union of all code-generation AST nodes.\n *\n * These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as\n * structured children in {@link SourceNode.nodes}.\n */\nexport type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode\n\n/**\n * Creates a `ConstNode` representing a TypeScript `const` declaration.\n *\n * @example Exported constant with type and `as const`\n * ```ts\n * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })\n * // export const pets: Pet[] = ... as const\n * ```\n */\nexport const createConst = nodeFactory<ConstNode>(nodeKinds.const)\n\n/**\n * Creates a `TypeNode` representing a TypeScript `type` alias declaration.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport const createType = nodeFactory<TypeNode>(nodeKinds.type)\n\n/**\n * Creates a `FunctionNode` representing a TypeScript `function` declaration.\n *\n * @example\n * ```ts\n * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })\n * // export async function fetchPet(): Promise<Pet> { ... }\n * ```\n */\nexport const createFunction = nodeFactory<FunctionNode>(nodeKinds.function)\n\n/**\n * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })\n * // export const double = (n: number) => ...\n * ```\n */\nexport const createArrowFunction = nodeFactory<ArrowFunctionNode>(nodeKinds.arrowFunction)\n\n/**\n * Creates a {@link TextNode} representing a raw string fragment in the source output.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport function createText(value: string): TextNode {\n return { kind: nodeKinds.text, value }\n}\n\n/**\n * Creates a {@link BreakNode} representing a line break in the source output.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport function createBreak(): BreakNode {\n return { kind: nodeKinds.break }\n}\n\n/**\n * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport function createJsx(value: string): JsxNode {\n return { kind: nodeKinds.jsx, value }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ParameterStyle } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * How one body property is serialized, from the `encoding` entry of its media type.\n */\nexport type EncodingNode = {\n /**\n * Content type of the part, for example `'application/json'` for a multipart property.\n */\n contentType?: string\n /**\n * Serialization style of the property.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values.\n */\n explode?: boolean\n /**\n * Whether reserved characters are sent as-is instead of percent-encoded.\n */\n allowReserved?: boolean\n encoding?: Record<string, EncodingNode>\n prefixEncoding?: Array<EncodingNode>\n itemEncoding?: EncodingNode\n}\n\nexport type ExampleNode = {\n name?: string\n summary?: string\n description?: string\n value?: unknown\n serializedValue?: string\n}\n\n/**\n * AST node representing one content-type entry of a request body or response.\n *\n * There is one entry per content type declared in the spec (e.g. `application/json`,\n * `multipart/form-data`), and each entry holds its own body schema.\n *\n * @example\n * ```ts\n * const content: ContentNode = {\n * kind: 'Content',\n * contentType: 'application/json',\n * schema: createSchema({ type: 'string' }),\n * }\n * ```\n */\nexport type ContentNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Content'\n /**\n * The content type for this entry (e.g. `'application/json'`), or `''` for a response without a body.\n */\n contentType: string\n /**\n * Body schema for this content type. For a stream it is the same node as `stream.schema`.\n */\n schema?: SchemaNode\n /**\n * Set when the content is a stream of items (an event stream, JSON Lines, a channel of messages) instead of one body.\n */\n stream?: {\n /**\n * Schema of one item, such as one event of `text/event-stream` or one line of JSON Lines.\n */\n schema?: SchemaNode\n /**\n * What `schema` describes for an event stream.\n * - `'event'` the parsed event with its `event`, `data`, `id` and `retry` fields\n * - `'data'` only the `data` payload, which the client wraps in its own event type\n */\n shape?: 'event' | 'data'\n }\n /**\n * Property keys to exclude from the generated type via `Omit<Type, Keys>`.\n * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.\n */\n keysToOmit?: Array<string> | null\n /**\n * Serialization settings per body property that sets at least one field in the spec's `encoding`.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n /**\n * Serialization of the first parts by position, for a body sent as an array of parts such as `multipart/mixed`.\n */\n prefixEncoding?: Array<EncodingNode>\n /**\n * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.\n */\n itemEncoding?: EncodingNode\n /** Vendor extensions (`x-*` keys) from the source media type, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `ContentNode` for a single request-body or response content type.\n */\nexport const createContent = nodeFactory<ContentNode>(nodeKinds.content)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { OperationNode } from './operation.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * A variable declared by a server URL template.\n */\nexport type InputServerVariable = {\n default?: string\n enum?: Array<string>\n description?: string\n}\n\n/**\n * A server from the source document, with `{variable}` placeholders filled from their defaults.\n */\nexport type InputServer = {\n url: string\n name?: string\n description?: string\n /**\n * Variables of the source URL template, copied as-is. `url` already has their defaults filled in, so\n * this tells a templated server apart from a literal one. Absent when the server declares none.\n */\n variables?: Record<string, InputServerVariable>\n}\n\nexport type ExternalDocs = { url: string; description?: string }\n\nexport type InputTag = {\n name: string\n summary?: string\n description?: string\n /**\n * Name of the tag this tag nests under. `group: { type: 'tag' }` places its files in the parent's folder.\n */\n parent?: string\n kind?: string\n externalDocs?: ExternalDocs\n}\n\nexport type OAuthFlow = {\n authorizationUrl?: string\n deviceAuthorizationUrl?: string\n tokenUrl?: string\n refreshUrl?: string\n scopes?: Record<string, string>\n}\n\n/**\n * How a client sends a credential, in the same shape as the `Auth` object the generated clients pass to `auth`.\n */\nexport type AuthCredential =\n | { type: 'http'; scheme: 'bearer' | 'basic' | (string & {}); bearerFormat?: string }\n | { type: 'apiKey'; in: 'header' | 'query' | 'cookie'; name: string }\n | { type: 'oauth2'; flows: Record<string, OAuthFlow>; metadataUrl?: string }\n | { type: 'openIdConnect'; url?: string }\n | { type: 'mutualTLS' }\n\n/**\n * One way to authenticate, keyed by `name`, which operations refer to in `auth`.\n */\nexport type AuthScheme = {\n name: string\n description?: string\n deprecated?: boolean\n credential: AuthCredential\n}\n\n/**\n * One way to meet an operation's auth. Every scheme in it applies together. `scopes` are the OAuth2 or OpenID\n * Connect scopes the call needs. An empty list means the call may be sent without credentials.\n */\nexport type AuthRequirement = Array<{ scheme: string; scopes?: Array<string> }>\n\n/**\n * Metadata for an API document, populated by the adapter and available to every generator.\n * Every field is a plain JSON value.\n *\n * @example\n * ```ts\n * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2' }\n * ```\n */\nexport type InputMeta = {\n /**\n * API title from `info.title` in the source document.\n */\n title?: string\n /**\n * API description from `info.description` in the source document.\n */\n description?: string\n /**\n * API version string from `info.version` in the source document.\n */\n version?: string\n summary?: string\n termsOfService?: string\n contact?: { name?: string; url?: string; email?: string }\n license?: { name: string; identifier?: string; url?: string }\n externalDocs?: ExternalDocs\n /**\n * Resolved base URL from the first matching server entry in the source document.\n */\n baseURL?: string | null\n /**\n * The server index the adapter was configured with. A plugin uses it to pick the server at the same position in an\n * operation's or a path's own `servers`. It counts the source document's entries, including any without a URL.\n * Absent when the adapter was given no index.\n */\n serverIndex?: number\n servers?: Array<InputServer>\n tags?: Array<InputTag>\n auth?: Array<AuthScheme>\n /**\n * Vendor extensions (`x-*` keys) from the document root, copied as-is. Absent when the root has none.\n */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Input AST node that contains all schemas and operations for one API document.\n * Produced by the adapter and consumed by all Kubb plugins.\n *\n * @example\n * ```ts\n * const input: InputNode = {\n * kind: 'Input',\n * schemas: [],\n * operations: [],\n * meta: {},\n * }\n * ```\n */\nexport type InputNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Input'\n /**\n * All schema nodes in the document.\n */\n schemas: Array<SchemaNode>\n /**\n * All operation nodes in the document.\n */\n operations: Array<OperationNode>\n /**\n * Document metadata populated by the adapter.\n */\n meta: InputMeta\n}\n\n/**\n * Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to an empty\n * object. Every call allocates fresh defaults so no two inputs share them.\n *\n * @example\n * ```ts\n * const input = createInput()\n * // { kind: 'Input', schemas: [], operations: [] }\n * ```\n */\nexport function createInput(overrides: Partial<Omit<InputNode, 'kind'>> = {}): InputNode {\n return { schemas: [], operations: [], meta: {}, ...overrides, kind: nodeKinds.input }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ContentNode } from './content.ts'\n\n/**\n * AST node representing an operation request body.\n *\n * Body schemas live exclusively inside the `content` array (one entry per content type),\n * mirroring {@link ResponseNode}.\n *\n * @example\n * ```ts\n * const requestBody: RequestBodyNode = {\n * kind: 'RequestBody',\n * required: true,\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type RequestBodyNode = BaseNode & {\n kind: 'RequestBody'\n /**\n * Request body description carried over from the spec.\n */\n description?: string\n /**\n * Whether the request body is required (`requestBody.required: true` in the spec).\n * When `false` or absent, the generated `data` parameter should be optional.\n */\n required?: boolean\n /**\n * Content type entries for this request body.\n *\n * When the adapter `contentType` option is set, this array contains exactly one entry for\n * that content type. Otherwise it contains one entry per content type declared in the spec,\n * so plugins can generate code for every variant (for example, separate hooks for\n * `application/json` and `multipart/form-data`).\n */\n content?: Array<ContentNode>\n /** Vendor extensions (`x-*` keys) from the source request body, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `RequestBodyNode`.\n */\nexport const createRequestBody = nodeFactory<RequestBodyNode>(nodeKinds.requestBody)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { AuthRequirement, ExternalDocs, InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport { createRequestBody, type RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\n\n/**\n * HTTP method an operation responds to. `QUERY` is the safe, idempotent method with a request body\n * from RFC 10008, declared with the `query` field of an OpenAPI 3.2 path item. Any other name is a\n * method the source declares outside this fixed set, in the capitalization it is sent with.\n */\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY' | (string & {})\n\n/**\n * Fields shared by every operation, regardless of transport.\n */\nexport type OperationNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Operation'\n /**\n * Stable identifier for the operation.\n */\n operationId: string\n /**\n * Group labels for the operation.\n */\n tags: Array<string>\n /**\n * Short one-line operation summary.\n */\n summary?: string\n /**\n * Full operation description.\n */\n description?: string\n /**\n * Marks the operation as deprecated.\n */\n deprecated?: boolean\n externalDocs?: ExternalDocs\n /**\n * Query, path, header, and cookie parameters for the operation.\n */\n parameters: Array<ParameterNode>\n /**\n * Request body for the operation.\n */\n requestBody?: RequestBodyNode\n /**\n * Operation responses.\n */\n responses: Array<ResponseNode>\n /**\n * Vendor extensions (`x-*` keys) from the source operation, copied as-is. Absent when the source has none.\n */\n extensions?: Record<string, unknown>\n /** The operation's own `servers`, else its path item's, such as an upload host. Absent when neither declares any. */\n servers?: Array<InputServer>\n /**\n * Ways to authenticate, from the operation or else the document. Any one entry is enough. `[]` means no auth.\n */\n auth?: Array<AuthRequirement>\n}\n\n/**\n * Operation served over HTTP. `method` and `path` are guaranteed.\n *\n * @example\n * ```ts\n * const operation: HttpOperationNode = {\n * kind: 'Operation',\n * operationId: 'listPets',\n * protocol: 'http',\n * method: 'GET',\n * path: '/pets',\n * tags: [],\n * parameters: [],\n * responses: [],\n * }\n * ```\n */\nexport type HttpOperationNode = OperationNodeBase & {\n /**\n * Transport the operation belongs to.\n */\n protocol?: 'http'\n /**\n * HTTP method like `'GET'`.\n */\n method: HttpMethod\n /**\n * Path string, for example `/pets/{petId}`, with `{param}` notation preserved.\n */\n path: string\n}\n\n/**\n * Operation for a non-HTTP transport. HTTP-only fields are forbidden.\n */\nexport type GenericOperationNode = OperationNodeBase & {\n protocol?: never\n method?: never\n path?: never\n}\n\n/**\n * AST node representing one API operation.\n *\n * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees\n * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with\n * `ast.http.isOperation(node)` or `node.protocol === 'http'` before reading `method`/`path`.\n */\nexport type OperationNode = HttpOperationNode | GenericOperationNode\n\nexport type OperationInput = {\n operationId: string\n method?: HttpOperationNode['method']\n path?: HttpOperationNode['path']\n requestBody?: Omit<RequestBodyNode, 'kind'>\n [key: string]: unknown\n}\n\n/**\n * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.\n * HTTP operations (those carrying both `method` and `path`) are tagged with `protocol: 'http'`,\n * and the request body is normalized into a `RequestBodyNode`.\n *\n * @example\n * ```ts\n * const operation = createOperation({ operationId: 'getPetById', method: 'GET', path: '/pet/{petId}' })\n * // tags, parameters, and responses are []\n * ```\n */\nexport function createOperation(\n props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> &\n Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): HttpOperationNode\nexport function createOperation(\n props: Pick<GenericOperationNode, 'operationId'> &\n Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): GenericOperationNode\nexport function createOperation(props: OperationInput): OperationNode {\n const { requestBody, ...rest } = props\n const isHttp = rest.method !== undefined && rest.path !== undefined\n\n const node = {\n tags: [],\n parameters: [],\n responses: [],\n ...rest,\n kind: nodeKinds.operation,\n ...(isHttp ? { protocol: 'http' as const } : {}),\n requestBody: requestBody ? createRequestBody(requestBody) : undefined,\n }\n\n return node as OperationNode\n}\n\n/**\n * The operations a plugin keeps, as one node. A template with `kind: 'Operations'` gets it once, after every operation.\n */\nexport type OperationsNode = BaseNode & {\n kind: 'Operations'\n operations: Array<OperationNode>\n}\n\n/**\n * Creates an `OperationsNode` for a list of operations.\n *\n * @example\n * ```ts\n * const node = createOperations({ operations: [listPets, getPetById] })\n * // { kind: 'Operations', operations: [...] }\n * ```\n */\nexport function createOperations({ operations }: { operations: Array<OperationNode> }): OperationsNode {\n return { kind: nodeKinds.operations, operations }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { EncodingNode, ExampleNode } from './content.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * Where a parameter is sent. `querystring` carries the whole query string as one value, serialized per `contentType`.\n */\nexport type ParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'querystring'\n\n/**\n * Parameter serialization style, controlling how a parameter value is rendered into the request.\n */\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject' | 'cookie'\n\n/**\n * AST node representing one operation parameter.\n *\n * @example\n * ```ts\n * const param: ParameterNode = {\n * kind: 'Parameter',\n * name: 'petId',\n * in: 'path',\n * schema: createSchema({ type: 'string' }),\n * required: true,\n * }\n * ```\n */\nexport type ParameterNode = BaseNode & {\n kind: 'Parameter'\n /**\n * Parameter name.\n */\n name: string\n /**\n * Parameter location (`path`, `query`, `header`, `cookie`, or `querystring`).\n */\n in: ParameterLocation\n /**\n * Parameter schema.\n */\n schema: SchemaNode\n /**\n * Whether the parameter is required.\n */\n required: boolean\n /**\n * Serialization style. Absent when the source omits it, leaving consumers to apply the\n * per-location default.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values. Absent when the source omits it,\n * leaving consumers to apply the default for the style.\n */\n explode?: boolean\n /**\n * Whether reserved characters (RFC 3986 `:/?#[]@!$&'()*+,;=`) are sent as-is instead of\n * percent-encoded. Absent when the source omits it.\n */\n allowReserved?: boolean\n /**\n * Media type of a parameter described with `content` instead of `schema`, for example\n * `application/json` when the value is sent as a JSON-encoded string. Absent for `schema` parameters.\n */\n contentType?: string\n /**\n * Serialization settings per property of a `content` parameter, from the `encoding` of its media type. An OpenAPI 3.2\n * `querystring` parameter sent as `application/x-www-form-urlencoded` uses it to set `style` and `explode` per field.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n deprecated?: boolean\n allowEmptyValue?: boolean\n /** Vendor extensions (`x-*` keys) from the source parameter, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\nexport type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>\n\n/**\n * Creates a `ParameterNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\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 */\nexport function createParameter(input: UserParameterNode): ParameterNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.parameter }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * AST node representing one named object property.\n *\n * @example\n * ```ts\n * const property: PropertyNode = {\n * kind: 'Property',\n * name: 'id',\n * schema: createSchema({ type: 'integer' }),\n * required: true,\n * }\n * ```\n */\nexport type PropertyNode = BaseNode & {\n kind: 'Property'\n /**\n * Property key.\n */\n name: string\n /**\n * Property schema.\n */\n schema: SchemaNode\n /**\n * Whether the property is required.\n */\n required: boolean\n}\n\n/**\n * Loosely-typed property accepted by `createProperty`, with `required` optional.\n */\nexport type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>\n\n/**\n * Creates a `PropertyNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\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(input: UserPropertyNode): PropertyNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.property }\n}\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport { type ContentNode, createContent } from './content.ts'\nimport type { InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\nexport type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n/**\n * Response status code literal used by operations.\n *\n * Includes three-digit HTTP status code strings, ranges such as `\"2xx\"`, and `\"default\"` for catch-all responses.\n *\n * @example\n * ```ts\n * const status: StatusCode = '200'\n * const fallback: StatusCode = 'default'\n * ```\n */\nexport type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | `${1 | 2 | 3 | 4 | 5}xx` | 'default'\n\n/**\n * AST node representing one operation response variant.\n *\n * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside\n * the `content` array (one entry per content type), so the same schema is never duplicated at the\n * node root and inside `content`.\n *\n * @example\n * ```ts\n * const response: ResponseNode = {\n * kind: 'Response',\n * statusCode: '200',\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type ResponseNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Response'\n /**\n * HTTP status code or `'default'` for a fallback response.\n */\n statusCode: StatusCode\n summary?: string\n /**\n * Optional response description.\n */\n description?: string\n /**\n * All available content type entries for this response.\n *\n * For a response that declares content, the array holds exactly one entry for the adapter\n * `contentType` option when it is set. Otherwise it holds one entry per content type declared in\n * the spec, so that plugins can generate a union of response types (e.g. `application/json` and\n * `application/xml`). A body-less response always keeps a single entry whose `contentType` is `''`\n * and whose `schema` is the empty/`void` placeholder, even when the option is set.\n *\n * @example\n * ```ts\n * // spec response declares both application/json and application/xml\n * response.content[0].contentType // 'application/json'\n * response.content[1].contentType // 'application/xml'\n * ```\n */\n content?: Array<ContentNode>\n /**\n * Response headers, as `in: 'header'` parameters. `Content-Type` is left out.\n */\n headers?: Array<ParameterNode>\n links?: Record<string, ResponseLink>\n /** Vendor extensions (`x-*` keys) from the source response, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.\n */\nexport type ResponseLink = {\n operationId?: string\n operationRef?: string\n parameters?: Record<string, unknown>\n requestBody?: unknown\n description?: string\n server?: InputServer\n}\n\nexport type ResponseInput = Pick<ResponseNode, 'statusCode'> &\n Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {\n content?: Array<ContentNode>\n schema?: SchemaNode\n mediaType?: string | null\n keysToOmit?: Array<string> | null\n }\n\n/**\n * Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)\n * is normalized into one `content` entry.\n *\n * @example\n * ```ts\n * const response = createResponse({\n * statusCode: '200',\n * content: [createContent({ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) })],\n * })\n * ```\n */\nexport function createResponse(props: ResponseInput): ResponseNode {\n const { schema, mediaType, keysToOmit, content, ...rest } = props\n const entries = content ?? (schema ? [createContent({ contentType: mediaType ?? 'application/json', schema, keysToOmit: keysToOmit ?? null })] : undefined)\n\n return { ...rest, content: entries, kind: nodeKinds.response }\n}\n","import type { ArrowFunctionNode, BreakNode, ConstNode, FunctionNode, JsxNode, TextNode, TypeNode } from './code.ts'\nimport type { ContentNode } from './content.ts'\nimport type { ExportNode, FileNode, ImportNode, SourceNode } from './file.ts'\nimport type { InputNode } from './input.ts'\nimport type { OperationNode, OperationsNode } from './operation.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { PropertyNode } from './property.ts'\nimport type { RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\nimport type { SchemaNode } from './schema.ts'\n\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './code.ts'\nexport { createContent } from './content.ts'\nexport { createExport, createFile, createImport, createSource } from './file.ts'\nexport type { ExportInput, ImportInput, ModuleName, Space, UserFileNode } from './file.ts'\nexport { createInput } from './input.ts'\nexport { createOperation, createOperations } from './operation.ts'\nexport { createParameter } from './parameter.ts'\nexport { createProperty } from './property.ts'\nexport { createRequestBody } from './requestBody.ts'\nexport { createResponse } from './response.ts'\nexport { createSchema } from './schema.ts'\n\n/**\n * Union of all AST node types.\n *\n * This lets TypeScript narrow types in `switch (node.kind)` blocks.\n *\n * @example\n * ```ts\n * function getKind(node: Node): string {\n * switch (node.kind) {\n * case nodeKinds.input:\n * return 'input'\n * default:\n * return 'other'\n * }\n * }\n * ```\n */\nexport type Node =\n | InputNode\n | OperationNode\n | OperationsNode\n | SchemaNode\n | PropertyNode\n | ParameterNode\n | ResponseNode\n | RequestBodyNode\n | ContentNode\n | FileNode\n | ImportNode\n | ExportNode\n | SourceNode\n | ConstNode\n | TypeNode\n | FunctionNode\n | ArrowFunctionNode\n | TextNode\n | BreakNode\n | JsxNode\n"],"mappings":";;;;;;;;;;;;;;;AAmQA,MAAa,cAAcA,aAAAA,YAAuBC,kBAAAA,UAAU,KAAK;;;;;;;;;;AAWjE,MAAa,aAAaD,aAAAA,YAAsBC,kBAAAA,UAAU,IAAI;;;;;;;;;;AAW9D,MAAa,iBAAiBD,aAAAA,YAA0BC,kBAAAA,UAAU,QAAQ;;;;;;;;;;AAW1E,MAAa,sBAAsBD,aAAAA,YAA+BC,kBAAAA,UAAU,aAAa;;;;;;;;;;AAWzF,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAM;CAAM;AACvC;;;;;;;;;;AAWA,SAAgB,cAAyB;CACvC,OAAO,EAAE,MAAMA,kBAAAA,UAAU,MAAM;AACjC;;;;;;;;;;AAWA,SAAgB,UAAU,OAAwB;CAChD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAK;CAAM;AACtC;;;;;ACjOA,MAAa,gBAAgBC,aAAAA,YAAyBC,kBAAAA,UAAU,OAAO;;;;;;;;;;;;AC2DvE,SAAgB,YAAY,YAA8C,CAAC,GAAc;CACvF,OAAO;EAAE,SAAS,CAAC;EAAG,YAAY,CAAC;EAAG,MAAM,CAAC;EAAG,GAAG;EAAW,MAAMC,kBAAAA,UAAU;CAAM;AACtF;;;;;ACzHA,MAAa,oBAAoBC,aAAAA,YAA6BC,kBAAAA,UAAU,WAAW;;ACsGnF,SAAgB,gBAAgB,OAAsC;CACpE,MAAM,EAAE,aAAa,GAAG,SAAS;CACjC,MAAM,SAAS,KAAK,WAAW,KAAA,KAAa,KAAK,SAAS,KAAA;CAY1D,OAAO;EATL,MAAM,CAAC;EACP,YAAY,CAAC;EACb,WAAW,CAAC;EACZ,GAAG;EACH,MAAMC,kBAAAA,UAAU;EAChB,GAAI,SAAS,EAAE,UAAU,OAAgB,IAAI,CAAC;EAC9C,aAAa,cAAc,kBAAkB,WAAW,IAAI,KAAA;CAGpD;AACZ;;;;;;;;;;AAmBA,SAAgB,iBAAiB,EAAE,cAAoE;CACrG,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAY;CAAW;AAClD;;;;;;;;;;;;;;;;ACxFA,SAAgB,gBAAgB,OAAyC;CACvE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAU;AAC3G;;;;;;;;;;;;;;;;AC/CA,SAAgB,eAAe,OAAuC;CACpE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAS;AAC1G;;;;;;;;;;;;;;ACqDA,SAAgB,eAAe,OAAoC;CACjE,MAAM,EAAE,QAAQ,WAAW,YAAY,SAAS,GAAG,SAAS;CAC5D,MAAM,UAAU,YAAY,SAAS,CAAC,cAAc;EAAE,aAAa,aAAa;EAAoB;EAAQ,YAAY,cAAc;CAAK,CAAC,CAAC,IAAI,KAAA;CAEjJ,OAAO;EAAE,GAAG;EAAM,SAAS;EAAS,MAAMC,kBAAAA,UAAU;CAAS;AAC/D"}
1
+ {"version":3,"file":"nodes-BJzvlvwk.cjs","names":["nodeFactory","nodeKinds","nodeFactory","nodeKinds","nodeKinds","nodeFactory","nodeKinds","nodeKinds","applyOptionality","nodeKinds","applyOptionality","nodeKinds","nodeKinds"],"sources":["../src/nodes/code.ts","../src/nodes/content.ts","../src/nodes/input.ts","../src/nodes/requestBody.ts","../src/nodes/operation.ts","../src/nodes/parameter.ts","../src/nodes/property.ts","../src/nodes/response.ts","../src/nodes/index.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\n\n/**\n * JSDoc documentation metadata attached to code declarations.\n */\nexport type JSDocNode = {\n /**\n * JSDoc comment lines. `undefined` entries are filtered out during rendering.\n *\n * @example\n * ```ts\n * ['@description A pet resource', '@deprecated']\n * ```\n */\n comments?: Array<string | undefined>\n}\n\n/**\n * AST node representing a TypeScript `const` declaration.\n *\n * Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createConst({ name: 'pet', export: true, asConst: true })\n * // export const pet = ... as const\n * ```\n */\nexport type ConstNode = BaseNode & {\n kind: 'Const'\n /**\n * Name of the constant declaration.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * Explicit type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n type?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Whether to append `as const` to the declaration.\n */\n asConst?: boolean | null\n /**\n * Child nodes representing the value of the constant (children of the `Const` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `type` alias declaration.\n *\n * Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport type TypeNode = BaseNode & {\n kind: 'Type'\n /**\n * Name of the type alias.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * How the declaration is written.\n * - `'type'` declares `type Name = …`\n * - `'interface'` declares `interface Name { … }`, so the body must be an object type\n *\n * @default 'type'\n */\n syntax?: 'type' | 'interface' | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the type body (children of the `Type` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `function` declaration.\n *\n * Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createFunction({ name: 'getPet', export: true, async: true, returnType: 'Pet' })\n * // export async function getPet(): Promise<Pet> { ... }\n * ```\n */\nexport type FunctionNode = BaseNode & {\n kind: 'Function'\n /**\n * Name of the function.\n */\n name: string\n /**\n * Whether the function is a default export.\n */\n default?: boolean | null\n /**\n * Function parameter list as a pre-rendered string, written verbatim between the parentheses.\n *\n * @example\n * `'id: string, config: Config = {}'`\n */\n params?: string | null\n /**\n * Whether the function should be exported.\n */\n export?: boolean | null\n /**\n * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.\n */\n async?: boolean | null\n /**\n * TypeScript generic type parameters.\n *\n * @example Constrained generics\n * `['T', 'U extends string']`\n */\n generics?: string | Array<string> | null\n /**\n * Return type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n returnType?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the function body (children of the `Function` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript arrow function (`const name = () => { ... }`).\n *\n * Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'getPet', export: true, singleLine: true })\n * // export const getPet = () => ...\n * ```\n */\nexport type ArrowFunctionNode = Omit<FunctionNode, 'kind'> & {\n kind: 'ArrowFunction'\n /**\n * Render the arrow function body as a single-line expression.\n */\n singleLine?: boolean | null\n}\n\n/**\n * AST node representing a raw text/string fragment in the source output.\n *\n * Used instead of bare `string` values so that all entries in `nodes` arrays\n * are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport type TextNode = BaseNode & {\n kind: 'Text'\n /**\n * The raw string content.\n */\n value: string\n}\n\n/**\n * AST node representing a blank line in the source output.\n *\n * Corresponds to `<br/>` in JSX components. `printNodes` turns a `Break` between two\n * statements into one blank line. Consecutive breaks, and breaks at the start or end of\n * the list, are folded away, so a `Break` never produces more than one blank line.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport type BreakNode = BaseNode & {\n kind: 'Break'\n}\n\n/**\n * AST node representing a raw JSX fragment in the source output.\n *\n * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup\n * (including fragments `<>…</>`) directly in generated code.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport type JsxNode = BaseNode & {\n kind: 'Jsx'\n /**\n * The raw JSX string content.\n */\n value: string\n}\n\n/**\n * Union of all code-generation AST nodes.\n *\n * These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as\n * structured children in {@link SourceNode.nodes}.\n */\nexport type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode\n\n/**\n * Creates a `ConstNode` representing a TypeScript `const` declaration.\n *\n * @example Exported constant with type and `as const`\n * ```ts\n * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })\n * // export const pets: Pet[] = ... as const\n * ```\n */\nexport const createConst = nodeFactory<ConstNode>(nodeKinds.const)\n\n/**\n * Creates a `TypeNode` representing a TypeScript `type` alias declaration.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport const createType = nodeFactory<TypeNode>(nodeKinds.type)\n\n/**\n * Creates a `FunctionNode` representing a TypeScript `function` declaration.\n *\n * @example\n * ```ts\n * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })\n * // export async function fetchPet(): Promise<Pet> { ... }\n * ```\n */\nexport const createFunction = nodeFactory<FunctionNode>(nodeKinds.function)\n\n/**\n * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })\n * // export const double = (n: number) => ...\n * ```\n */\nexport const createArrowFunction = nodeFactory<ArrowFunctionNode>(nodeKinds.arrowFunction)\n\n/**\n * Creates a {@link TextNode} representing a raw string fragment in the source output.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport function createText(value: string): TextNode {\n return { kind: nodeKinds.text, value }\n}\n\n/**\n * Creates a {@link BreakNode} representing a line break in the source output.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport function createBreak(): BreakNode {\n return { kind: nodeKinds.break }\n}\n\n/**\n * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport function createJsx(value: string): JsxNode {\n return { kind: nodeKinds.jsx, value }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ParameterStyle } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * How one body property is serialized, from the `encoding` entry of its media type.\n */\nexport type EncodingNode = {\n /**\n * Content type of the part, for example `'application/json'` for a multipart property.\n */\n contentType?: string\n /**\n * Serialization style of the property.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values.\n */\n explode?: boolean\n /**\n * Whether reserved characters are sent as-is instead of percent-encoded.\n */\n allowReserved?: boolean\n encoding?: Record<string, EncodingNode>\n prefixEncoding?: Array<EncodingNode>\n itemEncoding?: EncodingNode\n}\n\nexport type ExampleNode = {\n name?: string\n summary?: string\n description?: string\n value?: unknown\n serializedValue?: string\n}\n\n/**\n * AST node representing one content-type entry of a request body or response.\n *\n * There is one entry per content type declared in the spec (e.g. `application/json`,\n * `multipart/form-data`), and each entry holds its own body schema.\n *\n * @example\n * ```ts\n * const content: ContentNode = {\n * kind: 'Content',\n * contentType: 'application/json',\n * schema: createSchema({ type: 'string' }),\n * }\n * ```\n */\nexport type ContentNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Content'\n /**\n * The content type for this entry (e.g. `'application/json'`), or `''` for a response without a body.\n */\n contentType: string\n /**\n * Body schema for this content type. For a stream it is the same node as `stream.schema`.\n */\n schema?: SchemaNode\n /**\n * Set when the content is a stream of items (an event stream, JSON Lines, a channel of messages) instead of one body.\n */\n stream?: {\n /**\n * Schema of one item, such as one event of `text/event-stream` or one line of JSON Lines.\n */\n schema?: SchemaNode\n /**\n * What `schema` describes for an event stream.\n * - `'event'` the parsed event with its `event`, `data`, `id` and `retry` fields\n * - `'data'` only the `data` payload, which the client wraps in its own event type\n */\n shape?: 'event' | 'data'\n }\n /**\n * Property keys to exclude from the generated type via `Omit<Type, Keys>`.\n * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.\n */\n keysToOmit?: Array<string> | null\n /**\n * Serialization settings per body property that sets at least one field in the spec's `encoding`.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n /**\n * Serialization of the first parts by position, for a body sent as an array of parts such as `multipart/mixed`.\n */\n prefixEncoding?: Array<EncodingNode>\n /**\n * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.\n */\n itemEncoding?: EncodingNode\n /** Vendor extensions (`x-*` keys) from the source media type, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `ContentNode` for a single request-body or response content type.\n */\nexport const createContent = nodeFactory<ContentNode>(nodeKinds.content)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { OperationNode } from './operation.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * A variable declared by a server URL template.\n */\nexport type InputServerVariable = {\n default?: string\n enum?: Array<string>\n description?: string\n}\n\n/**\n * A server from the source document, with `{variable}` placeholders filled from their defaults.\n */\nexport type InputServer = {\n url: string\n name?: string\n description?: string\n /**\n * Variables of the source URL template, copied as-is. `url` already has their defaults filled in, so\n * this tells a templated server apart from a literal one. Absent when the server declares none.\n */\n variables?: Record<string, InputServerVariable>\n}\n\nexport type ExternalDocs = { url: string; description?: string }\n\nexport type InputTag = {\n name: string\n summary?: string\n description?: string\n /**\n * Name of the tag this tag nests under. `group: { type: 'tag' }` places its files in the parent's folder.\n */\n parent?: string\n kind?: string\n externalDocs?: ExternalDocs\n}\n\nexport type OAuthFlow = {\n authorizationUrl?: string\n deviceAuthorizationUrl?: string\n tokenUrl?: string\n refreshUrl?: string\n scopes?: Record<string, string>\n}\n\n/**\n * How a client sends a credential, in the same shape as the `Auth` object the generated clients pass to `auth`.\n */\nexport type AuthCredential =\n | { type: 'http'; scheme: 'bearer' | 'basic' | (string & {}); bearerFormat?: string }\n | { type: 'apiKey'; in: 'header' | 'query' | 'cookie'; name: string }\n | { type: 'oauth2'; flows: Record<string, OAuthFlow>; metadataUrl?: string }\n | { type: 'openIdConnect'; url?: string }\n | { type: 'mutualTLS' }\n\n/**\n * One way to authenticate, keyed by `name`, which operations refer to in `auth`.\n */\nexport type AuthScheme = {\n name: string\n description?: string\n deprecated?: boolean\n credential: AuthCredential\n}\n\n/**\n * One way to meet an operation's auth. Every scheme in it applies together. `scopes` are the OAuth2 or OpenID\n * Connect scopes the call needs. An empty list means the call may be sent without credentials.\n */\nexport type AuthRequirement = Array<{ scheme: string; scopes?: Array<string> }>\n\n/**\n * Metadata for an API document, populated by the adapter and available to every generator.\n * Every field is a plain JSON value.\n *\n * @example\n * ```ts\n * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2' }\n * ```\n */\nexport type InputMeta = {\n /**\n * API title from `info.title` in the source document.\n */\n title?: string\n /**\n * API description from `info.description` in the source document.\n */\n description?: string\n /**\n * API version string from `info.version` in the source document.\n */\n version?: string\n summary?: string\n termsOfService?: string\n contact?: { name?: string; url?: string; email?: string }\n license?: { name: string; identifier?: string; url?: string }\n externalDocs?: ExternalDocs\n /**\n * Resolved base URL from the first matching server entry in the source document.\n */\n baseURL?: string | null\n /**\n * The server index the adapter was configured with. A plugin uses it to pick the server at the same position in an\n * operation's or a path's own `servers`. It counts the source document's entries, including any without a URL.\n * Absent when the adapter was given no index.\n */\n serverIndex?: number\n servers?: Array<InputServer>\n tags?: Array<InputTag>\n auth?: Array<AuthScheme>\n /**\n * Vendor extensions (`x-*` keys) from the document root, copied as-is. Absent when the root has none.\n */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Input AST node that contains all schemas and operations for one API document.\n * Produced by the adapter and consumed by all Kubb plugins.\n *\n * @example\n * ```ts\n * const input: InputNode = {\n * kind: 'Input',\n * schemas: [],\n * operations: [],\n * meta: {},\n * }\n * ```\n */\nexport type InputNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Input'\n /**\n * All schema nodes in the document.\n */\n schemas: Array<SchemaNode>\n /**\n * All operation nodes in the document.\n */\n operations: Array<OperationNode>\n /**\n * Document metadata populated by the adapter.\n */\n meta: InputMeta\n}\n\n/**\n * Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to an empty\n * object. Every call allocates fresh defaults so no two inputs share them.\n *\n * @example\n * ```ts\n * const input = createInput()\n * // { kind: 'Input', schemas: [], operations: [] }\n * ```\n */\nexport function createInput(overrides: Partial<Omit<InputNode, 'kind'>> = {}): InputNode {\n return { schemas: [], operations: [], meta: {}, ...overrides, kind: nodeKinds.input }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ContentNode } from './content.ts'\n\n/**\n * AST node representing an operation request body.\n *\n * Body schemas live exclusively inside the `content` array (one entry per content type),\n * mirroring {@link ResponseNode}.\n *\n * @example\n * ```ts\n * const requestBody: RequestBodyNode = {\n * kind: 'RequestBody',\n * required: true,\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type RequestBodyNode = BaseNode & {\n kind: 'RequestBody'\n /**\n * Request body description carried over from the spec.\n */\n description?: string\n /**\n * Whether the request body is required (`requestBody.required: true` in the spec).\n * When `false` or absent, the generated `data` parameter should be optional.\n */\n required?: boolean\n /**\n * Content type entries for this request body.\n *\n * When the adapter `contentType` option is set, this array contains exactly one entry for\n * that content type. Otherwise it contains one entry per content type declared in the spec,\n * so plugins can generate code for every variant (for example, separate hooks for\n * `application/json` and `multipart/form-data`).\n */\n content?: Array<ContentNode>\n /** Vendor extensions (`x-*` keys) from the source request body, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `RequestBodyNode`.\n */\nexport const createRequestBody = nodeFactory<RequestBodyNode>(nodeKinds.requestBody)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { AuthRequirement, ExternalDocs, InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport { createRequestBody, type RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\n\n/**\n * HTTP method an operation responds to. `QUERY` is the safe, idempotent method with a request body\n * from RFC 10008, declared with the `query` field of an OpenAPI 3.2 path item. Any other name is a\n * method the source declares outside this fixed set, in the capitalization it is sent with.\n */\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY' | (string & {})\n\n/**\n * Fields shared by every operation, regardless of transport.\n */\nexport type OperationNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Operation'\n /**\n * Stable identifier for the operation.\n */\n operationId: string\n /**\n * Group labels for the operation.\n */\n tags: Array<string>\n /**\n * Short one-line operation summary.\n */\n summary?: string\n /**\n * Full operation description.\n */\n description?: string\n /**\n * Marks the operation as deprecated.\n */\n deprecated?: boolean\n externalDocs?: ExternalDocs\n /**\n * Query, path, header, and cookie parameters for the operation.\n */\n parameters: Array<ParameterNode>\n /**\n * Request body for the operation.\n */\n requestBody?: RequestBodyNode\n /**\n * Operation responses.\n */\n responses: Array<ResponseNode>\n /**\n * Vendor extensions (`x-*` keys) from the source operation, copied as-is. Absent when the source has none.\n */\n extensions?: Record<string, unknown>\n /** The operation's own `servers`, else its path item's, such as an upload host. Absent when neither declares any. */\n servers?: Array<InputServer>\n /**\n * Ways to authenticate, from the operation or else the document. Any one entry is enough. `[]` means no auth.\n */\n auth?: Array<AuthRequirement>\n}\n\n/**\n * Operation served over HTTP. `method` and `path` are guaranteed.\n *\n * @example\n * ```ts\n * const operation: HttpOperationNode = {\n * kind: 'Operation',\n * operationId: 'listPets',\n * protocol: 'http',\n * method: 'GET',\n * path: '/pets',\n * tags: [],\n * parameters: [],\n * responses: [],\n * }\n * ```\n */\nexport type HttpOperationNode = OperationNodeBase & {\n /**\n * Transport the operation belongs to.\n */\n protocol?: 'http'\n /**\n * HTTP method like `'GET'`.\n */\n method: HttpMethod\n /**\n * Path string, for example `/pets/{petId}`, with `{param}` notation preserved.\n */\n path: string\n}\n\n/**\n * Operation for a non-HTTP transport. HTTP-only fields are forbidden.\n */\nexport type GenericOperationNode = OperationNodeBase & {\n protocol?: never\n method?: never\n path?: never\n}\n\n/**\n * AST node representing one API operation.\n *\n * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees\n * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with\n * `ast.http.isOperation(node)` or `node.protocol === 'http'` before reading `method`/`path`.\n */\nexport type OperationNode = HttpOperationNode | GenericOperationNode\n\nexport type OperationInput = {\n operationId: string\n method?: HttpOperationNode['method']\n path?: HttpOperationNode['path']\n requestBody?: Omit<RequestBodyNode, 'kind'>\n [key: string]: unknown\n}\n\n/**\n * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.\n * HTTP operations (those carrying both `method` and `path`) are tagged with `protocol: 'http'`,\n * and the request body is normalized into a `RequestBodyNode`.\n *\n * @example\n * ```ts\n * const operation = createOperation({ operationId: 'getPetById', method: 'GET', path: '/pet/{petId}' })\n * // tags, parameters, and responses are []\n * ```\n */\nexport function createOperation(\n props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> &\n Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): HttpOperationNode\nexport function createOperation(\n props: Pick<GenericOperationNode, 'operationId'> &\n Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): GenericOperationNode\nexport function createOperation(props: OperationInput): OperationNode {\n const { requestBody, ...rest } = props\n const isHttp = rest.method !== undefined && rest.path !== undefined\n\n const node = {\n tags: [],\n parameters: [],\n responses: [],\n ...rest,\n kind: nodeKinds.operation,\n ...(isHttp ? { protocol: 'http' as const } : {}),\n requestBody: requestBody ? createRequestBody(requestBody) : undefined,\n }\n\n return node as OperationNode\n}\n\n/**\n * The operations a plugin keeps, as one node. A template with `kind: 'Operations'` gets it once, after every operation.\n */\nexport type OperationsNode = BaseNode & {\n kind: 'Operations'\n operations: Array<OperationNode>\n}\n\n/**\n * Creates an `OperationsNode` for a list of operations.\n *\n * @example\n * ```ts\n * const node = createOperations({ operations: [listPets, getPetById] })\n * // { kind: 'Operations', operations: [...] }\n * ```\n */\nexport function createOperations({ operations }: { operations: Array<OperationNode> }): OperationsNode {\n return { kind: nodeKinds.operations, operations }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { EncodingNode, ExampleNode } from './content.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * Where a parameter is sent. `querystring` carries the whole query string as one value, serialized per `contentType`.\n */\nexport type ParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'querystring'\n\n/**\n * Parameter serialization style, controlling how a parameter value is rendered into the request.\n */\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject' | 'cookie'\n\n/**\n * AST node representing one operation parameter.\n *\n * @example\n * ```ts\n * const param: ParameterNode = {\n * kind: 'Parameter',\n * name: 'petId',\n * in: 'path',\n * schema: createSchema({ type: 'string' }),\n * required: true,\n * }\n * ```\n */\nexport type ParameterNode = BaseNode & {\n kind: 'Parameter'\n /**\n * Parameter name.\n */\n name: string\n /**\n * Parameter location (`path`, `query`, `header`, `cookie`, or `querystring`).\n */\n in: ParameterLocation\n /**\n * Parameter schema.\n */\n schema: SchemaNode\n /**\n * Whether the parameter is required.\n */\n required: boolean\n /**\n * Serialization style. Absent when the source omits it, leaving consumers to apply the\n * per-location default.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values. Absent when the source omits it,\n * leaving consumers to apply the default for the style.\n */\n explode?: boolean\n /**\n * Whether reserved characters (RFC 3986 `:/?#[]@!$&'()*+,;=`) are sent as-is instead of\n * percent-encoded. Absent when the source omits it.\n */\n allowReserved?: boolean\n /**\n * Media type of a parameter described with `content` instead of `schema`, for example\n * `application/json` when the value is sent as a JSON-encoded string. Absent for `schema` parameters.\n */\n contentType?: string\n /**\n * Serialization settings per property of a `content` parameter, from the `encoding` of its media type. An OpenAPI 3.2\n * `querystring` parameter sent as `application/x-www-form-urlencoded` uses it to set `style` and `explode` per field.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n deprecated?: boolean\n allowEmptyValue?: boolean\n /** Vendor extensions (`x-*` keys) from the source parameter, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\nexport type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>\n\n/**\n * Creates a `ParameterNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\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 */\nexport function createParameter(input: UserParameterNode): ParameterNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.parameter }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * AST node representing one named object property.\n *\n * @example\n * ```ts\n * const property: PropertyNode = {\n * kind: 'Property',\n * name: 'id',\n * schema: createSchema({ type: 'integer' }),\n * required: true,\n * }\n * ```\n */\nexport type PropertyNode = BaseNode & {\n kind: 'Property'\n /**\n * Property key.\n */\n name: string\n /**\n * Property schema.\n */\n schema: SchemaNode\n /**\n * Whether the property is required.\n */\n required: boolean\n}\n\n/**\n * Loosely-typed property accepted by `createProperty`, with `required` optional.\n */\nexport type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>\n\n/**\n * Creates a `PropertyNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\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(input: UserPropertyNode): PropertyNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.property }\n}\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport { type ContentNode, createContent } from './content.ts'\nimport type { InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\nexport type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n/**\n * Response status code literal used by operations.\n *\n * Includes three-digit HTTP status code strings, ranges such as `\"2xx\"`, and `\"default\"` for catch-all responses.\n *\n * @example\n * ```ts\n * const status: StatusCode = '200'\n * const fallback: StatusCode = 'default'\n * ```\n */\nexport type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | `${1 | 2 | 3 | 4 | 5}xx` | 'default'\n\n/**\n * AST node representing one operation response variant.\n *\n * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside\n * the `content` array (one entry per content type), so the same schema is never duplicated at the\n * node root and inside `content`.\n *\n * @example\n * ```ts\n * const response: ResponseNode = {\n * kind: 'Response',\n * statusCode: '200',\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type ResponseNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Response'\n /**\n * HTTP status code or `'default'` for a fallback response.\n */\n statusCode: StatusCode\n summary?: string\n /**\n * Optional response description.\n */\n description?: string\n /**\n * All available content type entries for this response.\n *\n * For a response that declares content, the array holds exactly one entry for the adapter\n * `contentType` option when it is set. Otherwise it holds one entry per content type declared in\n * the spec, so that plugins can generate a union of response types (e.g. `application/json` and\n * `application/xml`). A body-less response always keeps a single entry whose `contentType` is `''`\n * and whose `schema` is the empty/`void` placeholder, even when the option is set.\n *\n * @example\n * ```ts\n * // spec response declares both application/json and application/xml\n * response.content[0].contentType // 'application/json'\n * response.content[1].contentType // 'application/xml'\n * ```\n */\n content?: Array<ContentNode>\n /**\n * Response headers, as `in: 'header'` parameters. `Content-Type` is left out.\n */\n headers?: Array<ParameterNode>\n links?: Record<string, ResponseLink>\n /** Vendor extensions (`x-*` keys) from the source response, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.\n */\nexport type ResponseLink = {\n operationId?: string\n operationRef?: string\n parameters?: Record<string, unknown>\n requestBody?: unknown\n description?: string\n server?: InputServer\n}\n\nexport type ResponseInput = Pick<ResponseNode, 'statusCode'> &\n Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {\n content?: Array<ContentNode>\n schema?: SchemaNode\n mediaType?: string | null\n keysToOmit?: Array<string> | null\n }\n\n/**\n * Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)\n * is normalized into one `content` entry.\n *\n * @example\n * ```ts\n * const response = createResponse({\n * statusCode: '200',\n * content: [createContent({ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) })],\n * })\n * ```\n */\nexport function createResponse(props: ResponseInput): ResponseNode {\n const { schema, mediaType, keysToOmit, content, ...rest } = props\n const entries = content ?? (schema ? [createContent({ contentType: mediaType ?? 'application/json', schema, keysToOmit: keysToOmit ?? null })] : undefined)\n\n return { ...rest, content: entries, kind: nodeKinds.response }\n}\n","import type { ArrowFunctionNode, BreakNode, ConstNode, FunctionNode, JsxNode, TextNode, TypeNode } from './code.ts'\nimport type { ContentNode } from './content.ts'\nimport type { ExportNode, FileNode, ImportNode, SourceNode } from './file.ts'\nimport type { InputNode } from './input.ts'\nimport type { OperationNode, OperationsNode } from './operation.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { PropertyNode } from './property.ts'\nimport type { RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\nimport type { SchemaNode } from './schema.ts'\n\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './code.ts'\nexport { createContent } from './content.ts'\nexport { createExport, createFile, createImport, createSource } from './file.ts'\nexport type { ExportInput, ImportInput, ModuleName, Space, UserFileNode } from './file.ts'\nexport { createInput } from './input.ts'\nexport { createOperation, createOperations } from './operation.ts'\nexport { createParameter } from './parameter.ts'\nexport { createProperty } from './property.ts'\nexport { createRequestBody } from './requestBody.ts'\nexport { createResponse } from './response.ts'\nexport { createSchema } from './schema.ts'\n\n/**\n * Union of all AST node types.\n *\n * This lets TypeScript narrow types in `switch (node.kind)` blocks.\n *\n * @example\n * ```ts\n * function getKind(node: Node): string {\n * switch (node.kind) {\n * case nodeKinds.input:\n * return 'input'\n * default:\n * return 'other'\n * }\n * }\n * ```\n */\nexport type Node =\n | InputNode\n | OperationNode\n | OperationsNode\n | SchemaNode\n | PropertyNode\n | ParameterNode\n | ResponseNode\n | RequestBodyNode\n | ContentNode\n | FileNode\n | ImportNode\n | ExportNode\n | SourceNode\n | ConstNode\n | TypeNode\n | FunctionNode\n | ArrowFunctionNode\n | TextNode\n | BreakNode\n | JsxNode\n"],"mappings":";;;;;;;;;;;;;;;AAmQA,MAAa,cAAcA,aAAAA,YAAuBC,kBAAAA,UAAU,KAAK;;;;;;;;;;AAWjE,MAAa,aAAaD,aAAAA,YAAsBC,kBAAAA,UAAU,IAAI;;;;;;;;;;AAW9D,MAAa,iBAAiBD,aAAAA,YAA0BC,kBAAAA,UAAU,QAAQ;;;;;;;;;;AAW1E,MAAa,sBAAsBD,aAAAA,YAA+BC,kBAAAA,UAAU,aAAa;;;;;;;;;;AAWzF,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAM;CAAM;AACvC;;;;;;;;;;AAWA,SAAgB,cAAyB;CACvC,OAAO,EAAE,MAAMA,kBAAAA,UAAU,MAAM;AACjC;;;;;;;;;;AAWA,SAAgB,UAAU,OAAwB;CAChD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAK;CAAM;AACtC;;;;;ACjOA,MAAa,gBAAgBC,aAAAA,YAAyBC,kBAAAA,UAAU,OAAO;;;;;;;;;;;;AC2DvE,SAAgB,YAAY,YAA8C,CAAC,GAAc;CACvF,OAAO;EAAE,SAAS,CAAC;EAAG,YAAY,CAAC;EAAG,MAAM,CAAC;EAAG,GAAG;EAAW,MAAMC,kBAAAA,UAAU;CAAM;AACtF;;;;;ACzHA,MAAa,oBAAoBC,aAAAA,YAA6BC,kBAAAA,UAAU,WAAW;;ACsGnF,SAAgB,gBAAgB,OAAsC;CACpE,MAAM,EAAE,aAAa,GAAG,SAAS;CACjC,MAAM,SAAS,KAAK,WAAW,KAAA,KAAa,KAAK,SAAS,KAAA;CAY1D,OAAO;EATL,MAAM,CAAC;EACP,YAAY,CAAC;EACb,WAAW,CAAC;EACZ,GAAG;EACH,MAAMC,kBAAAA,UAAU;EAChB,GAAI,SAAS,EAAE,UAAU,OAAgB,IAAI,CAAC;EAC9C,aAAa,cAAc,kBAAkB,WAAW,IAAI,KAAA;CAGpD;AACZ;;;;;;;;;;AAmBA,SAAgB,iBAAiB,EAAE,cAAoE;CACrG,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAY;CAAW;AAClD;;;;;;;;;;;;;;;;ACxFA,SAAgB,gBAAgB,OAAyC;CACvE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAU;AAC3G;;;;;;;;;;;;;;;;AC/CA,SAAgB,eAAe,OAAuC;CACpE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAS;AAC1G;;;;;;;;;;;;;;ACqDA,SAAgB,eAAe,OAAoC;CACjE,MAAM,EAAE,QAAQ,WAAW,YAAY,SAAS,GAAG,SAAS;CAC5D,MAAM,UAAU,YAAY,SAAS,CAAC,cAAc;EAAE,aAAa,aAAa;EAAoB;EAAQ,YAAY,cAAc;CAAK,CAAC,CAAC,IAAI,KAAA;CAEjJ,OAAO;EAAE,GAAG;EAAM,SAAS;EAAS,MAAMC,kBAAAA,UAAU;CAAS;AAC/D"}
@@ -1,4 +1,4 @@
1
- require("./rolldown-runtime-BV8xUvPy.cjs");
1
+ require("./rolldown-runtime-CbDVJ4mO.cjs");
2
2
  // src/optionality.ts
3
3
  /**
4
4
  * Generic JSON Schema optionality: a non-required field is optional, and a
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "applyOptionality", {
19
19
  }
20
20
  });
21
21
 
22
- //# sourceMappingURL=optionality-C-qULYxo.cjs.map
22
+ //# sourceMappingURL=optionality-DZfBHn-q.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"optionality-C-qULYxo.cjs","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(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"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
1
+ {"version":3,"file":"optionality-DZfBHn-q.cjs","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(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"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
@@ -1,4 +1,4 @@
1
- require("./rolldown-runtime-BV8xUvPy.cjs");
1
+ require("./rolldown-runtime-CbDVJ4mO.cjs");
2
2
  // ../../internals/utils/src/promise.ts
3
3
  /**
4
4
  * Returns the value cached under `key` in `store`, computing and storing it on the first call.
@@ -62,4 +62,4 @@ Object.defineProperty(exports, "memo", {
62
62
  }
63
63
  });
64
64
 
65
- //# sourceMappingURL=promise-DMQPWp6M.cjs.map
65
+ //# sourceMappingURL=promise-srRwNz0i.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise-DMQPWp6M.cjs","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\nexport type Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\nclass BoundedStore<TKey, TValue> implements Store<TKey, TValue> {\n readonly #entry = new Map<TKey, TValue>()\n readonly #max: number\n\n constructor(max: number) {\n this.#max = max\n }\n\n has(key: TKey): boolean {\n return this.#entry.has(key)\n }\n\n get(key: TKey): TValue | undefined {\n return this.#entry.get(key)\n }\n\n set(key: TKey, value: TValue): void {\n if (this.#entry.size >= this.#max) this.#entry.clear()\n this.#entry.set(key, value)\n }\n}\n\nclass LastEntryStore<TKey, TValue> extends BoundedStore<TKey, TValue> {\n constructor() {\n super(1)\n }\n\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n #touch(key: TKey): boolean {\n if (!super.has(key)) return false\n this.set(key, super.get(key) as TValue)\n return true\n }\n\n override has(key: TKey): boolean {\n return this.#touch(key)\n }\n\n override get(key: TKey): TValue | undefined {\n return this.#touch(key) ? super.get(key) : undefined\n }\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n if (max === undefined) return new Map<TKey, TValue>()\n if (max !== 1) return new BoundedStore<TKey, TValue>(max)\n return new LastEntryStore<TKey, TValue>()\n}\n\nmemo.create = createStore\n\nexport type InParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain. The first\n * rejection rejects the call, and the other workers start no new item after it.\n *\n * @throws {RangeError} When `limit` is not a positive whole number, which would run no item at all.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: InParallelOptions<TItem>): Promise<void> {\n if (!Number.isInteger(limit) || limit < 1) throw new RangeError(`inParallel needs a limit of 1 or more, got ${limit}`)\n const queue = items.entries()\n let failed = false\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) {\n if (failed) return\n await run(item, index).catch((error: unknown) => {\n failed = true\n throw error\n })\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AAEA,IAAM,eAAN,MAAgE;CACrD,yBAAS,IAAI,IAAkB;CAC/B;CAET,YAAY,KAAa;EACvB,KAAK,OAAO;CACd;CAEA,IAAI,KAAoB;EACtB,OAAO,KAAK,OAAO,IAAI,GAAG;CAC5B;CAEA,IAAI,KAA+B;EACjC,OAAO,KAAK,OAAO,IAAI,GAAG;CAC5B;CAEA,IAAI,KAAW,OAAqB;EAClC,IAAI,KAAK,OAAO,QAAQ,KAAK,MAAM,KAAK,OAAO,MAAM;EACrD,KAAK,OAAO,IAAI,KAAK,KAAK;CAC5B;AACF;AAEA,IAAM,iBAAN,cAA2C,aAA2B;CACpE,cAAc;EACZ,MAAM,CAAC;CACT;CAIA,OAAO,KAAoB;EACzB,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACtC,OAAO;CACT;CAES,IAAI,KAAoB;EAC/B,OAAO,KAAK,OAAO,GAAG;CACxB;CAES,IAAI,KAA+B;EAC1C,OAAO,KAAK,OAAO,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;CAC7C;AACF;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,IAAI,QAAQ,KAAA,GAAW,uBAAO,IAAI,IAAkB;CACpD,IAAI,QAAQ,GAAG,OAAO,IAAI,aAA2B,GAAG;CACxD,OAAO,IAAI,eAA6B;AAC1C;AAEA,KAAK,SAAS"}
1
+ {"version":3,"file":"promise-srRwNz0i.cjs","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\nexport type Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\nclass BoundedStore<TKey, TValue> implements Store<TKey, TValue> {\n readonly #entry = new Map<TKey, TValue>()\n readonly #max: number\n\n constructor(max: number) {\n this.#max = max\n }\n\n has(key: TKey): boolean {\n return this.#entry.has(key)\n }\n\n get(key: TKey): TValue | undefined {\n return this.#entry.get(key)\n }\n\n set(key: TKey, value: TValue): void {\n if (this.#entry.size >= this.#max) this.#entry.clear()\n this.#entry.set(key, value)\n }\n}\n\nclass LastEntryStore<TKey, TValue> extends BoundedStore<TKey, TValue> {\n constructor() {\n super(1)\n }\n\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n #touch(key: TKey): boolean {\n if (!super.has(key)) return false\n this.set(key, super.get(key) as TValue)\n return true\n }\n\n override has(key: TKey): boolean {\n return this.#touch(key)\n }\n\n override get(key: TKey): TValue | undefined {\n return this.#touch(key) ? super.get(key) : undefined\n }\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n if (max === undefined) return new Map<TKey, TValue>()\n if (max !== 1) return new BoundedStore<TKey, TValue>(max)\n return new LastEntryStore<TKey, TValue>()\n}\n\nmemo.create = createStore\n\nexport type InParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain. The first\n * rejection rejects the call, and the other workers start no new item after it.\n *\n * @throws {RangeError} When `limit` is not a positive whole number, which would run no item at all.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: InParallelOptions<TItem>): Promise<void> {\n if (!Number.isInteger(limit) || limit < 1) throw new RangeError(`inParallel needs a limit of 1 or more, got ${limit}`)\n const queue = items.entries()\n let failed = false\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) {\n if (failed) return\n await run(item, index).catch((error: unknown) => {\n failed = true\n throw error\n })\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AAEA,IAAM,eAAN,MAAgE;CACrD,yBAAS,IAAI,IAAkB;CAC/B;CAET,YAAY,KAAa;EACvB,KAAK,OAAO;CACd;CAEA,IAAI,KAAoB;EACtB,OAAO,KAAK,OAAO,IAAI,GAAG;CAC5B;CAEA,IAAI,KAA+B;EACjC,OAAO,KAAK,OAAO,IAAI,GAAG;CAC5B;CAEA,IAAI,KAAW,OAAqB;EAClC,IAAI,KAAK,OAAO,QAAQ,KAAK,MAAM,KAAK,OAAO,MAAM;EACrD,KAAK,OAAO,IAAI,KAAK,KAAK;CAC5B;AACF;AAEA,IAAM,iBAAN,cAA2C,aAA2B;CACpE,cAAc;EACZ,MAAM,CAAC;CACT;CAIA,OAAO,KAAoB;EACzB,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACtC,OAAO;CACT;CAES,IAAI,KAAoB;EAC/B,OAAO,KAAK,OAAO,GAAG;CACxB;CAES,IAAI,KAA+B;EAC1C,OAAO,KAAK,OAAO,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;CAC7C;AACF;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,IAAI,QAAQ,KAAA,GAAW,uBAAO,IAAI,IAAkB;CACpD,IAAI,QAAQ,GAAG,OAAO,IAAI,aAA2B,GAAG;CACxD,OAAO,IAAI,eAA6B;AAC1C;AAEA,KAAK,SAAS"}
@@ -1,7 +1,7 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_refs = require("./refs-CJZBa9hL.cjs");
3
- const require_guards = require("./guards-4drgx10i.cjs");
4
- const require_schema = require("./schema-0YJZqRXb.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CbDVJ4mO.cjs");
2
+ const require_refs = require("./refs-BcbdyOMu.cjs");
3
+ const require_guards = require("./guards-C6i6KL0l.cjs");
4
+ const require_schema = require("./schema-BNlJ7DEx.cjs");
5
5
  // src/ref/index.ts
6
6
  var ref_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
7
7
  getName: () => getName,
@@ -36,4 +36,4 @@ Object.defineProperty(exports, "ref_exports", {
36
36
  }
37
37
  });
38
38
 
39
- //# sourceMappingURL=ref-CGeCLkAk.cjs.map
39
+ //# sourceMappingURL=ref-B4s-S3RK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-CGeCLkAk.cjs","names":["narrowSchema","createSchema","mergeRefWithSchema","refName","resolveRefName"],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAMA,eAAAA,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAASC,eAAAA,aAAaC,aAAAA,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAWC,aAAAA,QAAQ,KAAK,IAAIC,aAAAA,eAAe,KAAK;AAC1E"}
1
+ {"version":3,"file":"ref-B4s-S3RK.cjs","names":["narrowSchema","createSchema","mergeRefWithSchema","refName","resolveRefName"],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAMA,eAAAA,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAASC,eAAAA,aAAaC,aAAAA,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAWC,aAAAA,QAAQ,KAAK,IAAIC,aAAAA,eAAe,KAAK;AAC1E"}
package/dist/ref.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refs = require("./refs-CJZBa9hL.cjs");
3
- const require_ref = require("./ref-CGeCLkAk.cjs");
2
+ const require_refs = require("./refs-BcbdyOMu.cjs");
3
+ const require_ref = require("./ref-B4s-S3RK.cjs");
4
4
  exports.getName = require_ref.getName;
5
5
  exports.getSchema = require_refs.resolveRef;
6
6
  exports.isAlias = require_refs.isBareRef;
@@ -1,5 +1,5 @@
1
- require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_promise = require("./promise-DMQPWp6M.cjs");
1
+ require("./rolldown-runtime-CbDVJ4mO.cjs");
2
+ const require_promise = require("./promise-srRwNz0i.cjs");
3
3
  // src/utils/refs.ts
4
4
  /**
5
5
  * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.
@@ -128,4 +128,4 @@ Object.defineProperty(exports, "resolveRefName", {
128
128
  }
129
129
  });
130
130
 
131
- //# sourceMappingURL=refs-CJZBa9hL.cjs.map
131
+ //# sourceMappingURL=refs-BcbdyOMu.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs-CJZBa9hL.cjs","names":["memo"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAOA,gBAAAA,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAWA,gBAAAA,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
1
+ {"version":3,"file":"refs-BcbdyOMu.cjs","names":["memo"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAOA,gBAAAA,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAWA,gBAAAA,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
@@ -19,12 +19,14 @@ var __exportAll = (all, flags) => {
19
19
  return flags & 2 ? target : Object.preventExtensions(target);
20
20
  };
21
21
  var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
- key = keys[i];
24
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
- get: ((k) => from[k]).bind(null, key),
26
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
- });
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
24
+ desc = __getOwnPropDesc(from, key);
25
+ __defProp(to, key, {
26
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
27
+ enumerable: !desc || desc.enumerable
28
+ });
29
+ }
28
30
  }
29
31
  return to;
30
32
  };
@@ -1,4 +1,4 @@
1
- require("./rolldown-runtime-BV8xUvPy.cjs");
1
+ require("./rolldown-runtime-CbDVJ4mO.cjs");
2
2
  const require_constants = require("./constants-BCRkFAiy.cjs");
3
3
  // src/nodes/schema.ts
4
4
  /**
@@ -46,4 +46,4 @@ Object.defineProperty(exports, "createSchema", {
46
46
  }
47
47
  });
48
48
 
49
- //# sourceMappingURL=schema-0YJZqRXb.cjs.map
49
+ //# sourceMappingURL=schema-BNlJ7DEx.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-0YJZqRXb.cjs","names":["nodeKinds"],"sources":["../src/nodes/schema.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport type { BaseNode, DistributiveOmit } from './base.ts'\nimport type { ExternalDocs } from './input.ts'\nimport type { PropertyNode } from './property.ts'\n\n/**\n * Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.\n */\nexport type PrimitiveSchemaType =\n | 'string'\n | 'number'\n | 'integer'\n | 'bigint'\n | 'boolean'\n | 'null'\n | 'any'\n | 'unknown'\n | 'void'\n | 'never'\n | 'object'\n | 'array'\n | 'date'\n\n/**\n * All schema type strings, one per key of {@link SchemaNodeByType}.\n */\nexport type SchemaType = keyof SchemaNodeByType\n\n/**\n * Scalar schema types without extra object/array/ref structure or constraints. `blob` stays for compatibility, but a blob node is a `BlobSchemaNode`.\n */\nexport type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6'\n\n/**\n * Fields shared by all schema nodes.\n */\nexport type SchemaNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Schema'\n /**\n * Schema name for named definitions (for example, `\"Pet\"`).\n * Inline schemas omit this field.\n * `null` means Kubb has processed this and determined there is no applicable name.\n * `undefined` means the name has not been set yet.\n */\n name?: string | null\n /**\n * Short schema title.\n */\n title?: string\n /**\n * Schema description text.\n */\n description?: string\n /**\n * Whether `null` is allowed.\n */\n nullable?: boolean\n /**\n * Whether the field is optional.\n */\n optional?: boolean\n /**\n * Both optional and nullable (`optional` + `nullable`).\n */\n nullish?: boolean\n /**\n * Whether the schema is deprecated.\n */\n deprecated?: boolean\n /**\n * Whether the schema is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the schema is write-only.\n */\n writeOnly?: boolean\n /**\n * Default value.\n */\n default?: unknown\n /**\n * Example values from an `examples` array.\n */\n examples?: Array<unknown>\n /**\n * Base primitive type.\n * For example, this is `'string'` for a `uuid` schema.\n */\n primitive?: PrimitiveSchemaType\n /**\n * Schema `format` value.\n */\n format?: string\n externalDocs?: ExternalDocs\n /** Vendor extensions (`x-*` keys) from the source schema, copied as-is. */\n extensions?: Record<string, unknown>\n /**\n * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means \"key is present\".\n * Visitors do not walk it.\n */\n conditionals?: Array<{ if: SchemaNode; then?: SchemaNode; else?: SchemaNode }>\n}\n\n/**\n * Object schema with ordered properties.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * properties: [],\n * }\n * ```\n */\nexport type ObjectSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'object'\n /**\n * Primitive type, always `'object'` for object schemas.\n */\n primitive: 'object'\n /**\n * Ordered object properties.\n */\n properties: Array<PropertyNode>\n /**\n * Additional object properties behavior:\n * - `true`: allow any value\n * - `false`: reject unknown properties\n * - `SchemaNode`: allow values that match that schema\n * - `undefined`: no additional properties constraint (open object)\n */\n additionalProperties?: SchemaNode | boolean\n /**\n * Pattern-based property schemas.\n */\n patternProperties?: Record<string, SchemaNode>\n /**\n * Schema that each property name must match.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * primitive: 'object',\n * properties: [],\n * propertyNames: { kind: 'Schema', type: 'string', primitive: 'string', pattern: '^[a-z]+$' },\n * }\n * ```\n */\n propertyNames?: SchemaNode\n /**\n * Minimum number of properties allowed.\n */\n min?: number\n /**\n * Maximum number of properties allowed.\n */\n max?: number\n /**\n * @deprecated Use `min`. Removed in Kubb v6.\n */\n minProperties?: number\n /**\n * @deprecated Use `max`. Removed in Kubb v6.\n */\n maxProperties?: number\n}\n\n/**\n * Array-like schema (`array` or `tuple`).\n *\n * @example\n * ```ts\n * const arraySchema: ArraySchemaNode = {\n * kind: 'Schema',\n * type: 'array',\n * items: [],\n * }\n * ```\n */\nexport type ArraySchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator (`array` or `tuple`).\n */\n type: 'array' | 'tuple'\n /**\n * Item schemas.\n */\n items?: Array<SchemaNode>\n /**\n * Tuple rest-item schema for elements beyond positional `items`.\n */\n rest?: SchemaNode\n /**\n * Minimum item count (or tuple length).\n */\n min?: number\n /**\n * Maximum item count (or tuple length).\n */\n max?: number\n /**\n * Whether all items must be unique.\n */\n unique?: boolean\n /**\n * At least `min` (default 1) and at most `max` items match `schema`. Visitors do not walk `schema`.\n */\n contains?: { schema: SchemaNode; min?: number; max?: number }\n}\n\n/**\n * Shared shape for union and intersection schemas.\n */\nexport type CompositeSchemaNodeBase = SchemaNodeBase & {\n /**\n * Member schemas.\n */\n members?: Array<SchemaNode>\n}\n\n/**\n * Union schema, often from `oneOf` or `anyOf`.\n *\n * @example\n * ```ts\n * const unionSchema: UnionSchemaNode = {\n * kind: 'Schema',\n * type: 'union',\n * members: [],\n * }\n * ```\n */\nexport type UnionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'union'\n /**\n * Discriminator property name for a polymorphic union.\n */\n discriminatorPropertyName?: string\n /**\n * How many union members must be valid.\n * - `'one'`: exactly one member, from `oneOf`\n * - `'any'`: any number of members, from `anyOf`\n */\n strategy?: 'one' | 'any'\n}\n\n/**\n * Intersection schema, often from `allOf`.\n *\n * @example\n * ```ts\n * const intersectionSchema: IntersectionSchemaNode = {\n * kind: 'Schema',\n * type: 'intersection',\n * members: [],\n * }\n * ```\n */\nexport type IntersectionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'intersection'\n}\n\n/** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */\nexport type NotSchemaNode = CompositeSchemaNodeBase & {\n /** Schema type discriminator. */\n type: 'not'\n}\n\n/**\n * One named enum item.\n */\nexport type EnumValueNode = {\n /**\n * Enum item name.\n */\n name: string\n /**\n * Enum item value.\n */\n value: string | number | boolean\n /**\n * Primitive type of the enum value.\n */\n primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>\n /**\n * Label for the enum item, taken from the `x-enumDescriptions` or\n * `x-enum-descriptions` vendor extension. A printer can render it as\n * a comment on the matching enum member.\n */\n description?: string\n}\n\n/**\n * Enum schema node.\n *\n * @example\n * ```ts\n * const enumSchema: EnumSchemaNode = {\n * kind: 'Schema',\n * type: 'enum',\n * enumValues: ['a', 'b'],\n * }\n * ```\n */\nexport type EnumSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'enum'\n /**\n * Enum values in simple form.\n */\n enumValues?: Array<string | number | boolean | null>\n /**\n * Enum values in named form.\n * If present, this is used instead of `enumValues`.\n */\n namedEnumValues?: Array<EnumValueNode>\n}\n\n/**\n * Reference schema that points to another schema definition.\n *\n * @example\n * ```ts\n * const refSchema: RefSchemaNode = {\n * kind: 'Schema',\n * type: 'ref',\n * ref: '#/components/schemas/Pet',\n * }\n * ```\n */\nexport type RefSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'ref'\n /**\n * Referenced schema name.\n * `null` means Kubb has processed this and determined there is no applicable name.\n */\n name?: string | null\n /**\n * Original `$ref` path, for example, `#/components/schemas/Order`.\n * Used to resolve names later.\n */\n ref?: string\n /**\n * Emitted name of the referenced schema when it differs from the pointer's last segment,\n * for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.\n * Resolve display and import names through `ast.ref.getName`, which prefers this field and\n * falls back to the pointer segment, then `name`.\n */\n targetName?: string\n /**\n * Pattern copied from a sibling `pattern` field.\n */\n pattern?: string\n /**\n * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)\n * can be read without following the reference. Populated during parsing when the\n * definition resolves, `null` when it can't or the ref is circular, and `undefined` when\n * resolution has not been attempted.\n */\n schema?: SchemaNode | null\n}\n\n/**\n * Datetime schema.\n *\n * @example\n * ```ts\n * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }\n * ```\n */\nexport type DatetimeSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'datetime'\n /**\n * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).\n */\n offset?: boolean\n /**\n * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).\n */\n local?: boolean\n}\n\n/**\n * Shared base for `date` and `time` schemas.\n */\nexport type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: T\n /**\n * Output representation in generated code.\n */\n representation: 'date' | 'string'\n}\n\n/**\n * Date schema node.\n *\n * @example\n * ```ts\n * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }\n * ```\n */\nexport type DateSchemaNode = TemporalSchemaNodeBase<'date'>\n\n/**\n * Time schema node.\n *\n * @example\n * ```ts\n * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }\n * ```\n */\nexport type TimeSchemaNode = TemporalSchemaNodeBase<'time'>\n\n/**\n * String schema node.\n *\n * @example\n * ```ts\n * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }\n * ```\n */\nexport type StringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'string'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n /**\n * Regex pattern.\n */\n pattern?: string\n /**\n * The value the string encodes, such as a JSON document or `base64` bytes. Visitors do not walk `schema`.\n */\n content?: {\n mediaType?: string\n encoding?: string\n schema?: SchemaNode\n }\n}\n\n/**\n * Numeric schema (`number`, `integer`, or `bigint`).\n *\n * @example\n * ```ts\n * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }\n * ```\n */\nexport type NumberSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'number' | 'integer' | 'bigint'\n /**\n * Minimum value.\n */\n min?: number\n /**\n * Maximum value.\n */\n max?: number\n /**\n * Bounds the value may not equal: it must be greater than `min` and less than `max`.\n */\n exclusive?: { min?: number; max?: number }\n /**\n * @deprecated Use `exclusive.min`. Removed in Kubb v6.\n */\n exclusiveMinimum?: number\n /**\n * @deprecated Use `exclusive.max`. Removed in Kubb v6.\n */\n exclusiveMaximum?: number\n /**\n * The value must be a multiple of this number.\n */\n multipleOf?: number\n}\n\n/**\n * Scalar schema with no extra constraints.\n *\n * @example\n * ```ts\n * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }\n * ```\n */\nexport type ScalarSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: Exclude<ScalarSchemaType, 'blob'>\n}\n\n/** Binary data schema node, such as a `format: binary` string. */\nexport type BlobSchemaNode = SchemaNodeBase & {\n type: 'blob'\n /** The media type and encoding of the bytes, from `contentMediaType` and `contentEncoding`. */\n content?: StringSchemaNode['content']\n}\n\n/**\n * URL schema node.\n * Can include a path template for template literal types.\n *\n * @example\n * ```ts\n * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }\n * ```\n */\nexport type UrlSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'url'\n /**\n * Path template, for example, `'/pets/{petId}'`.\n */\n path?: string\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Format-string schema for string-based formats that support length constraints.\n *\n * @example\n * ```ts\n * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }\n * ```\n */\nexport type FormatStringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'uuid' | 'email'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Mapping from schema type literals to concrete schema node types.\n * Used by `narrowSchema`.\n */\nexport type SchemaNodeByType = {\n object: ObjectSchemaNode\n array: ArraySchemaNode\n tuple: ArraySchemaNode\n union: UnionSchemaNode\n intersection: IntersectionSchemaNode\n not: NotSchemaNode\n enum: EnumSchemaNode\n ref: RefSchemaNode\n datetime: DatetimeSchemaNode\n date: DateSchemaNode\n time: TimeSchemaNode\n string: StringSchemaNode\n number: NumberSchemaNode\n integer: NumberSchemaNode\n bigint: NumberSchemaNode\n boolean: ScalarSchemaNode\n null: ScalarSchemaNode\n any: ScalarSchemaNode\n unknown: ScalarSchemaNode\n void: ScalarSchemaNode\n never: ScalarSchemaNode\n uuid: FormatStringSchemaNode\n email: FormatStringSchemaNode\n url: UrlSchemaNode\n ipv4: ScalarSchemaNode\n ipv6: ScalarSchemaNode\n blob: BlobSchemaNode\n}\n\n/**\n * Union of all schema node types.\n */\nexport type SchemaNode =\n | ObjectSchemaNode\n | ArraySchemaNode\n | UnionSchemaNode\n | IntersectionSchemaNode\n | NotSchemaNode\n | EnumSchemaNode\n | RefSchemaNode\n | DatetimeSchemaNode\n | DateSchemaNode\n | TimeSchemaNode\n | StringSchemaNode\n | NumberSchemaNode\n | UrlSchemaNode\n | FormatStringSchemaNode\n | ScalarSchemaNode\n | BlobSchemaNode\n\nexport type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & { properties?: Array<PropertyNode>; primitive?: 'object' }\nexport type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\nexport type CreateSchemaOutput<T extends CreateSchemaInput> = SchemaNodeByType[T['type']] & { kind: 'Schema' }\n\n/**\n * Maps schema `type` to its underlying `primitive`.\n * Primitive types map to themselves and special string formats map to `'string'`.\n * Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.\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`. Object schemas default\n * `properties` to an empty array, and `primitive` is 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 object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }\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: [], primitive: 'object', ...props, kind: nodeKinds.schema }\n }\n\n return { primitive: TYPE_TO_PRIMITIVE[props.type], ...props, kind: nodeKinds.schema }\n}\n"],"mappings":";;;;;;;;AA2oBA,MAAM,oBAA8E;CAClF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,MAAM;CACN,KAAK;CACL,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,KAAK;CACL,UAAU;CACV,MAAM;AACR;AAoBA,SAAgB,aAAa,OAAsC;CACjE,IAAI,MAAM,SAAS,UACjB,OAAO;EAAE,YAAY,CAAC;EAAG,WAAW;EAAU,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;CAGjF,OAAO;EAAE,WAAW,kBAAkB,MAAM;EAAO,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;AACtF"}
1
+ {"version":3,"file":"schema-BNlJ7DEx.cjs","names":["nodeKinds"],"sources":["../src/nodes/schema.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport type { BaseNode, DistributiveOmit } from './base.ts'\nimport type { ExternalDocs } from './input.ts'\nimport type { PropertyNode } from './property.ts'\n\n/**\n * Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.\n */\nexport type PrimitiveSchemaType =\n | 'string'\n | 'number'\n | 'integer'\n | 'bigint'\n | 'boolean'\n | 'null'\n | 'any'\n | 'unknown'\n | 'void'\n | 'never'\n | 'object'\n | 'array'\n | 'date'\n\n/**\n * All schema type strings, one per key of {@link SchemaNodeByType}.\n */\nexport type SchemaType = keyof SchemaNodeByType\n\n/**\n * Scalar schema types without extra object/array/ref structure or constraints. `blob` stays for compatibility, but a blob node is a `BlobSchemaNode`.\n */\nexport type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6'\n\n/**\n * Fields shared by all schema nodes.\n */\nexport type SchemaNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Schema'\n /**\n * Schema name for named definitions (for example, `\"Pet\"`).\n * Inline schemas omit this field.\n * `null` means Kubb has processed this and determined there is no applicable name.\n * `undefined` means the name has not been set yet.\n */\n name?: string | null\n /**\n * Short schema title.\n */\n title?: string\n /**\n * Schema description text.\n */\n description?: string\n /**\n * Whether `null` is allowed.\n */\n nullable?: boolean\n /**\n * Whether the field is optional.\n */\n optional?: boolean\n /**\n * Both optional and nullable (`optional` + `nullable`).\n */\n nullish?: boolean\n /**\n * Whether the schema is deprecated.\n */\n deprecated?: boolean\n /**\n * Whether the schema is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the schema is write-only.\n */\n writeOnly?: boolean\n /**\n * Default value.\n */\n default?: unknown\n /**\n * Example values from an `examples` array.\n */\n examples?: Array<unknown>\n /**\n * Base primitive type.\n * For example, this is `'string'` for a `uuid` schema.\n */\n primitive?: PrimitiveSchemaType\n /**\n * Schema `format` value.\n */\n format?: string\n externalDocs?: ExternalDocs\n /** Vendor extensions (`x-*` keys) from the source schema, copied as-is. */\n extensions?: Record<string, unknown>\n /**\n * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means \"key is present\".\n * Visitors do not walk it.\n */\n conditionals?: Array<{ if: SchemaNode; then?: SchemaNode; else?: SchemaNode }>\n}\n\n/**\n * Object schema with ordered properties.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * properties: [],\n * }\n * ```\n */\nexport type ObjectSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'object'\n /**\n * Primitive type, always `'object'` for object schemas.\n */\n primitive: 'object'\n /**\n * Ordered object properties.\n */\n properties: Array<PropertyNode>\n /**\n * Additional object properties behavior:\n * - `true`: allow any value\n * - `false`: reject unknown properties\n * - `SchemaNode`: allow values that match that schema\n * - `undefined`: no additional properties constraint (open object)\n */\n additionalProperties?: SchemaNode | boolean\n /**\n * Pattern-based property schemas.\n */\n patternProperties?: Record<string, SchemaNode>\n /**\n * Schema that each property name must match.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * primitive: 'object',\n * properties: [],\n * propertyNames: { kind: 'Schema', type: 'string', primitive: 'string', pattern: '^[a-z]+$' },\n * }\n * ```\n */\n propertyNames?: SchemaNode\n /**\n * Minimum number of properties allowed.\n */\n min?: number\n /**\n * Maximum number of properties allowed.\n */\n max?: number\n /**\n * @deprecated Use `min`. Removed in Kubb v6.\n */\n minProperties?: number\n /**\n * @deprecated Use `max`. Removed in Kubb v6.\n */\n maxProperties?: number\n}\n\n/**\n * Array-like schema (`array` or `tuple`).\n *\n * @example\n * ```ts\n * const arraySchema: ArraySchemaNode = {\n * kind: 'Schema',\n * type: 'array',\n * items: [],\n * }\n * ```\n */\nexport type ArraySchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator (`array` or `tuple`).\n */\n type: 'array' | 'tuple'\n /**\n * Item schemas.\n */\n items?: Array<SchemaNode>\n /**\n * Tuple rest-item schema for elements beyond positional `items`.\n */\n rest?: SchemaNode\n /**\n * Minimum item count (or tuple length).\n */\n min?: number\n /**\n * Maximum item count (or tuple length).\n */\n max?: number\n /**\n * Whether all items must be unique.\n */\n unique?: boolean\n /**\n * At least `min` (default 1) and at most `max` items match `schema`. Visitors do not walk `schema`.\n */\n contains?: { schema: SchemaNode; min?: number; max?: number }\n}\n\n/**\n * Shared shape for union and intersection schemas.\n */\nexport type CompositeSchemaNodeBase = SchemaNodeBase & {\n /**\n * Member schemas.\n */\n members?: Array<SchemaNode>\n}\n\n/**\n * Union schema, often from `oneOf` or `anyOf`.\n *\n * @example\n * ```ts\n * const unionSchema: UnionSchemaNode = {\n * kind: 'Schema',\n * type: 'union',\n * members: [],\n * }\n * ```\n */\nexport type UnionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'union'\n /**\n * Discriminator property name for a polymorphic union.\n */\n discriminatorPropertyName?: string\n /**\n * How many union members must be valid.\n * - `'one'`: exactly one member, from `oneOf`\n * - `'any'`: any number of members, from `anyOf`\n */\n strategy?: 'one' | 'any'\n}\n\n/**\n * Intersection schema, often from `allOf`.\n *\n * @example\n * ```ts\n * const intersectionSchema: IntersectionSchemaNode = {\n * kind: 'Schema',\n * type: 'intersection',\n * members: [],\n * }\n * ```\n */\nexport type IntersectionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'intersection'\n}\n\n/** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */\nexport type NotSchemaNode = CompositeSchemaNodeBase & {\n /** Schema type discriminator. */\n type: 'not'\n}\n\n/**\n * One named enum item.\n */\nexport type EnumValueNode = {\n /**\n * Enum item name.\n */\n name: string\n /**\n * Enum item value.\n */\n value: string | number | boolean\n /**\n * Primitive type of the enum value.\n */\n primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>\n /**\n * Label for the enum item, taken from the `x-enumDescriptions` or\n * `x-enum-descriptions` vendor extension. A printer can render it as\n * a comment on the matching enum member.\n */\n description?: string\n}\n\n/**\n * Enum schema node.\n *\n * @example\n * ```ts\n * const enumSchema: EnumSchemaNode = {\n * kind: 'Schema',\n * type: 'enum',\n * enumValues: ['a', 'b'],\n * }\n * ```\n */\nexport type EnumSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'enum'\n /**\n * Enum values in simple form.\n */\n enumValues?: Array<string | number | boolean | null>\n /**\n * Enum values in named form.\n * If present, this is used instead of `enumValues`.\n */\n namedEnumValues?: Array<EnumValueNode>\n}\n\n/**\n * Reference schema that points to another schema definition.\n *\n * @example\n * ```ts\n * const refSchema: RefSchemaNode = {\n * kind: 'Schema',\n * type: 'ref',\n * ref: '#/components/schemas/Pet',\n * }\n * ```\n */\nexport type RefSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'ref'\n /**\n * Referenced schema name.\n * `null` means Kubb has processed this and determined there is no applicable name.\n */\n name?: string | null\n /**\n * Original `$ref` path, for example, `#/components/schemas/Order`.\n * Used to resolve names later.\n */\n ref?: string\n /**\n * Emitted name of the referenced schema when it differs from the pointer's last segment,\n * for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.\n * Resolve display and import names through `ast.ref.getName`, which prefers this field and\n * falls back to the pointer segment, then `name`.\n */\n targetName?: string\n /**\n * Pattern copied from a sibling `pattern` field.\n */\n pattern?: string\n /**\n * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)\n * can be read without following the reference. Populated during parsing when the\n * definition resolves, `null` when it can't or the ref is circular, and `undefined` when\n * resolution has not been attempted.\n */\n schema?: SchemaNode | null\n}\n\n/**\n * Datetime schema.\n *\n * @example\n * ```ts\n * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }\n * ```\n */\nexport type DatetimeSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'datetime'\n /**\n * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).\n */\n offset?: boolean\n /**\n * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).\n */\n local?: boolean\n}\n\n/**\n * Shared base for `date` and `time` schemas.\n */\nexport type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: T\n /**\n * Output representation in generated code.\n */\n representation: 'date' | 'string'\n}\n\n/**\n * Date schema node.\n *\n * @example\n * ```ts\n * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }\n * ```\n */\nexport type DateSchemaNode = TemporalSchemaNodeBase<'date'>\n\n/**\n * Time schema node.\n *\n * @example\n * ```ts\n * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }\n * ```\n */\nexport type TimeSchemaNode = TemporalSchemaNodeBase<'time'>\n\n/**\n * String schema node.\n *\n * @example\n * ```ts\n * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }\n * ```\n */\nexport type StringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'string'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n /**\n * Regex pattern.\n */\n pattern?: string\n /**\n * The value the string encodes, such as a JSON document or `base64` bytes. Visitors do not walk `schema`.\n */\n content?: {\n mediaType?: string\n encoding?: string\n schema?: SchemaNode\n }\n}\n\n/**\n * Numeric schema (`number`, `integer`, or `bigint`).\n *\n * @example\n * ```ts\n * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }\n * ```\n */\nexport type NumberSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'number' | 'integer' | 'bigint'\n /**\n * Minimum value.\n */\n min?: number\n /**\n * Maximum value.\n */\n max?: number\n /**\n * Bounds the value may not equal: it must be greater than `min` and less than `max`.\n */\n exclusive?: { min?: number; max?: number }\n /**\n * @deprecated Use `exclusive.min`. Removed in Kubb v6.\n */\n exclusiveMinimum?: number\n /**\n * @deprecated Use `exclusive.max`. Removed in Kubb v6.\n */\n exclusiveMaximum?: number\n /**\n * The value must be a multiple of this number.\n */\n multipleOf?: number\n}\n\n/**\n * Scalar schema with no extra constraints.\n *\n * @example\n * ```ts\n * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }\n * ```\n */\nexport type ScalarSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: Exclude<ScalarSchemaType, 'blob'>\n}\n\n/** Binary data schema node, such as a `format: binary` string. */\nexport type BlobSchemaNode = SchemaNodeBase & {\n type: 'blob'\n /** The media type and encoding of the bytes, from `contentMediaType` and `contentEncoding`. */\n content?: StringSchemaNode['content']\n}\n\n/**\n * URL schema node.\n * Can include a path template for template literal types.\n *\n * @example\n * ```ts\n * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }\n * ```\n */\nexport type UrlSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'url'\n /**\n * Path template, for example, `'/pets/{petId}'`.\n */\n path?: string\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Format-string schema for string-based formats that support length constraints.\n *\n * @example\n * ```ts\n * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }\n * ```\n */\nexport type FormatStringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'uuid' | 'email'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Mapping from schema type literals to concrete schema node types.\n * Used by `narrowSchema`.\n */\nexport type SchemaNodeByType = {\n object: ObjectSchemaNode\n array: ArraySchemaNode\n tuple: ArraySchemaNode\n union: UnionSchemaNode\n intersection: IntersectionSchemaNode\n not: NotSchemaNode\n enum: EnumSchemaNode\n ref: RefSchemaNode\n datetime: DatetimeSchemaNode\n date: DateSchemaNode\n time: TimeSchemaNode\n string: StringSchemaNode\n number: NumberSchemaNode\n integer: NumberSchemaNode\n bigint: NumberSchemaNode\n boolean: ScalarSchemaNode\n null: ScalarSchemaNode\n any: ScalarSchemaNode\n unknown: ScalarSchemaNode\n void: ScalarSchemaNode\n never: ScalarSchemaNode\n uuid: FormatStringSchemaNode\n email: FormatStringSchemaNode\n url: UrlSchemaNode\n ipv4: ScalarSchemaNode\n ipv6: ScalarSchemaNode\n blob: BlobSchemaNode\n}\n\n/**\n * Union of all schema node types.\n */\nexport type SchemaNode =\n | ObjectSchemaNode\n | ArraySchemaNode\n | UnionSchemaNode\n | IntersectionSchemaNode\n | NotSchemaNode\n | EnumSchemaNode\n | RefSchemaNode\n | DatetimeSchemaNode\n | DateSchemaNode\n | TimeSchemaNode\n | StringSchemaNode\n | NumberSchemaNode\n | UrlSchemaNode\n | FormatStringSchemaNode\n | ScalarSchemaNode\n | BlobSchemaNode\n\nexport type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & { properties?: Array<PropertyNode>; primitive?: 'object' }\nexport type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\nexport type CreateSchemaOutput<T extends CreateSchemaInput> = SchemaNodeByType[T['type']] & { kind: 'Schema' }\n\n/**\n * Maps schema `type` to its underlying `primitive`.\n * Primitive types map to themselves and special string formats map to `'string'`.\n * Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.\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`. Object schemas default\n * `properties` to an empty array, and `primitive` is 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 object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }\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: [], primitive: 'object', ...props, kind: nodeKinds.schema }\n }\n\n return { primitive: TYPE_TO_PRIMITIVE[props.type], ...props, kind: nodeKinds.schema }\n}\n"],"mappings":";;;;;;;;AA2oBA,MAAM,oBAA8E;CAClF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,MAAM;CACN,KAAK;CACL,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,KAAK;CACL,UAAU;CACV,MAAM;AACR;AAoBA,SAAgB,aAAa,OAAsC;CACjE,IAAI,MAAM,SAAS,UACjB,OAAO;EAAE,YAAY,CAAC;EAAG,WAAW;EAAU,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;CAGjF,OAAO;EAAE,WAAW,kBAAkB,MAAM;EAAO,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;AACtF"}
@@ -1,10 +1,10 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_optionality = require("./optionality-C-qULYxo.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CbDVJ4mO.cjs");
2
+ const require_optionality = require("./optionality-DZfBHn-q.cjs");
3
3
  const require_constants = require("./constants-BCRkFAiy.cjs");
4
- const require_guards = require("./guards-4drgx10i.cjs");
5
- const require_visitor = require("./visitor-DT712cxr.cjs");
6
- const require_ref = require("./ref-CGeCLkAk.cjs");
7
- const require_promise = require("./promise-DMQPWp6M.cjs");
4
+ const require_guards = require("./guards-C6i6KL0l.cjs");
5
+ const require_visitor = require("./visitor-DVsp084s.cjs");
6
+ const require_ref = require("./ref-B4s-S3RK.cjs");
7
+ const require_promise = require("./promise-srRwNz0i.cjs");
8
8
  // src/schema/is.ts
9
9
  const plainStringTypes = /* @__PURE__ */ new Set([
10
10
  "string",
@@ -211,4 +211,4 @@ Object.defineProperty(exports, "schema_exports", {
211
211
  }
212
212
  });
213
213
 
214
- //# sourceMappingURL=schema-CMe0Dvgd.cjs.map
214
+ //# sourceMappingURL=schema-aUVOrRjr.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-CMe0Dvgd.cjs","names":["narrowSchema","mergeSchema","memo"],"sources":["../src/schema/is.ts","../src/utils/schemaProperties.ts","../src/schema/index.ts"],"sourcesContent":["import { narrowSchema } from '../guards.ts'\nimport type { SchemaNode, SchemaType } from '../nodes/schema.ts'\nimport { mergeSchema } from '../ref/index.ts'\n\n/** `string` prints as a plain `string`, `text` is a non-blob string primitive, `const` a one-value enum, `enumLike` an enum or union of them, `untyped` is `void`, `any` or `unknown`. */\nexport type SchemaKind = 'binary' | 'string' | 'text' | 'scalar' | 'const' | 'enumLike' | 'untyped'\n\n/** `ref` jumps to a resolved ref's target, `array` matches when some item matches. */\nexport type SchemaFollow = 'ref' | 'array'\n\nexport type IsOptions = {\n /** Links to look through. Following repeats and stops on a ref cycle. */\n follow?: ReadonlyArray<SchemaFollow>\n}\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'])\nconst scalarTypes = new Set<SchemaType>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst untypedTypes = new Set<SchemaType>(['void', 'any', 'unknown'])\n\nconst kinds: Record<SchemaKind, (node: SchemaNode, test: (child: SchemaNode) => boolean) => boolean> = {\n binary: (node) => node.type === 'blob',\n string: (node) => {\n if (plainStringTypes.has(node.type)) return true\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n return temporal ? temporal.representation !== 'date' : false\n },\n text: (node) => node.type !== 'blob' && node.primitive === 'string',\n scalar: (node) => scalarTypes.has(node.type),\n const: (node) => node.type === 'enum' && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,\n enumLike: (node, test) => node.type === 'enum' || (node.type === 'union' && !!node.members?.length && node.members.every(test)),\n untyped: (node) => untypedTypes.has(node.type),\n}\n\n/** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */\nexport function is(node: SchemaNode, kind: SchemaKind, { follow = [] }: IsOptions = {}): boolean {\n // `path` holds the ref targets above `current`, so a cycle stops without hiding a target a sibling branch reaches.\n const test = (current: SchemaNode, path: ReadonlySet<SchemaNode>): boolean => {\n if (follow.includes('ref') && current.type === 'ref' && current.schema) {\n return !path.has(current.schema) && test(mergeSchema(current), new Set(path).add(current.schema))\n }\n const child = (next: SchemaNode) => test(next, path)\n return kinds[kind](current, child) || (follow.includes('array') && current.type === 'array' && (current.items ?? []).some(child))\n }\n\n return test(node, new Set())\n}\n","import { memo } from '@internals/utils'\nimport type { PropertyNode } from '../nodes/property.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Finds every matching property exposed by an object, resolved reference, or intersection.\n *\n * References are followed through their parsed `schema`. Circular references terminate without\n * revisiting a node. Unions are not traversed because a property on one branch does not describe\n * every branch.\n *\n * @example Faker discriminator narrowing\n * ```ts\n * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>\n * getSchemaLiteralValues(schema),\n * )\n * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`\n * ```\n *\n * @example Zod discriminated unions\n * ```ts\n * const canDiscriminate = union.members?.every(\n * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,\n * )\n * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`\n * ```\n *\n * @example TypeScript property lookup\n * ```ts\n * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })\n * const statusSchemas = properties.map((property) => print(property.schema))\n * ```\n */\nexport function resolveSchemaProperties({ node, propertyName }: { node: SchemaNode; propertyName: string }): ReadonlyArray<PropertyNode> {\n const properties: Array<PropertyNode> = []\n walkSchema(node, 'intersection', (current) => {\n if (current.type !== 'object') return\n const property = current.properties.find((candidate) => candidate.name === propertyName)\n if (property) properties.push(property)\n })\n return properties\n}\n\nfunction walkSchema(node: SchemaNode, through: 'union' | 'intersection', visit: (schema: SchemaNode) => void): void {\n const visited = new WeakSet<SchemaNode>()\n\n function walk(current: SchemaNode | null | undefined): void {\n if (!current || visited.has(current)) return\n visited.add(current)\n visit(current)\n\n if (current.type === 'ref') return walk(current.schema)\n if (current.type === through) for (const member of current.members ?? []) walk(member)\n }\n\n walk(node)\n}\n\n/**\n * Reads the unique literal values represented by an enum, resolved reference, or union.\n *\n * Named enum values take precedence over simple enum values, matching how renderers consume\n * `EnumSchemaNode`.\n *\n * @example\n * ```ts\n * const values = getSchemaLiteralValues(enumNode)\n * // ['cat', 'dog']\n * ```\n */\nexport function getSchemaLiteralValues(node: SchemaNode): ReadonlyArray<LiteralValue> {\n return memo(literalValues, node, () => {\n const values = new Set<LiteralValue>()\n walkSchema(node, 'union', (current) => {\n if (current.type !== 'enum') return\n for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value)\n })\n return Object.freeze([...values])\n })\n}\n\nexport type LiteralValue = string | number | boolean | null\n\n// Printers read an enum's values each time they print it.\nconst literalValues = memo.create<SchemaNode, ReadonlyArray<LiteralValue>>({ weak: true })\n\n// Names of every property an object, resolved reference, or intersection exposes.\nfunction collectPropertyNames(node: SchemaNode): Set<string> {\n const names = new Set<string>()\n walkSchema(node, 'intersection', (current) => {\n if (current.type === 'object') for (const property of current.properties) names.add(property.name)\n })\n return names\n}\n\n/**\n * Infers an implicit discriminator: a property every member exposes with a distinct single\n * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.\n */\nexport function inferDiscriminatorPropertyName(members: ReadonlyArray<SchemaNode>): string | undefined {\n if (members.length < 2) return undefined\n\n let candidates: Set<string> | undefined\n for (const member of members) {\n const names = collectPropertyNames(member)\n candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names\n }\n\n for (const name of candidates ?? []) {\n const values = members.map((member) => {\n const literals = new Set(resolveSchemaProperties({ node: member, propertyName: name }).flatMap((property) => getSchemaLiteralValues(property.schema)))\n return literals.size === 1 ? [...literals][0] : undefined\n })\n\n if (values.every((value) => value !== undefined) && new Set(values).size === members.length) {\n return name\n }\n }\n\n return undefined\n}\n","export { applyOptionality } from '../optionality.ts'\nexport { schemaTypes as types } from '../constants.ts'\nexport { narrowSchema as narrow } from '../guards.ts'\nexport { findSchema as find } from '../visitor.ts'\nexport { getEmbeddedJson } from './embeddedJson.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { is } from './is.ts'\n\nexport { is } from './is.ts'\nexport type { IsOptions, SchemaFollow, SchemaKind } from './is.ts'\nexport {\n getSchemaLiteralValues as getLiterals,\n inferDiscriminatorPropertyName as inferDiscriminator,\n resolveSchemaProperties as findProperties,\n} from '../utils/schemaProperties.ts'\n\n/** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */\nexport function isString(node: SchemaNode): boolean {\n return is(node, 'string')\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,mCAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAC;AAC3F,MAAM,8BAAc,IAAI,IAAgB;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,+BAAe,IAAI,IAAgB;CAAC;CAAQ;CAAO;AAAS,CAAC;AAEnE,MAAM,QAAiG;CACrG,SAAS,SAAS,KAAK,SAAS;CAChC,SAAS,SAAS;EAChB,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAAG,OAAO;EAC5C,MAAM,WAAWA,eAAAA,aAAa,MAAM,MAAM,KAAKA,eAAAA,aAAa,MAAM,MAAM;EACxE,OAAO,WAAW,SAAS,mBAAmB,SAAS;CACzD;CACA,OAAO,SAAS,KAAK,SAAS,UAAU,KAAK,cAAc;CAC3D,SAAS,SAAS,YAAY,IAAI,KAAK,IAAI;CAC3C,QAAQ,SAAS,KAAK,SAAS,WAAW,KAAK,mBAAmB,KAAK,cAAc,CAAC,EAAA,CAAG,WAAW;CACpG,WAAW,MAAM,SAAS,KAAK,SAAS,UAAW,KAAK,SAAS,WAAW,CAAC,CAAC,KAAK,SAAS,UAAU,KAAK,QAAQ,MAAM,IAAI;CAC7H,UAAU,SAAS,aAAa,IAAI,KAAK,IAAI;AAC/C;;AAGA,SAAgB,GAAG,MAAkB,MAAkB,EAAE,SAAS,CAAC,MAAiB,CAAC,GAAY;CAE/F,MAAM,QAAQ,SAAqB,SAA2C;EAC5E,IAAI,OAAO,SAAS,KAAK,KAAK,QAAQ,SAAS,SAAS,QAAQ,QAC9D,OAAO,CAAC,KAAK,IAAI,QAAQ,MAAM,KAAK,KAAKC,YAAAA,YAAY,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,QAAQ,MAAM,CAAC;EAElG,MAAM,SAAS,SAAqB,KAAK,MAAM,IAAI;EACnD,OAAO,MAAM,KAAK,CAAC,SAAS,KAAK,KAAM,OAAO,SAAS,OAAO,KAAK,QAAQ,SAAS,YAAY,QAAQ,SAAS,CAAC,EAAA,CAAG,KAAK,KAAK;CACjI;CAEA,OAAO,KAAK,sBAAM,IAAI,IAAI,CAAC;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BA,SAAgB,wBAAwB,EAAE,MAAM,gBAAyF;CACvI,MAAM,aAAkC,CAAC;CACzC,WAAW,MAAM,iBAAiB,YAAY;EAC5C,IAAI,QAAQ,SAAS,UAAU;EAC/B,MAAM,WAAW,QAAQ,WAAW,MAAM,cAAc,UAAU,SAAS,YAAY;EACvF,IAAI,UAAU,WAAW,KAAK,QAAQ;CACxC,CAAC;CACD,OAAO;AACT;AAEA,SAAS,WAAW,MAAkB,SAAmC,OAA2C;CAClH,MAAM,0BAAU,IAAI,QAAoB;CAExC,SAAS,KAAK,SAA8C;EAC1D,IAAI,CAAC,WAAW,QAAQ,IAAI,OAAO,GAAG;EACtC,QAAQ,IAAI,OAAO;EACnB,MAAM,OAAO;EAEb,IAAI,QAAQ,SAAS,OAAO,OAAO,KAAK,QAAQ,MAAM;EACtD,IAAI,QAAQ,SAAS,SAAS,KAAK,MAAM,UAAU,QAAQ,WAAW,CAAC,GAAG,KAAK,MAAM;CACvF;CAEA,KAAK,IAAI;AACX;;;;;;;;;;;;;AAcA,SAAgB,uBAAuB,MAA+C;CACpF,OAAOC,gBAAAA,KAAK,eAAe,YAAY;EACrC,MAAM,yBAAS,IAAI,IAAkB;EACrC,WAAW,MAAM,UAAU,YAAY;GACrC,IAAI,QAAQ,SAAS,QAAQ;GAC7B,KAAK,MAAM,EAAE,WAAW,QAAQ,mBAAmB,QAAQ,YAAY,KAAK,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,OAAO,IAAI,KAAK;EAC5H,CAAC;EACD,OAAO,OAAO,OAAO,CAAC,GAAG,MAAM,CAAC;CAClC,CAAC;AACH;AAKA,MAAM,gBAAgBA,gBAAAA,KAAK,OAAgD,EAAE,MAAM,KAAK,CAAC;AAGzF,SAAS,qBAAqB,MAA+B;CAC3D,MAAM,wBAAQ,IAAI,IAAY;CAC9B,WAAW,MAAM,iBAAiB,YAAY;EAC5C,IAAI,QAAQ,SAAS,UAAU,KAAK,MAAM,YAAY,QAAQ,YAAY,MAAM,IAAI,SAAS,IAAI;CACnG,CAAC;CACD,OAAO;AACT;;;;;AAMA,SAAgB,+BAA+B,SAAwD;CACrG,IAAI,QAAQ,SAAS,GAAG,OAAO,KAAA;CAE/B,IAAI;CACJ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,QAAQ,qBAAqB,MAAM;EACzC,aAAa,aAAa,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,SAAS,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI;CACzF;CAEA,KAAK,MAAM,QAAQ,cAAc,CAAC,GAAG;EACnC,MAAM,SAAS,QAAQ,KAAK,WAAW;GACrC,MAAM,WAAW,IAAI,IAAI,wBAAwB;IAAE,MAAM;IAAQ,cAAc;GAAK,CAAC,CAAC,CAAC,SAAS,aAAa,uBAAuB,SAAS,MAAM,CAAC,CAAC;GACrJ,OAAO,SAAS,SAAS,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,KAAA;EAClD,CAAC;EAED,IAAI,OAAO,OAAO,UAAU,UAAU,KAAA,CAAS,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,SAAS,QAAQ,QACnF,OAAO;CAEX;AAGF;;;;;;;;;;;;;;;ACvGA,SAAgB,SAAS,MAA2B;CAClD,OAAO,GAAG,MAAM,QAAQ;AAC1B"}
1
+ {"version":3,"file":"schema-aUVOrRjr.cjs","names":["narrowSchema","mergeSchema","memo"],"sources":["../src/schema/is.ts","../src/utils/schemaProperties.ts","../src/schema/index.ts"],"sourcesContent":["import { narrowSchema } from '../guards.ts'\nimport type { SchemaNode, SchemaType } from '../nodes/schema.ts'\nimport { mergeSchema } from '../ref/index.ts'\n\n/** `string` prints as a plain `string`, `text` is a non-blob string primitive, `const` a one-value enum, `enumLike` an enum or union of them, `untyped` is `void`, `any` or `unknown`. */\nexport type SchemaKind = 'binary' | 'string' | 'text' | 'scalar' | 'const' | 'enumLike' | 'untyped'\n\n/** `ref` jumps to a resolved ref's target, `array` matches when some item matches. */\nexport type SchemaFollow = 'ref' | 'array'\n\nexport type IsOptions = {\n /** Links to look through. Following repeats and stops on a ref cycle. */\n follow?: ReadonlyArray<SchemaFollow>\n}\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'])\nconst scalarTypes = new Set<SchemaType>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst untypedTypes = new Set<SchemaType>(['void', 'any', 'unknown'])\n\nconst kinds: Record<SchemaKind, (node: SchemaNode, test: (child: SchemaNode) => boolean) => boolean> = {\n binary: (node) => node.type === 'blob',\n string: (node) => {\n if (plainStringTypes.has(node.type)) return true\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n return temporal ? temporal.representation !== 'date' : false\n },\n text: (node) => node.type !== 'blob' && node.primitive === 'string',\n scalar: (node) => scalarTypes.has(node.type),\n const: (node) => node.type === 'enum' && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,\n enumLike: (node, test) => node.type === 'enum' || (node.type === 'union' && !!node.members?.length && node.members.every(test)),\n untyped: (node) => untypedTypes.has(node.type),\n}\n\n/** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */\nexport function is(node: SchemaNode, kind: SchemaKind, { follow = [] }: IsOptions = {}): boolean {\n // `path` holds the ref targets above `current`, so a cycle stops without hiding a target a sibling branch reaches.\n const test = (current: SchemaNode, path: ReadonlySet<SchemaNode>): boolean => {\n if (follow.includes('ref') && current.type === 'ref' && current.schema) {\n return !path.has(current.schema) && test(mergeSchema(current), new Set(path).add(current.schema))\n }\n const child = (next: SchemaNode) => test(next, path)\n return kinds[kind](current, child) || (follow.includes('array') && current.type === 'array' && (current.items ?? []).some(child))\n }\n\n return test(node, new Set())\n}\n","import { memo } from '@internals/utils'\nimport type { PropertyNode } from '../nodes/property.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Finds every matching property exposed by an object, resolved reference, or intersection.\n *\n * References are followed through their parsed `schema`. Circular references terminate without\n * revisiting a node. Unions are not traversed because a property on one branch does not describe\n * every branch.\n *\n * @example Faker discriminator narrowing\n * ```ts\n * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>\n * getSchemaLiteralValues(schema),\n * )\n * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`\n * ```\n *\n * @example Zod discriminated unions\n * ```ts\n * const canDiscriminate = union.members?.every(\n * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,\n * )\n * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`\n * ```\n *\n * @example TypeScript property lookup\n * ```ts\n * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })\n * const statusSchemas = properties.map((property) => print(property.schema))\n * ```\n */\nexport function resolveSchemaProperties({ node, propertyName }: { node: SchemaNode; propertyName: string }): ReadonlyArray<PropertyNode> {\n const properties: Array<PropertyNode> = []\n walkSchema(node, 'intersection', (current) => {\n if (current.type !== 'object') return\n const property = current.properties.find((candidate) => candidate.name === propertyName)\n if (property) properties.push(property)\n })\n return properties\n}\n\nfunction walkSchema(node: SchemaNode, through: 'union' | 'intersection', visit: (schema: SchemaNode) => void): void {\n const visited = new WeakSet<SchemaNode>()\n\n function walk(current: SchemaNode | null | undefined): void {\n if (!current || visited.has(current)) return\n visited.add(current)\n visit(current)\n\n if (current.type === 'ref') return walk(current.schema)\n if (current.type === through) for (const member of current.members ?? []) walk(member)\n }\n\n walk(node)\n}\n\n/**\n * Reads the unique literal values represented by an enum, resolved reference, or union.\n *\n * Named enum values take precedence over simple enum values, matching how renderers consume\n * `EnumSchemaNode`.\n *\n * @example\n * ```ts\n * const values = getSchemaLiteralValues(enumNode)\n * // ['cat', 'dog']\n * ```\n */\nexport function getSchemaLiteralValues(node: SchemaNode): ReadonlyArray<LiteralValue> {\n return memo(literalValues, node, () => {\n const values = new Set<LiteralValue>()\n walkSchema(node, 'union', (current) => {\n if (current.type !== 'enum') return\n for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value)\n })\n return Object.freeze([...values])\n })\n}\n\nexport type LiteralValue = string | number | boolean | null\n\n// Printers read an enum's values each time they print it.\nconst literalValues = memo.create<SchemaNode, ReadonlyArray<LiteralValue>>({ weak: true })\n\n// Names of every property an object, resolved reference, or intersection exposes.\nfunction collectPropertyNames(node: SchemaNode): Set<string> {\n const names = new Set<string>()\n walkSchema(node, 'intersection', (current) => {\n if (current.type === 'object') for (const property of current.properties) names.add(property.name)\n })\n return names\n}\n\n/**\n * Infers an implicit discriminator: a property every member exposes with a distinct single\n * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.\n */\nexport function inferDiscriminatorPropertyName(members: ReadonlyArray<SchemaNode>): string | undefined {\n if (members.length < 2) return undefined\n\n let candidates: Set<string> | undefined\n for (const member of members) {\n const names = collectPropertyNames(member)\n candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names\n }\n\n for (const name of candidates ?? []) {\n const values = members.map((member) => {\n const literals = new Set(resolveSchemaProperties({ node: member, propertyName: name }).flatMap((property) => getSchemaLiteralValues(property.schema)))\n return literals.size === 1 ? [...literals][0] : undefined\n })\n\n if (values.every((value) => value !== undefined) && new Set(values).size === members.length) {\n return name\n }\n }\n\n return undefined\n}\n","export { applyOptionality } from '../optionality.ts'\nexport { schemaTypes as types } from '../constants.ts'\nexport { narrowSchema as narrow } from '../guards.ts'\nexport { findSchema as find } from '../visitor.ts'\nexport { getEmbeddedJson } from './embeddedJson.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { is } from './is.ts'\n\nexport { is } from './is.ts'\nexport type { IsOptions, SchemaFollow, SchemaKind } from './is.ts'\nexport {\n getSchemaLiteralValues as getLiterals,\n inferDiscriminatorPropertyName as inferDiscriminator,\n resolveSchemaProperties as findProperties,\n} from '../utils/schemaProperties.ts'\n\n/** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */\nexport function isString(node: SchemaNode): boolean {\n return is(node, 'string')\n}\n"],"mappings":";;;;;;;;AAeA,MAAM,mCAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAC;AAC3F,MAAM,8BAAc,IAAI,IAAgB;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,+BAAe,IAAI,IAAgB;CAAC;CAAQ;CAAO;AAAS,CAAC;AAEnE,MAAM,QAAiG;CACrG,SAAS,SAAS,KAAK,SAAS;CAChC,SAAS,SAAS;EAChB,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAAG,OAAO;EAC5C,MAAM,WAAWA,eAAAA,aAAa,MAAM,MAAM,KAAKA,eAAAA,aAAa,MAAM,MAAM;EACxE,OAAO,WAAW,SAAS,mBAAmB,SAAS;CACzD;CACA,OAAO,SAAS,KAAK,SAAS,UAAU,KAAK,cAAc;CAC3D,SAAS,SAAS,YAAY,IAAI,KAAK,IAAI;CAC3C,QAAQ,SAAS,KAAK,SAAS,WAAW,KAAK,mBAAmB,KAAK,cAAc,CAAC,EAAA,CAAG,WAAW;CACpG,WAAW,MAAM,SAAS,KAAK,SAAS,UAAW,KAAK,SAAS,WAAW,CAAC,CAAC,KAAK,SAAS,UAAU,KAAK,QAAQ,MAAM,IAAI;CAC7H,UAAU,SAAS,aAAa,IAAI,KAAK,IAAI;AAC/C;;AAGA,SAAgB,GAAG,MAAkB,MAAkB,EAAE,SAAS,CAAC,MAAiB,CAAC,GAAY;CAE/F,MAAM,QAAQ,SAAqB,SAA2C;EAC5E,IAAI,OAAO,SAAS,KAAK,KAAK,QAAQ,SAAS,SAAS,QAAQ,QAC9D,OAAO,CAAC,KAAK,IAAI,QAAQ,MAAM,KAAK,KAAKC,YAAAA,YAAY,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,QAAQ,MAAM,CAAC;EAElG,MAAM,SAAS,SAAqB,KAAK,MAAM,IAAI;EACnD,OAAO,MAAM,KAAK,CAAC,SAAS,KAAK,KAAM,OAAO,SAAS,OAAO,KAAK,QAAQ,SAAS,YAAY,QAAQ,SAAS,CAAC,EAAA,CAAG,KAAK,KAAK;CACjI;CAEA,OAAO,KAAK,sBAAM,IAAI,IAAI,CAAC;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BA,SAAgB,wBAAwB,EAAE,MAAM,gBAAyF;CACvI,MAAM,aAAkC,CAAC;CACzC,WAAW,MAAM,iBAAiB,YAAY;EAC5C,IAAI,QAAQ,SAAS,UAAU;EAC/B,MAAM,WAAW,QAAQ,WAAW,MAAM,cAAc,UAAU,SAAS,YAAY;EACvF,IAAI,UAAU,WAAW,KAAK,QAAQ;CACxC,CAAC;CACD,OAAO;AACT;AAEA,SAAS,WAAW,MAAkB,SAAmC,OAA2C;CAClH,MAAM,0BAAU,IAAI,QAAoB;CAExC,SAAS,KAAK,SAA8C;EAC1D,IAAI,CAAC,WAAW,QAAQ,IAAI,OAAO,GAAG;EACtC,QAAQ,IAAI,OAAO;EACnB,MAAM,OAAO;EAEb,IAAI,QAAQ,SAAS,OAAO,OAAO,KAAK,QAAQ,MAAM;EACtD,IAAI,QAAQ,SAAS,SAAS,KAAK,MAAM,UAAU,QAAQ,WAAW,CAAC,GAAG,KAAK,MAAM;CACvF;CAEA,KAAK,IAAI;AACX;;;;;;;;;;;;;AAcA,SAAgB,uBAAuB,MAA+C;CACpF,OAAOC,gBAAAA,KAAK,eAAe,YAAY;EACrC,MAAM,yBAAS,IAAI,IAAkB;EACrC,WAAW,MAAM,UAAU,YAAY;GACrC,IAAI,QAAQ,SAAS,QAAQ;GAC7B,KAAK,MAAM,EAAE,WAAW,QAAQ,mBAAmB,QAAQ,YAAY,KAAK,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,OAAO,IAAI,KAAK;EAC5H,CAAC;EACD,OAAO,OAAO,OAAO,CAAC,GAAG,MAAM,CAAC;CAClC,CAAC;AACH;AAKA,MAAM,gBAAgBA,gBAAAA,KAAK,OAAgD,EAAE,MAAM,KAAK,CAAC;AAGzF,SAAS,qBAAqB,MAA+B;CAC3D,MAAM,wBAAQ,IAAI,IAAY;CAC9B,WAAW,MAAM,iBAAiB,YAAY;EAC5C,IAAI,QAAQ,SAAS,UAAU,KAAK,MAAM,YAAY,QAAQ,YAAY,MAAM,IAAI,SAAS,IAAI;CACnG,CAAC;CACD,OAAO;AACT;;;;;AAMA,SAAgB,+BAA+B,SAAwD;CACrG,IAAI,QAAQ,SAAS,GAAG,OAAO,KAAA;CAE/B,IAAI;CACJ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,QAAQ,qBAAqB,MAAM;EACzC,aAAa,aAAa,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,SAAS,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI;CACzF;CAEA,KAAK,MAAM,QAAQ,cAAc,CAAC,GAAG;EACnC,MAAM,SAAS,QAAQ,KAAK,WAAW;GACrC,MAAM,WAAW,IAAI,IAAI,wBAAwB;IAAE,MAAM;IAAQ,cAAc;GAAK,CAAC,CAAC,CAAC,SAAS,aAAa,uBAAuB,SAAS,MAAM,CAAC,CAAC;GACrJ,OAAO,SAAS,SAAS,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,KAAA;EAClD,CAAC;EAED,IAAI,OAAO,OAAO,UAAU,UAAU,KAAA,CAAS,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,SAAS,QAAQ,QACnF,OAAO;CAEX;AAGF;;;;;;;;;;;;;;;ACvGA,SAAgB,SAAS,MAA2B;CAClD,OAAO,GAAG,MAAM,QAAQ;AAC1B"}
package/dist/schema.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_constants = require("./constants-BCRkFAiy.cjs");
3
- const require_visitor = require("./visitor-DT712cxr.cjs");
4
- const require_guards = require("./guards-4drgx10i.cjs");
5
- const require_optionality = require("./optionality-C-qULYxo.cjs");
6
- const require_schema = require("./schema-CMe0Dvgd.cjs");
3
+ const require_visitor = require("./visitor-DVsp084s.cjs");
4
+ const require_guards = require("./guards-C6i6KL0l.cjs");
5
+ const require_optionality = require("./optionality-DZfBHn-q.cjs");
6
+ const require_schema = require("./schema-aUVOrRjr.cjs");
7
7
  exports.applyOptionality = require_optionality.applyOptionality;
8
8
  exports.find = require_visitor.findSchema;
9
9
  exports.findProperties = require_schema.resolveSchemaProperties;