@kubb/plugin-faker 5.4.0 → 5.4.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.
- package/dist/index.cjs +12 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/docs/options.md +13 -10
- package/docs/overview.md +2 -2
- package/package.json +4 -4
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["text","posix","casing","text","ast","ast","ast","posix","File","ast","Function","ast","Diagnostics","text","createPrinter","defineGenerator","jsxRenderer","pluginTsName","ast","enumTypeName","File","buildParams","createResolver","casing","defineExtension","pluginTsName","Resolver"],"sources":["../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../src/utils.ts","../src/components/Faker.tsx","../src/utils/imports.ts","../src/printers/printerFaker.ts","../src/generators/fakerGenerator.tsx","../kubb-extension.json","../package.json","../src/resolvers/resolverFaker.ts","../src/plugin.ts"],"sourcesContent":["/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'await',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { text } from '@kubb/kit'\nimport { isIdentifier } from './reserved.ts'\n\n/**\n * Builds a JSDoc comment block from an array of lines. Returns `fallback` when there are no\n * comments.\n *\n * @example\n * ```ts\n * buildJSDoc(['@type string', '@example hello'])\n * // '/**\\n * @type string\\n * @example hello\\n *\\/\\n '\n * ```\n */\nexport function buildJSDoc(\n comments: Array<string>,\n options: {\n /**\n * String used to indent each comment line.\n * @default ' * '\n */\n indent?: string\n /**\n * String appended after the closing tag.\n * @default '\\n '\n */\n suffix?: string\n /**\n * Returned as-is when `comments` is empty.\n * @default ' '\n */\n fallback?: string\n } = {},\n): string {\n const { indent = ' * ', suffix = '\\n ', fallback = ' ' } = options\n\n if (comments.length === 0) return fallback\n\n return `/**\\n${comments.map((c) => `${indent}${c}`).join('\\n')}\\n */${suffix}`\n}\n\n/**\n * Assembles a multi-line object literal from already-rendered `entries`, indenting each entry one\n * level and closing the brace at column zero. Entries that are themselves multi-line objects indent\n * cumulatively. Each entry ends with a trailing comma to match the formatter's multi-line style.\n *\n * @example\n * ```ts\n * buildObject(['id: z.number()', 'name: z.string()'])\n * // '{\\n id: z.number(),\\n name: z.string(),\\n}'\n * ```\n */\nexport function buildObject(entries: Array<string>): string {\n if (entries.length === 0) return '{}'\n const body = entries.map((entry) => `${text.indent({ text: entry })},`).join('\\n')\n\n return `{\\n${body}\\n}`\n}\n\n/**\n * Assembles a bracketed list (array by default) from already-rendered `items`. Keeps everything on\n * one line when no item spans multiple lines, and otherwise puts each item on its own line, indented\n * one level with a trailing comma and the closing bracket at column zero. Used for member lists such\n * as `z.union([…])` and `z.array([…])`.\n *\n * @example\n * ```ts\n * buildList(['z.string()', 'z.number()'])\n * // '[z.string(), z.number()]'\n * ```\n */\nexport function buildList(items: Array<string>, brackets: [open: string, close: string] = ['[', ']']): string {\n const [open, close] = brackets\n if (items.length === 0) return `${open}${close}`\n if (!items.some((item) => item.includes('\\n'))) return `${open}${items.join(', ')}${close}`\n const body = items.map((item) => `${text.indent({ text: item })},`).join('\\n')\n\n return `${open}\\n${body}\\n${close}`\n}\n\n/**\n * Emits a lazy getter for a circular-ref property position, `get name() { return body }`. The key\n * is quoted only when it is not a valid identifier. Used by the string printers to defer evaluation\n * of a recursive schema until first access.\n *\n * @example\n * ```ts\n * lazyGetter({ name: 'parent', body: 'z.lazy(() => Pet)' })\n * // \"get parent() { return z.lazy(() => Pet) }\"\n * ```\n */\nexport function lazyGetter({ name, body }: { name: string; body: string }): string {\n return `get ${objectKey(name)}() { return ${body} }`\n}\n\n/**\n * An object key, quoted only when it is not identifier-shaped. Reserved words such as `class` stay bare.\n *\n * @example\n * ```ts\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : text.quote(name)\n}\n\n/**\n * A JSON value as a JavaScript literal, with single-quoted strings and identifier keys left unquoted.\n *\n * @example\n * ```ts\n * toLiteral({ id: 1, 'x-tag': ['a'] }) // \"{ id: 1, 'x-tag': ['a'] }\"\n * ```\n */\nexport function toLiteral(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (Array.isArray(value)) return `[${value.map(toLiteral).join(', ')}]`\n if (value && typeof value === 'object') {\n return `{ ${Object.entries(value)\n .map(([key, item]) => `${objectKey(key)}: ${toLiteral(item)}`)\n .join(', ')} }`\n }\n return String(value)\n}\n","import { posix } from 'node:path'\nimport { casing } from '@kubb/kit'\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir: string, filePath: string): string {\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = casing.camel): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : casing.camel(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; driver: { inputNode?: { schemas: ReadonlyArray<ast.SchemaNode> } | null } }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(\n (ctx.driver.inputNode?.schemas ?? []).flatMap((schema) =>\n schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : [],\n ),\n ),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = ast.http.groupParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { posix } from 'node:path'\nimport { toResponseContent } from '@internals/shared'\nimport { getRelativePath } from '@internals/utils'\nimport { ast } from '@kubb/kit'\nimport type { ResolverFaker } from './types.ts'\n\n/**\n * Returns the `@faker-js/faker` named export for a locale code.\n *\n * Without a locale, returns `'faker'` for the default English instance.\n * With a locale, the language code is converted to upper case and joined with any region suffix.\n *\n * @example Default\n * `localeToFakerImport() // 'faker'`\n *\n * @example Simple locale\n * `localeToFakerImport('de') // 'fakerDE'`\n *\n * @example Compound locale\n * `localeToFakerImport('de_AT') // 'fakerDE_AT'`\n */\nexport function localeToFakerImport(locale?: string): string {\n if (!locale) {\n return 'faker'\n }\n\n const parts = locale.split('_')\n parts[0] = parts[0]!.toUpperCase()\n return `faker${parts.join('_')}`\n}\n\n/**\n * Schema types a factory cannot override with `data`: they print a constant or have no faker value.\n */\nconst NON_OVERRIDABLE_TYPES = new Set<ast.SchemaNode['type']>(['any', 'unknown', 'void', 'null', 'never', 'ipv4', 'ipv6'])\n\n/**\n * Schema types a single response cannot inline: they reference or compose other schemas.\n */\nconst NON_INLINABLE_RESPONSE_TYPES = new Set<ast.SchemaNode['type']>(['object', 'intersection', 'ref', 'never', 'ipv4', 'ipv6'])\n\n/**\n * Determines if a schema node can be overridden during faker generation.\n */\nexport function canOverrideSchema(node: ast.SchemaNode): boolean {\n return !NON_OVERRIDABLE_TYPES.has(node.type)\n}\n\n/**\n * Whether a schema can supply object properties when merging faker values.\n */\nexport function isObjectSchema(node: ast.SchemaNode, seen = new Set<ast.SchemaNode>()): boolean {\n const resolved = ast.ref.getSchema(node)\n if (seen.has(resolved)) return false\n seen.add(resolved)\n\n if (ast.schema.narrow(resolved, ast.schema.types.object) || ast.schema.narrow(resolved, ast.schema.types.ref)) return true\n const composition = ast.schema.narrow(resolved, ast.schema.types.intersection) ?? ast.schema.narrow(resolved, ast.schema.types.union)\n if (!composition) return false\n\n return (\n (composition.type === ast.schema.types.intersection && !composition.members?.length) ||\n (composition.members ?? []).some((member) => isObjectSchema(member, seen))\n )\n}\n\nfunction shouldInlineSingleResponseSchema(schema: ast.SchemaNode): boolean {\n return !NON_INLINABLE_RESPONSE_TYPES.has(schema.type)\n}\n\n/**\n * Builds a response schema as a union of the success response statuses, like the `<Operation>Response` type of\n * `@kubb/plugin-ts`, so the mock never is an error body. Falls back to every response when no success response has a schema.\n * Returns null if no responses are provided, or embeds single simple responses inline.\n */\nexport function buildResponseUnionSchema(node: ast.OperationNode, resolver: ResolverFaker): ast.SchemaNode | null {\n const withSchema = node.responses\n .map((response) => ({ ...response, content: response.content?.map((entry, _, content) => toResponseContent(entry, content)) }))\n .filter((response) => response.content?.[0]?.schema)\n const success = withSchema.filter((response) => ast.http.status.isSuccess(response))\n const responses = success.length > 0 ? success : withSchema\n\n if (!responses.length) {\n return null\n }\n\n if (responses.length === 1) {\n const schemas = responses[0]!.content?.flatMap((content) => (content.schema ? [content.schema] : [])) ?? []\n const schema = schemas.length > 1 ? ast.factory.createSchema({ type: 'union', members: schemas }) : schemas[0]\n if (schema && shouldInlineSingleResponseSchema(schema)) {\n return schema\n }\n\n return ast.factory.createSchema({\n type: 'ref',\n name: resolver.response.status(node, responses[0]!.statusCode),\n schema: responses[0]!.content?.length === 1 ? schema : undefined,\n })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: responses.map((response) => {\n const schema = (response.content?.length ?? 0) === 1 ? response.content?.[0]?.schema : undefined\n return ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, response.statusCode), schema })\n }),\n })\n}\n\nexport const SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\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])\n\n/**\n * Resolves a type reference, determining if it needs an import statement or inline type reference.\n * Takes into account whether the type can be overridden and the file paths.\n */\nexport function resolveTypeReference({\n node,\n canOverride,\n name,\n typeName,\n filePath,\n typeFilePath,\n}: {\n node: ast.SchemaNode\n canOverride: boolean\n name: string\n typeName: string\n filePath: string\n typeFilePath: string\n}): { importPath?: string; typeName: string } {\n const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!usesTypeName) {\n return { typeName }\n }\n\n if (name === typeName) {\n return {\n typeName: `import('${getRelativePath(posix.dirname(filePath), typeFilePath)}').${typeName}`,\n }\n }\n\n return {\n importPath: typeFilePath,\n typeName,\n }\n}\n\n/**\n * Maps a schema node type to its corresponding scalar type representation.\n * Returns the type name for enums or the base type (string, number, etc.) for primitives.\n */\nfunction getScalarType(node: ast.SchemaNode, typeName: string): string {\n switch (node.type) {\n case 'string':\n case 'email':\n case 'url':\n case 'uuid':\n return 'string'\n case 'number':\n case 'integer':\n return 'number'\n case 'bigint':\n return 'bigint'\n case 'boolean':\n return 'boolean'\n case 'date':\n case 'time':\n return node.representation === 'date' ? 'Date' : 'string'\n case 'datetime':\n return 'string'\n case 'blob':\n return 'Blob'\n default:\n return typeName\n }\n}\n\n/**\n * Resolves faker type usage information for a schema.\n * Determines the data type, return type, and whether it uses the type name.\n */\nexport function resolveFakerTypeUsage(\n node: ast.SchemaNode,\n typeName: string,\n canOverride: boolean,\n): {\n dataType: string\n returnType: string | null\n usesTypeName: boolean\n} {\n // A nullable scalar inlines its primitive, so reapply the nullability the type plugin emitted.\n const resolvedNode = ast.ref.getSchema(node)\n const scalarType = SCALAR_TYPES.has(resolvedNode.type)\n ? `${getScalarType(resolvedNode, typeName)}${node.nullable || resolvedNode.nullable ? ' | null' : ''}`\n : undefined\n\n // Reference factories must accept the same overrides as the referenced factory.\n const dataType = scalarType ?? `Partial<${typeName}>`\n const returnType = scalarType ?? (canOverride ? typeName : null)\n\n return {\n dataType,\n returnType,\n // A non-overridable factory has no `data` param, so `dataType` never reaches the output.\n usesTypeName: (canOverride && dataType.includes(typeName)) || Boolean(returnType?.includes(typeName)),\n }\n}\n","import { jsDocEscape, objectKey } from '@internals/utils'\nimport { ast } from '@kubb/kit'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { PrinterFakerFactory } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { isObjectSchema, resolveFakerTypeUsage, SCALAR_TYPES } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.SchemaNode\n printer: ast.Printer<PrinterFakerFactory>\n description?: string\n canOverride: boolean\n typeMode?: PluginFaker['resolvedOptions']['typeMode']\n keysToOmit?: Array<string> | null\n}\n\nexport function Faker({ node, description, name, typeName, printer, canOverride, typeMode = 'inferred', keysToOmit }: Props): KubbReactNode {\n const fakerText = printer.print(node) ?? 'undefined'\n const imports = printer.drainImports().map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} {...imp} />)\n\n const isArray = node.type === 'array'\n const isObject = !!ast.schema.narrow(node, ast.schema.types.object) || (node.type === ast.schema.types.intersection && isObjectSchema(node))\n const isValueIntersection = node.type === ast.schema.types.intersection && !isObject\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n const isUnion = node.type === 'union'\n\n const useObjectOverride = canOverride && (isObject || !!keysToOmit?.length)\n const fakerTextWithOverride = (() => {\n if (canOverride && node.type === 'tuple') {\n return `data && data.length === ${node.items?.length ?? 0} && !data.includes(undefined) ? data : ${fakerText}`\n }\n if (canOverride && isArray) return `[\\n ...${fakerText},\\n ...(data || []).filter((item) => item !== undefined),\\n]`\n // `??` treats an explicit `null` as \"not provided\", so a nullable factory could never return\n // the `null` its own signature promises. Only `undefined` means \"generate one\".\n if (canOverride && (isScalar || isUnion || isValueIntersection)) {\n return node.nullable ? `data !== undefined ? data : ${fakerText}` : `data ?? ${fakerText}`\n }\n // A nullable ref to a scalar calls the referenced factory, whose `data` does not take `null`.\n if (canOverride && node.type === 'ref' && node.nullable && SCALAR_TYPES.has(ast.ref.getSchema(node).type)) {\n return `data === null ? data : ${fakerText}`\n }\n return fakerText\n })()\n\n const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!useObjectOverride) {\n const usesData = /\\bdata\\b/.test(fakerTextWithOverride)\n const dataParamName = usesData ? 'data' : '_data'\n const paramsSignature = `${dataParamName}?: ${dataType}`\n const returnType = resolvedReturnType\n\n // `as` binds tighter than `??`/`?:`, so tuple/union need parens or `data`'s own type leaks through.\n const needsCast = canOverride && !!returnType && ((node.type === 'ref' && !SCALAR_TYPES.has(ast.ref.getSchema(node).type)) || isArray || isTuple || isUnion)\n const needsParens = isTuple || isUnion\n const returnExpression = needsCast ? `${needsParens ? `(${fakerTextWithOverride})` : fakerTextWithOverride} as ${returnType}` : fakerTextWithOverride\n\n return (\n <>\n {imports}\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsDocEscape(description)}`] : [] }}\n params={canOverride ? paramsSignature : undefined}\n returnType={returnType ?? undefined}\n >\n {`return ${returnExpression}`}\n </Function>\n </File.Source>\n </>\n )\n }\n\n // Generate function with defaultFakeData structure\n const { cyclicSchemas, schemaName } = printer.options\n const isCyclic = !!schemaName && !!cyclicSchemas?.has(schemaName)\n const baseType = isCyclic ? typeName : 'typeof defaultFakeData'\n const returnType = typeMode === 'schema' ? typeName : `Omit<${baseType}, keyof NoInfer<TData>> & NoInfer<TData>`\n\n // When the object node has properties that transitively reference a cyclic schema,\n // the printer emits memoizing getters for those properties. Spreading the object\n // literal would immediately invoke those getters, triggering recursive faker calls\n // and causing a stack overflow. Detect this upfront via ast helpers so we can\n // use Object.defineProperty-based merging instead of spread.\n const hasGetters =\n node.type === 'object' &&\n !!cyclicSchemas &&\n (node.properties ?? []).some((p) => ast.graph.containsCircular(p.schema, { circularSchemas: cyclicSchemas, excludeName: schemaName }))\n\n // A non-object root (such as an `allOf` with a `oneOf` member) or an object padded up to `minProperties` gives\n // `defaultFakeData` a type TypeScript does not relate to the `Omit` of it.\n const castThroughUnknown = (node.type !== 'object' || node.min !== undefined) && typeMode !== 'schema'\n\n const defaults = keysToOmit?.length\n ? `{ ${keysToOmit.map((key, index) => `${objectKey(key)}: _omit${index}`).join(', ')}, ...defaultFakeData }`\n : 'defaultFakeData'\n const declaration = `const ${defaults} = ${fakerText}`\n const functionBody = hasGetters\n ? `${declaration}\nif (data) {\n for (const [key, value] of Object.entries(data)) {\n Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })\n }\n}\nreturn defaultFakeData as ${returnType}`\n : `${declaration}\nreturn {\n ...defaultFakeData,\n ...(data || {}),\n} as ${castThroughUnknown ? 'unknown as ' : ''}${returnType}`\n\n return (\n <>\n {imports}\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsDocEscape(description)}`] : [] }}\n generics={typeMode === 'schema' ? undefined : `TData extends Partial<${typeName}> = object`}\n params={typeMode === 'schema' ? `data?: Partial<${typeName}>` : 'data?: TData'}\n returnType={typeMode === 'schema' || isCyclic ? returnType : undefined}\n >\n {functionBody}\n </Function>\n </File.Source>\n </>\n )\n}\n","export type ImportName = string | { propertyName: string; name?: string }\n\nexport type ImportEntry = {\n name: string | Array<ImportName>\n path: string\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction getImportNames(entry: ImportEntry): Array<string> {\n return (Array.isArray(entry.name) ? entry.name : [entry.name])\n .map((name) => {\n if (typeof name === 'string') {\n return name\n }\n\n return name.name ?? name.propertyName\n })\n .filter((name): name is string => Boolean(name))\n}\n\n/**\n * Keeps the imports whose names `text` calls, as `name(` or `name<`, minus `skipImportNames`.\n */\nexport function filterUsedImports(imports: Array<ImportEntry>, text: string, skipImportNames: Array<string> = []): Array<ImportEntry> {\n const skip = new Set(skipImportNames)\n // One scan of `text` instead of a new RegExp per import name. Generated helpers can use explicit\n // type arguments, such as `createPet<object>()`.\n const called = new Set(text.match(/\\b\\w+(?=\\s*[<(])/g))\n\n return imports.filter((entry) => {\n const names = getImportNames(entry)\n\n return names.some((name) => {\n if (skip.has(name)) {\n return false\n }\n\n return /^\\w+$/.test(name) ? called.has(name) : new RegExp(`\\\\b${escapeRegExp(name)}\\\\b(?=\\\\s*[<(])`).test(text)\n })\n })\n}\n\nexport function aliasConflictingImports(\n imports: Array<ImportEntry>,\n reservedNames: Iterable<string>,\n): { imports: Array<ImportEntry>; aliases: Map<string, string> } {\n const reservedNameSet = new Set(reservedNames)\n const aliases = new Map<string, string>()\n\n const aliasedImports = imports.map((entry) => {\n const names = Array.isArray(entry.name) ? entry.name : [entry.name]\n const aliasedNames = names.map((item): ImportName => {\n if (typeof item !== 'string' || !reservedNameSet.has(item)) {\n return item\n }\n\n const alias = `${item}Schema`\n aliases.set(item, alias)\n\n return { propertyName: item, name: alias }\n })\n\n return aliasedNames.some((item) => typeof item === 'object' && item.name)\n ? {\n ...entry,\n name: aliasedNames,\n }\n : entry\n })\n\n return {\n imports: aliasedImports,\n aliases,\n }\n}\n\nexport function rewriteAliasedImports(text: string, aliases: ReadonlyMap<string, string>): string {\n return Array.from(aliases).reduce((acc, [name, alias]) => acc.replace(new RegExp(`\\\\b${escapeRegExp(name)}\\\\b`, 'g'), alias), text)\n}\n","import { buildObject, objectKey, toRegExpString } from '@internals/utils'\nimport { ast, createPrinter, Diagnostics, text } from '@kubb/kit'\nimport type { PluginFaker, ResolverFaker } from '../types.ts'\nimport { canOverrideSchema, isObjectSchema } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Faker printer. Each key is a\n * `SchemaType` (`'string'`, `'date'`, ...) and each handler returns the\n * Faker expression for that schema as a string. Use `this.transform` to\n * recurse into nested schema nodes, `this.base` to reuse the built-in handler,\n * and `this.options` to read printer options.\n *\n * @example Override the integer handler\n * ```ts\n * pluginFaker({\n * printer: {\n * nodes: {\n * integer() {\n * return 'faker.number.float()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterFakerNodes = ast.PrinterPartial<string, PrinterFakerOptions>\n\n/**\n * Options passed to the Faker printer at instantiation: the parser library\n * for date strings, the regex generator, and the resolver used to compute\n * identifiers.\n */\nexport type PrinterFakerOptions = {\n dateParser?: PluginFaker['resolvedOptions']['dateParser']\n regexGenerator?: PluginFaker['resolvedOptions']['regexGenerator']\n resolver: ResolverFaker\n typeName?: string\n schemaName?: string\n nestedInObject?: boolean\n /**\n * Set while printing the members of a union (`oneOf`). Object properties then index their\n * type as `(NonNullable<T> & Record<K, unknown>)[K]` instead of `NonNullable<T>[K]`, so a key\n * carried by only some branches stays valid (a plain index would be a TS2339).\n */\n nestedInUnion?: boolean\n nodes?: PrinterFakerNodes\n /**\n * Names of schemas that participate in a circular dependency chain.\n * Properties whose schema transitively references one of these are emitted\n * as lazy getters so that user overrides via the `data` parameter prevent\n * the recursive faker call from ever executing (avoiding stack overflow).\n */\n cyclicSchemas?: ReadonlySet<string>\n}\n\n/**\n * Factory options for the Faker printer, defining input/output types and configuration.\n */\nexport type PrinterFakerFactory = ast.PrinterFactoryOptions<'faker', PrinterFakerOptions, string, string>\n\n/**\n * Formats that put a whole number inside a `type: 'string'` schema, the way ProtoJSON encodes\n * 64-bit integers, so the mock has to be digits rather than letters.\n *\n * @see https://protobuf.dev/programming-guides/json/#int64-strings\n */\nconst integerFormats: ReadonlySet<string> = new Set(['int32', 'int64', 'uint64'])\n\nconst maxInt32 = 2_147_483_647\n// The largest value of a 32-bit format, which faker's default `max` exceeds.\nconst maxValueByFormat: Record<string, number> = { int32: maxInt32, uint32: 4_294_967_295 }\n\n// A ref back into its own cycle is left empty, so a mock of a recursive schema is finite and can be serialized.\nfunction isCyclicRef(node: ast.SchemaNode, { schemaName, cyclicSchemas }: PrinterFakerOptions): boolean {\n if (node.type !== 'ref' || !schemaName) return false\n const refName = ast.ref.getName(node)\n\n return refName === schemaName || Boolean(refName && cyclicSchemas?.has(schemaName) && cyclicSchemas.has(refName))\n}\n\n/**\n * `faker.number.float()`, `faker.number.int()` or `faker.number.bigInt()`, with `min` and `max` passed only when set,\n * moved inside an exclusive bound, or needed so a lone bound does not contradict faker's default for the other.\n */\nfunction numberCall(\n kind: 'float' | 'int' | 'bigInt',\n { min, max, exclusive, multipleOf }: Pick<ast.NumberSchemaNode, 'min' | 'max' | 'exclusive' | 'multipleOf'>,\n): string {\n const isWhole = kind !== 'float'\n // Faker's `int` and `bigInt` reject a fractional `multipleOf`.\n const grid = isWhole && !Number.isInteger(multipleOf) ? undefined : multipleOf\n // Faker returns points of the `multipleOf` grid, ends included, so an exclusive bound moves to the next point.\n // shortcut: without a grid a float's exclusive `min` is passed as is, so faker can return it by chance; nudge it up once a mock hits it.\n const { min: lower, max: upper } = ast.schema.getNumberBounds({ min, max, exclusive, integer: isWhole, step: grid })\n // Faker fills a missing `min` with `0`, and a float's missing `max` with `1`, which a lone bound on the other side contradicts.\n // The span holds grid points, so faker always finds a multiple.\n const span = 100 * (grid ?? 1)\n const maxValue = kind === 'float' && lower !== undefined && upper === undefined && (lower >= 1 || grid !== undefined) ? lower + span : upper\n const minValue = maxValue !== undefined && lower === undefined && (isWhole ? maxValue < 0 : maxValue <= 0) ? maxValue - span : lower\n const suffix = kind === 'bigInt' ? 'n' : ''\n const args = [\n minValue !== undefined && `min: ${minValue}${suffix}`,\n maxValue !== undefined && `max: ${maxValue}${suffix}`,\n grid !== undefined && `multipleOf: ${grid}${suffix}`,\n ]\n .filter(Boolean)\n .join(', ')\n\n return `faker.number.${kind}(${args ? `{ ${args} }` : ''})`\n}\n\n/**\n * A `date` or `time` value: an ISO substring, a `dateParser` call, or a `Date` when `representation` is `'date'`.\n */\nfunction dateTimeCall(\n representation: 'date' | 'string',\n { format, substring }: { format: string; substring: string },\n parser: PluginFaker['resolvedOptions']['dateParser'] = 'faker',\n schemaName?: string,\n): string {\n if (representation === 'string') {\n return parser !== 'faker' ? `${parser}(faker.date.anytime()).format(\"${format}\")` : `faker.date.anytime().toISOString().substring(${substring})`\n }\n\n if (parser !== 'faker') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Option \\`dateParser: '${parser}'\\` cannot format the adapter's \\`dateType: 'date'\\` values${schemaName ? ` in schema \"${schemaName}\"` : ''}.`,\n help: \"Set adapterOas({ dateType: 'string' }) or remove `dateParser`.\",\n location: { kind: 'config' },\n plugin: 'plugin-faker',\n })\n }\n\n return 'faker.date.anytime()'\n}\n\n// Eight letters or digits are base64url as they are: no padding, and none of the characters base64 swaps.\nconst encodingCalls = new Map<string | undefined, string>([\n ['base64', 'btoa(faker.string.alpha())'],\n ['base64url', 'faker.string.alphanumeric(8)'],\n])\n\n// Formats `plugin-zod` checks with a dedicated constructor, which a random string fails.\nconst stringFormatCalls = new Map<string | undefined, string>([\n ['jwt', 'faker.internet.jwt()'],\n ['ulid', 'faker.string.ulid()'],\n ['iban', 'faker.finance.iban()'],\n ['duration', \"'P1D'\"],\n ['hostname', 'faker.internet.domainName()'],\n])\n\n// The members an escape becomes inside a character class: `\\d` and `\\w`, and the punctuation `faker.helpers.fromRegExp` reads there.\nconst classEscapes = new Map<string, string>([['d', '0-9'], ['w', 'A-Za-z0-9_'], ...Array.from('-!@#$&()`.+,\"', (char): [string, string] => [char, char])])\n\n// `faker.helpers.fromRegExp` prints `\\d`, `\\w`, escaped literals and an open-ended `{n,}` as written, so they become classes and `{n,n+10}`.\n// shortcut: groups, alternation and `\\s` stay unsupported, as `regexGenerator: 'randexp'` covers them.\nfunction toFakerPattern(pattern: string): string {\n let result = ''\n let inClass = false\n // Where the open class's members start, after `[` or `[^`: faker reads a literal `-` only there.\n let classStart = -1\n for (let index = 0; index < pattern.length; index++) {\n const char = pattern[index]!\n const next = pattern[index + 1]\n if (char === '\\\\' && next !== undefined) {\n index++\n if (inClass && next === '-') {\n if (result[classStart] !== '-') result = `${result.slice(0, classStart)}-${result.slice(classStart)}`\n continue\n }\n const classMembers = classEscapes.get(next)\n if (classMembers === undefined) {\n result += `\\\\${next}`\n continue\n }\n result += inClass ? classMembers : `[${classMembers}]`\n continue\n }\n if (char === '[' && !inClass) {\n inClass = true\n result += next === '^' ? '[^' : '['\n if (next === '^') index++\n classStart = result.length\n continue\n }\n if (char === ']') inClass = false\n result += char\n }\n\n return result.replace(/\\{(\\d+),\\}/g, (_, min: string) => `{${min},${Number(min) + 10}}`)\n}\n\nfunction matches(value: string, regexGenerator: 'faker' | 'randexp' = 'faker'): string {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n\n return `faker.helpers.fromRegExp(${toRegExpString(toFakerPattern(value), null)})`\n}\n\nfunction parseEnumValue(value: string | number | boolean | null | undefined) {\n if (typeof value === 'string') {\n return text.quote(value)\n }\n\n return value\n}\n\n/**\n * Reads the discriminator literal off a variant, with whether its property is required, or\n * `undefined` when it can't be determined.\n *\n * A variant carries exactly one discriminator value, so a property resolving to several literals\n * (a `ref` to the enum shared by every branch, say) identifies no branch and narrows nothing.\n */\nfunction getDiscriminator(\n member: ast.SchemaNode,\n discriminatorPropertyName: string,\n): { value: string | number | boolean | null; required: boolean } | undefined {\n for (const property of ast.schema.findProperties({ node: member, propertyName: discriminatorPropertyName })) {\n const values = ast.schema.getLiterals(property.schema)\n if (values.length === 1) {\n return { value: values[0]!, required: property.required }\n }\n }\n\n return undefined\n}\n\n/**\n * Type expression for an object property's value, indexed off the parent `typeName`.\n *\n * In a union (`oneOf`), a key that only some branches declare turns a plain `NonNullable<T>[K]`\n * into a TS2339 error, so union members guard the access. The breakdown is below.\n */\nfunction indexedTypeName(typeName: string, propertyName: string, nestedInUnion?: boolean): string {\n const key = JSON.stringify(propertyName)\n\n // `(NonNullable<T> & Record<K, unknown>)[K]`, read inside-out:\n // NonNullable<T> strips null and undefined from the parent type T.\n // & Record<K, unknown> forces every branch to have key K. A branch that already declares K\n // keeps it (`T[K] & unknown` is `T[K]`); a branch missing K gains it as `unknown`.\n // [K] reads the key, which is now always present, so it never hits TS2339.\n // For a single object T the intersection does nothing, leaving `T[K]`.\n return nestedInUnion ? `(NonNullable<${typeName}> & Record<${key}, unknown>)[${key}]` : `NonNullable<${typeName}>[${key}]`\n}\n\n// In a union only some branches are arrays, and indexing the others with `number` is a TS2537 error.\nfunction itemTypeName(typeName: string, nestedInUnion?: boolean): string {\n return nestedInUnion ? `Extract<NonNullable<${typeName}>, ReadonlyArray<unknown>>[number]` : `NonNullable<${typeName}>[number]`\n}\n\n/**\n * Creates a Faker printer that generates mock data generation code from schema nodes.\n * Handles circular references gracefully by emitting memoizing getters for cyclic properties.\n */\nexport const printerFaker: (options: PrinterFakerOptions) => ast.Printer<PrinterFakerFactory> = createPrinter<PrinterFakerFactory>((options) => {\n const printNested = (node: ast.SchemaNode, overrideOptions: Partial<PrinterFakerOptions> = {}): string => {\n return (\n printerFaker({\n ...options,\n ...overrideOptions,\n nodes: options.nodes,\n }).print(node) ?? 'undefined'\n )\n }\n\n return {\n name: 'faker',\n options,\n nodes: {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n boolean: () => 'faker.datatype.boolean()',\n null: () => 'null',\n string(node) {\n if (node.pattern) {\n return matches(node.pattern, this.options.regexGenerator)\n }\n\n if (node.format && integerFormats.has(node.format)) {\n return node.format === 'int32' ? `faker.number.int({ max: ${maxInt32} }).toString()` : 'faker.number.bigInt().toString()'\n }\n\n const formatCall = stringFormatCalls.get(node.format)\n if (formatCall) return formatCall\n\n const contentSchema = ast.schema.getEmbeddedJson(node)\n // The document is typed by its own schema, not by the string that holds it.\n if (contentSchema) return `JSON.stringify(${printNested(contentSchema, { typeName: undefined, nestedInObject: true, nestedInUnion: false })})`\n\n const encodingCall = encodingCalls.get(node.content?.encoding?.toLowerCase())\n if (encodingCall) return encodingCall\n\n const { min, max } = node\n // A string as long as a large `maxLength` makes a mock of megabytes, so the length stays within 100 of the minimum.\n if (max !== undefined) return `faker.string.alpha({ length: { min: ${min ?? Math.min(1, max)}, max: ${Math.min(max, (min ?? 0) + 100)} } })`\n if (min !== undefined) return `faker.string.alpha({ length: ${min} })`\n\n return 'faker.string.alpha()'\n },\n email: () => 'faker.internet.email()',\n url: () => 'faker.internet.url()',\n uuid: () => 'faker.string.uuid()',\n ipv4: () => 'faker.internet.ipv4()',\n ipv6: () => 'faker.internet.ipv6()',\n number: (node) => numberCall('float', node),\n integer: (node) =>\n numberCall(\n 'int',\n node.format && node.format in maxValueByFormat ? { ...node, max: Math.min(node.max ?? Infinity, maxValueByFormat[node.format]!) } : node,\n ),\n bigint: (node) => numberCall('bigInt', node),\n blob: () => 'new Blob([faker.string.alpha()])',\n datetime(node) {\n const parser = this.options.dateParser ?? 'faker'\n if (parser === 'faker') return 'faker.date.anytime().toISOString()'\n // ISO 8601 that matches the node: no zone when local, a numeric offset, or UTC `Z`.\n const format = node.local ? 'YYYY-MM-DDTHH:mm:ss' : node.offset ? 'YYYY-MM-DDTHH:mm:ssZ' : 'YYYY-MM-DDTHH:mm:ss[Z]'\n\n return `${parser}(faker.date.anytime()).format(\"${format}\")`\n },\n date(node) {\n return dateTimeCall(node.representation ?? 'string', { format: 'YYYY-MM-DD', substring: '0, 10' }, this.options.dateParser, this.options.schemaName)\n },\n time(node) {\n return dateTimeCall(node.representation ?? 'string', { format: 'HH:mm:ss', substring: '11, 19' }, this.options.dateParser, this.options.schemaName)\n },\n ref(node) {\n // `ast.ref.getName` prefers the node's `targetName` (set for collision or macro renames),\n // then the $ref path segment, since node.name may have been overridden (e.g. by\n // single-member allOf flatten using the property-derived child name). Inline refs\n // (without $ref) from faker utils already carry resolved helper names.\n const refName = ast.ref.getName(node)\n\n if (!refName) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.pluginFailed,\n severity: 'error',\n message: `Ref node \"${node.ref ?? node.name ?? 'unknown'}\"${this.options.schemaName ? ` in schema \"${this.options.schemaName}\"` : ''} has no name.`,\n plugin: 'plugin-faker',\n })\n }\n\n if (isCyclicRef(node, this.options)) {\n return this.options.typeName ? `undefined as unknown as ${this.options.typeName}` : 'undefined as unknown'\n }\n\n // Internal helper refs (for generated response/data helpers) are already\n // emitted with resolver output and should not be transformed twice.\n const resolvedName = node.ref ? this.options.resolver.name(refName) : refName\n\n if (!this.options.nestedInObject && canOverrideSchema(ast.ref.getSchema(node))) {\n return `${resolvedName}(data)`\n }\n\n return `${resolvedName}()`\n },\n enum(node) {\n const { typeName } = this.options\n const values = ast.schema.getLiterals(node)\n\n if (values.length === 1 && values[0] !== null && typeof values[0] === 'object') {\n return JSON.stringify(values[0])\n }\n\n // The values are asserted as the property's type, not checked against it. Inside an `allOf` or `oneOf` that type can be\n // narrower than the enum, or `never`, and a type argument would then reject the values the schema itself lists.\n return `faker.helpers.arrayElement([${values.map(parseEnumValue).join(', ')}]${typeName ? ` as Array<${typeName}>` : ''})`\n },\n union(node): string {\n const { discriminatorPropertyName } = node\n const baseTypeName = this.options.typeName\n\n // A member that points back into the cycle would print `undefined`, so the mock picks among the others. A discriminated\n // variant (`allOf: [ref, { type }]`) counts too: spreading its ref reads every lazy getter, which recurses without end.\n const isCyclicMember = (member: ast.SchemaNode) =>\n isCyclicRef(member, this.options) || (member.type === 'intersection' && (member.members ?? []).some((part) => isCyclicRef(part, this.options)))\n const acyclicMembers = (node.members ?? []).filter((member) => !isCyclicMember(member))\n const members = acyclicMembers.length ? acyclicMembers : node.members\n\n const items: Array<string> = (members ?? [])\n .map((member) => {\n // For a discriminated union, narrow each variant to its own branch so nested\n // `NonNullable<T>[K]` indexes resolve against that branch instead of the whole union.\n const discriminator = discriminatorPropertyName ? getDiscriminator(member, discriminatorPropertyName) : undefined\n\n if (baseTypeName && discriminator) {\n // An optional discriminator (`strategy?: 'a'`) does not extend `{ strategy: 'a' }`,\n // so match it as optional too.\n const key = `${JSON.stringify(discriminatorPropertyName)}${discriminator.required ? '' : '?'}`\n const typeName = `Extract<NonNullable<${baseTypeName}>, { ${key}: ${parseEnumValue(discriminator.value)} }>`\n\n return printNested(member, { typeName, nestedInObject: true, nestedInUnion: true })\n }\n\n // Without a discriminator, keep the union type but guard each indexed access (see\n // `indexedTypeName`) so a key carried by only some branches resolves to `unknown`\n // rather than erroring with TS2339.\n return printNested(member, { typeName: baseTypeName, nestedInObject: true, nestedInUnion: true })\n })\n .filter((item): item is string => Boolean(item))\n\n return `faker.helpers.arrayElement([${items.join(', ')}])`\n },\n intersection(node): string {\n const objectMembers = (node.members ?? []).filter((member) => isObjectSchema(member))\n // A ref (the base) spreads first and a union last, so neither a base nor a sibling object overwrites the narrower value\n // an extension or a discriminator sets.\n const memberRank = (member: ast.SchemaNode) => (member.type === 'ref' ? 0 : member.type === 'union' ? 2 : 1)\n const members = objectMembers.length ? objectMembers.toSorted((a, b) => memberRank(a) - memberRank(b)) : node.members\n const items: Array<string> = (members ?? [])\n .map((member) =>\n printNested(member, {\n nestedInObject: true,\n // Only a ref to the schema itself is cut: a cycle through another schema is cut at the property that closes it.\n ...(member.type === 'ref' && ast.ref.getName(member) !== this.options.schemaName ? { cyclicSchemas: undefined } : {}),\n }),\n )\n // An `allOf` member with no shape (any/unknown/void → 'undefined') adds no\n // constraint. Keeping it would spread `...undefined` into the merged object.\n .filter((item): item is string => Boolean(item) && item !== 'undefined')\n\n if (items.length === 0) return '{}'\n\n return !objectMembers.length || items.length === 1 ? items.at(-1)! : `{...${items.join(', ...')}}`\n },\n array(node): string {\n // An array of items that would recurse stays empty, which is valid where a list of `undefined` is not.\n if (node.items?.length === 1 && isCyclicRef(node.items[0]!, this.options)) return this.options.typeName ? `[] as ${this.options.typeName}` : '[]'\n\n const items: Array<string> = (node.items ?? [])\n .map((member) =>\n printNested(member, {\n typeName: this.options.typeName ? itemTypeName(this.options.typeName, this.options.nestedInUnion) : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n\n const { min, max } = node\n const item = items[0]\n // Like a string, a list stays within 100 items of its minimum, however large `maxItems` is.\n const countRange = max === undefined ? undefined : `{ min: ${min ?? 0}, max: ${Math.min(max, (min ?? 0) + 100)} }`\n // `uniqueArray` takes a fixed length and compares like the zod `Set` check. It returns fewer items when the generator runs out of values.\n if (node.unique) return `faker.helpers.uniqueArray(() => (${item}), ${countRange ? `faker.number.int(${countRange})` : (min ?? 3)})`\n if (countRange) return `faker.helpers.multiple(() => (${item}), { count: ${countRange}})`\n if (min !== undefined) return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple(node): string {\n const items: Array<string> = (node.items ?? [])\n .map((member, index) =>\n printNested(member, {\n typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${index}]` : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return `[${items.join(', ')}]`\n },\n object(node): string {\n const cyclicSchemas = this.options.cyclicSchemas\n const keySchema = node.propertyNames && ast.ref.mergeSchema(node.propertyNames)\n const valueSchema = node.additionalProperties\n const recordProperties =\n keySchema?.type === 'enum' && typeof valueSchema === 'object'\n ? ast.schema\n .getLiterals(keySchema)\n .filter((key): key is string => typeof key === 'string' && !node.properties.some((property) => property.name === key))\n .map((name) => ast.factory.createProperty({ name, schema: valueSchema }))\n : []\n const properties = [...node.properties, ...recordProperties]\n // `maxProperties` keeps the required properties first.\n const keptProperties = node.max === undefined ? properties : properties.toSorted((a, b) => Number(b.required) - Number(a.required)).slice(0, node.max)\n // `minProperties` adds keys from `additionalProperties`, skipping any name a declared property uses.\n const declaredNames = new Set(properties.map((property) => property.name))\n const extras: typeof keptProperties = []\n for (let index = 1; typeof valueSchema === 'object' && keptProperties.length + extras.length < (node.min ?? 0); index++) {\n const name = `additionalProperty${index}`\n if (!declaredNames.has(name)) extras.push(ast.factory.createProperty({ name, schema: valueSchema }))\n }\n const entries = [...keptProperties, ...extras].map((property): string => {\n const value: string =\n printNested(property.schema, {\n typeName: this.options.typeName ? indexedTypeName(this.options.typeName, property.name, this.options.nestedInUnion) : undefined,\n nestedInObject: true,\n // A required ref to another schema stays, since `undefined` would fail it: the lazy getter keeps the mock finite,\n // and the cycle is cut where it is optional, in a union, or in an array.\n ...(property.required && property.schema.type === 'ref' ? { cyclicSchemas: undefined } : {}),\n }) ?? 'undefined'\n\n // When the property's schema transitively references a schema that is\n // part of a circular dependency (other than the current schema itself),\n // emit a memoizing lazy getter. On first access it computes the value,\n // replaces itself with a plain data property via Object.defineProperty,\n // and returns the cached value, so every subsequent read is stable.\n if (cyclicSchemas && ast.graph.containsCircular(property.schema, { circularSchemas: cyclicSchemas, excludeName: this.options.schemaName })) {\n return `get ${objectKey(property.name)}() { const _value = ${value}; Object.defineProperty(this, ${JSON.stringify(property.name)}, { value: _value, configurable: true, writable: true, enumerable: true }); return _value }`\n }\n\n return `${objectKey(property.name)}: ${value}`\n })\n\n return buildObject(entries)\n },\n },\n overrides: options.nodes,\n }\n})\n","import { getCircularNames, getPerContentTypeName, resolveContentTypeVariants, resolveOperationFile, toResponseContent } from '@internals/shared'\nimport { aliasConflictingImports, filterUsedImports, rewriteAliasedImports } from '../utils/imports.ts'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { buildParams, enumTypeName, pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Faker } from '../components/Faker.tsx'\nimport { printerFaker } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { buildResponseUnionSchema, canOverrideSchema, localeToFakerImport, resolveTypeReference } from '../utils.ts'\n\ntype RenderUnit = {\n schema: ast.SchemaNode | null\n name: string\n typeName: string\n description?: string\n keysToOmit?: Array<string> | null\n skipImportNames?: Array<string>\n}\n\n/**\n * Built-in generator for `@kubb/plugin-faker`. Emits one `createX` factory\n * per schema in the spec plus per-operation request/response factories. Each\n * factory returns a value matching the corresponding TypeScript type from\n * `@kubb/plugin-ts`.\n */\nexport const fakerGenerator = defineGenerator<PluginFaker>({\n name: 'faker',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, dateParser, regexGenerator, seed, locale, printer, typeMode } = ctx.options\n const pluginTs = ctx.requirePlugin(pluginTsName)\n\n if (!node.name) {\n return\n }\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const schemaName = node.name\n const isEnumSchema = !!ast.schema.narrow(node, ast.schema.types.enum)\n const schemaTypeName = enumTypeName({ resolver: tsResolver, name: schemaName, enumOptions: pluginTs.options?.enum, isEnum: isEnumSchema })\n const meta = {\n name: resolver.name(schemaName),\n file: resolver.file({ name: schemaName, extname: '.ts', root, output, group: group ?? undefined }),\n typeName: schemaTypeName,\n typeFile: tsResolver.file({\n name: schemaName,\n extname: '.ts',\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n } as const\n const canOverride = canOverrideSchema(node)\n const cyclicSchemas = getCircularNames(ctx)\n const printerInstance = printerFaker({\n resolver,\n schemaName,\n typeName: meta.typeName,\n dateParser,\n regexGenerator,\n nodes: printer?.nodes,\n cyclicSchemas,\n })\n const fakerText = printerInstance.print(node) ?? 'undefined'\n const typeReference = resolveTypeReference({\n node,\n canOverride,\n name: meta.name,\n typeName: meta.typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n const imports = resolver.imports({ node, root, output, group: group ?? undefined, checks: true })\n const usedImports = filterUsedImports(imports, fakerText)\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[meta.typeName]} />}\n {usedImports.map((imp) => (\n <File.Import key={[schemaName, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n {seed ? <File.Source name=\"faker-seed\">{`faker.seed(${JSON.stringify(seed)})`}</File.Source> : undefined}\n <Faker\n name={meta.name}\n typeName={typeReference.typeName}\n description={node.description}\n node={node}\n printer={printerInstance}\n canOverride={canOverride}\n typeMode={typeMode}\n />\n </File>\n )\n },\n operation(node, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, dateParser, regexGenerator, seed, locale, printer, typeMode } = ctx.options\n const pluginTs = ctx.requirePlugin(pluginTsName)\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const { path: pathParams, query: queryParams, header: headerParams, cookie: cookieParams } = ast.http.groupParameters(node)\n const paramGroups = (\n [\n { params: pathParams, name: resolver.param.path, typeName: tsResolver.param.path },\n { params: queryParams, name: resolver.param.query, typeName: tsResolver.param.query },\n { params: headerParams, name: resolver.param.headers, typeName: tsResolver.param.headers },\n { params: cookieParams, name: resolver.param.cookies, typeName: tsResolver.param.cookies },\n ] as const\n )\n .filter((group) => group.params.length > 0)\n .map((group) => ({\n schema: buildParams({ params: group.params }),\n name: group.name(node, group.params[0]!),\n typeName: group.typeName(node, group.params[0]!),\n }))\n // Expands a content array into render units: one faker per content type plus a union faker\n // (named `baseName`) when more than one content type carries a schema, else a single faker.\n function expandContentUnits(\n entries: Array<ast.ContentNode>,\n baseName: string,\n tsBaseName: string,\n description: string | undefined,\n decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n ): Array<RenderUnit> {\n const withSchema = entries.filter((entry) => entry.schema)\n if (withSchema.length <= 1) {\n const primary = withSchema[0] ?? entries[0]\n if (!primary?.schema) return []\n return [\n {\n schema: decorate ? decorate(primary.schema) : primary.schema,\n name: baseName,\n typeName: tsBaseName,\n description,\n keysToOmit: primary.keysToOmit,\n },\n ]\n }\n const variants = resolveContentTypeVariants(entries, baseName)\n const unionSchema = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name, schema: variant.schema })),\n })\n return [\n ...variants.map((variant) => ({\n schema: decorate ? decorate(variant.schema) : variant.schema,\n name: variant.name,\n typeName: getPerContentTypeName(tsBaseName, variant.suffix),\n description,\n keysToOmit: variant.keysToOmit,\n })),\n { schema: unionSchema, name: baseName, typeName: tsBaseName, description, skipImportNames: variants.map((variant) => variant.name) },\n ]\n }\n\n const responseUnits = node.responses.flatMap((response) =>\n expandContentUnits(\n (response.content ?? []).map((entry, _, content) => toResponseContent(entry, content)),\n resolver.response.status(node, response.statusCode),\n tsResolver.response.status(node, response.statusCode),\n response.description,\n ),\n )\n const dataUnits = expandContentUnits(\n node.requestBody?.content ?? [],\n resolver.response.body(node),\n tsResolver.response.body(node),\n node.requestBody?.description,\n (schema) => ({ ...schema, description: node.requestBody?.description ?? schema.description }),\n )\n const responseName = resolver.response.response(node)\n const importedResponseNames = new Set(ast.http.responses.getImportedNames(node.responses).map((name) => resolver.name(name)))\n const hasResponseNameCollision = importedResponseNames.has(responseName)\n const localHelperNames = new Set([\n ...paramGroups.map((group) => group.name),\n ...responseUnits.map((unit) => unit.name),\n ...dataUnits.map((unit) => unit.name),\n ...(hasResponseNameCollision ? [] : [responseName]),\n ])\n const cyclicSchemas = getCircularNames(ctx)\n\n const meta = {\n file: resolveOperationFile({ ctx, node, resolver, root, output, group }),\n typeFile: resolveOperationFile({\n ctx,\n node,\n resolver: tsResolver,\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n }),\n } as const\n\n function resolveMockImports(schema: ast.SchemaNode) {\n return resolver.imports({ node: schema, root, output, group: group ?? undefined, checks: true }).filter((entry) => entry.path !== meta.file.path)\n }\n\n function renderEntry({ schema, name, typeName, description, keysToOmit, skipImportNames = [] }: RenderUnit) {\n if (!schema) {\n return null\n }\n\n if (schema.type === ast.schema.types.object && keysToOmit?.length) {\n schema = { ...schema, properties: schema.properties.filter((property) => !keysToOmit?.includes(property.name)) }\n keysToOmit = undefined\n }\n\n const canOverride = canOverrideSchema(schema)\n const printerInstance = printerFaker({\n resolver,\n schemaName: name,\n typeName,\n dateParser,\n regexGenerator,\n nodes: printer?.nodes,\n cyclicSchemas,\n nestedInObject: !!keysToOmit?.length,\n })\n const fakerText = printerInstance.print(schema) ?? 'undefined'\n const usedImports = filterUsedImports(resolveMockImports(schema), fakerText, skipImportNames)\n const { imports, aliases } = aliasConflictingImports(usedImports, localHelperNames)\n const rewrittenFakerText = rewriteAliasedImports(fakerText, aliases)\n const typeReference = resolveTypeReference({\n node: schema,\n canOverride,\n name,\n typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n return (\n <>\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[typeName]} />}\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={name}\n typeName={typeReference.typeName}\n description={description}\n node={schema}\n printer={{ ...printerInstance, print: () => rewrittenFakerText }}\n canOverride={canOverride}\n typeMode={typeMode}\n keysToOmit={keysToOmit}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {seed ? <File.Source name=\"faker-seed\">{`faker.seed(${JSON.stringify(seed)})`}</File.Source> : undefined}\n {paramGroups.map((group) => renderEntry(group))}\n {responseUnits.map((unit) => renderEntry(unit))}\n {dataUnits.map((unit) => renderEntry(unit))}\n {!hasResponseNameCollision &&\n renderEntry({\n schema: buildResponseUnionSchema(node, resolver),\n name: responseName,\n typeName: tsResolver.response.response(node),\n skipImportNames: responseUnits.map((unit) => unit.name),\n })}\n </File>\n )\n },\n})\n","","","import { createCasedFile, createOperationParamResolver, createOperationResponseResolver } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, createResolver } from '@kubb/kit'\nimport type { PluginFaker } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-faker`. Decides the names and file\n * paths for every generated mock factory. Functions and files are prefixed\n * with `create` so `Pet` becomes `createPet`.\n *\n * @example Resolve a factory name\n * ```ts\n * import { resolverFaker } from '@kubb/plugin-faker'\n *\n * resolverFaker.name('list pets') // 'createListPets'\n * ```\n */\nexport const resolverFaker = createResolver<PluginFaker>({\n pluginName: 'plugin-faker',\n name(name) {\n return this.memo(`name:${name}`, () => ensureValidVarName(casing.camel(name, { prefix: 'create' })))\n },\n file: createCasedFile((part) => casing.camel(part, { prefix: 'create' })),\n param: createOperationParamResolver(),\n response: createOperationResponseResolver(),\n})\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport { resolverFaker } from './resolvers/resolverFaker.ts'\nimport type { PluginFaker } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-faker`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\n/**\n * Generates one mock-data factory per OpenAPI schema using Faker.js. Call\n * `createPet()` to get a realistic `Pet` object. Useful for tests, Storybook,\n * and local development without a running backend.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginFaker } from '@kubb/plugin-faker'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginFaker({\n * output: { path: './mocks' },\n * seed: [100],\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginFaker = defineExtension<PluginFaker>({\n kind: 'plugin',\n meta: { name: pluginFakerName, version, compatibility },\n dependencies: { [pluginTsName]: {} },\n setup(options) {\n const {\n output = { path: 'mocks', barrel: { type: 'named' } },\n seed,\n locale = 'en',\n group,\n exclude = [],\n include,\n override = [],\n typeMode = 'inferred',\n dateParser = 'faker',\n regexGenerator = 'faker',\n printer,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n setResolver(userResolver ? Resolver.merge(resolverFaker, userResolver) : resolverFaker)\n if (userMacros?.length) {\n setMacros(userMacros)\n }\n addGenerator(fakerGenerator)\n\n return {\n output,\n seed,\n locale,\n exclude,\n include,\n override,\n typeMode,\n group: group ?? null,\n dateParser,\n regexGenerator,\n printer,\n }\n },\n})\n\nexport default pluginFaker\n"],"mappings":";;;;;;;;;;;;;;AAIA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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tD,cAAc,GAAGC,gBAAAA,eAAe,CAAC,EAAE;CACnC,MAAM,SAAS;EACb,MAAM,EACJ,SAAS;GAAE,MAAM;GAAS,QAAQ,EAAE,MAAM,QAAQ;EAAE,GACpD,MACA,SAAS,MACT,OACA,UAAU,CAAC,GACX,SACA,WAAW,CAAC,GACZ,WAAW,YACX,aAAa,SACb,iBAAiB,SACjB,SACA,UAAU,cACV,QAAQ,eACN;EAEJ,CAAA,GAAA,UAAA,YAAA,CAAY,eAAeC,UAAAA,SAAS,MAAM,eAAe,YAAY,IAAI,aAAa;EACtF,IAAI,YAAY,QACd,CAAA,GAAA,UAAA,UAAA,CAAU,UAAU;EAEtB,CAAA,GAAA,UAAA,aAAA,CAAa,cAAc;EAE3B,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA,OAAO,SAAS;GAChB;GACA;GACA;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["text","posix","casing","text","ast","ast","casing","ast","posix","File","ast","Function","ast","Diagnostics","text","createPrinter","defineGenerator","jsxRenderer","pluginTsName","ast","enumTypeName","File","buildParams","createResolver","casing","defineExtension","pluginTsName","Resolver"],"sources":["../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../src/utils.ts","../src/components/Faker.tsx","../src/utils/imports.ts","../src/printers/printerFaker.ts","../src/generators/fakerGenerator.tsx","../kubb-extension.json","../package.json","../src/resolvers/resolverFaker.ts","../src/plugin.ts"],"sourcesContent":["/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'await',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { text } from '@kubb/kit'\nimport { isIdentifier } from './reserved.ts'\n\n/**\n * Builds a JSDoc comment block from an array of lines. Returns `fallback` when there are no\n * comments.\n *\n * @example\n * ```ts\n * buildJSDoc(['@type string', '@example hello'])\n * // '/**\\n * @type string\\n * @example hello\\n *\\/\\n '\n * ```\n */\nexport function buildJSDoc(\n comments: Array<string>,\n options: {\n /**\n * String used to indent each comment line.\n * @default ' * '\n */\n indent?: string\n /**\n * String appended after the closing tag.\n * @default '\\n '\n */\n suffix?: string\n /**\n * Returned as-is when `comments` is empty.\n * @default ' '\n */\n fallback?: string\n } = {},\n): string {\n const { indent = ' * ', suffix = '\\n ', fallback = ' ' } = options\n\n if (comments.length === 0) return fallback\n\n return `/**\\n${comments.map((c) => `${indent}${c}`).join('\\n')}\\n */${suffix}`\n}\n\n/**\n * Assembles a multi-line object literal from already-rendered `entries`, indenting each entry one\n * level and closing the brace at column zero. Entries that are themselves multi-line objects indent\n * cumulatively. Each entry ends with a trailing comma to match the formatter's multi-line style.\n *\n * @example\n * ```ts\n * buildObject(['id: z.number()', 'name: z.string()'])\n * // '{\\n id: z.number(),\\n name: z.string(),\\n}'\n * ```\n */\nexport function buildObject(entries: Array<string>): string {\n if (entries.length === 0) return '{}'\n const body = entries.map((entry) => `${text.indent({ text: entry })},`).join('\\n')\n\n return `{\\n${body}\\n}`\n}\n\n/**\n * Assembles a bracketed list (array by default) from already-rendered `items`. Keeps everything on\n * one line when no item spans multiple lines, and otherwise puts each item on its own line, indented\n * one level with a trailing comma and the closing bracket at column zero. Used for member lists such\n * as `z.union([…])` and `z.array([…])`.\n *\n * @example\n * ```ts\n * buildList(['z.string()', 'z.number()'])\n * // '[z.string(), z.number()]'\n * ```\n */\nexport function buildList(items: Array<string>, brackets: [open: string, close: string] = ['[', ']']): string {\n const [open, close] = brackets\n if (items.length === 0) return `${open}${close}`\n if (!items.some((item) => item.includes('\\n'))) return `${open}${items.join(', ')}${close}`\n const body = items.map((item) => `${text.indent({ text: item })},`).join('\\n')\n\n return `${open}\\n${body}\\n${close}`\n}\n\n/**\n * Emits a lazy getter for a circular-ref property position, `get name() { return body }`. The key\n * is quoted only when it is not a valid identifier. Used by the string printers to defer evaluation\n * of a recursive schema until first access.\n *\n * @example\n * ```ts\n * lazyGetter({ name: 'parent', body: 'z.lazy(() => Pet)' })\n * // \"get parent() { return z.lazy(() => Pet) }\"\n * ```\n */\nexport function lazyGetter({ name, body }: { name: string; body: string }): string {\n return `get ${objectKey(name)}() { return ${body} }`\n}\n\n/**\n * An object key, quoted only when it is not identifier-shaped. Reserved words such as `class` stay bare.\n *\n * @example\n * ```ts\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : text.quote(name)\n}\n\n/**\n * A JSON value as a JavaScript literal, with single-quoted strings and identifier keys left unquoted.\n *\n * @example\n * ```ts\n * toLiteral({ id: 1, 'x-tag': ['a'] }) // \"{ id: 1, 'x-tag': ['a'] }\"\n * ```\n */\nexport function toLiteral(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (Array.isArray(value)) return `[${value.map(toLiteral).join(', ')}]`\n if (value && typeof value === 'object') {\n return `{ ${Object.entries(value)\n .map(([key, item]) => `${objectKey(key)}: ${toLiteral(item)}`)\n .join(', ')} }`\n }\n return String(value)\n}\n","import { posix } from 'node:path'\nimport { casing } from '@kubb/kit'\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir: string, filePath: string): string {\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = casing.camel): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : casing.camel(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; driver: { inputNode?: { schemas: ReadonlyArray<ast.SchemaNode> } | null } }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(\n (ctx.driver.inputNode?.schemas ?? []).flatMap((schema) =>\n schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : [],\n ),\n ),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = ast.http.groupParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { posix } from 'node:path'\nimport { toResponseContent } from '@internals/shared'\nimport { ensureValidVarName, getRelativePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { ResolverFaker } from './types.ts'\n\n/** The identifier a `dateParser` module is imported and called under: `my-date-lib` becomes `myDateLib`. */\nexport function dateParserName(dateParser: string): string {\n return ensureValidVarName(casing.camel(dateParser))\n}\n\n/**\n * Returns the `@faker-js/faker` named export for a locale code.\n *\n * Without a locale, returns `'faker'` for the default English instance.\n * With a locale, the language code is converted to upper case and joined with any region suffix.\n *\n * @example Default\n * `localeToFakerImport() // 'faker'`\n *\n * @example Simple locale\n * `localeToFakerImport('de') // 'fakerDE'`\n *\n * @example Compound locale\n * `localeToFakerImport('de_AT') // 'fakerDE_AT'`\n */\nexport function localeToFakerImport(locale?: string): string {\n if (!locale) {\n return 'faker'\n }\n\n const parts = locale.split('_')\n parts[0] = parts[0]!.toUpperCase()\n return `faker${parts.join('_')}`\n}\n\n/**\n * Schema types a factory cannot override with `data`: they print a constant or have no faker value.\n */\nconst NON_OVERRIDABLE_TYPES = new Set<ast.SchemaNode['type']>(['any', 'unknown', 'void', 'null', 'never', 'ipv4', 'ipv6'])\n\n/**\n * Schema types a single response cannot inline: they reference or compose other schemas.\n */\nconst NON_INLINABLE_RESPONSE_TYPES = new Set<ast.SchemaNode['type']>(['object', 'intersection', 'ref', 'never', 'ipv4', 'ipv6'])\n\n/**\n * Determines if a schema node can be overridden during faker generation.\n */\nexport function canOverrideSchema(node: ast.SchemaNode): boolean {\n return !NON_OVERRIDABLE_TYPES.has(node.type)\n}\n\n/**\n * Whether a schema can supply object properties when merging faker values.\n */\nexport function isObjectSchema(node: ast.SchemaNode, seen = new Set<ast.SchemaNode>()): boolean {\n const resolved = ast.ref.getSchema(node)\n if (seen.has(resolved)) return false\n seen.add(resolved)\n\n if (ast.schema.narrow(resolved, ast.schema.types.object) || ast.schema.narrow(resolved, ast.schema.types.ref)) return true\n const composition = ast.schema.narrow(resolved, ast.schema.types.intersection) ?? ast.schema.narrow(resolved, ast.schema.types.union)\n if (!composition) return false\n\n return (\n (composition.type === ast.schema.types.intersection && !composition.members?.length) ||\n (composition.members ?? []).some((member) => isObjectSchema(member, seen))\n )\n}\n\nfunction shouldInlineSingleResponseSchema(schema: ast.SchemaNode): boolean {\n return !NON_INLINABLE_RESPONSE_TYPES.has(schema.type)\n}\n\n/**\n * Builds a response schema as a union of the success response statuses, like the `<Operation>Response` type of\n * `@kubb/plugin-ts`, so the mock never is an error body. Falls back to every response when no success response has a schema.\n * Returns null if no responses are provided, or embeds single simple responses inline.\n */\nexport function buildResponseUnionSchema(node: ast.OperationNode, resolver: ResolverFaker): ast.SchemaNode | null {\n const withSchema = node.responses\n .map((response) => ({ ...response, content: response.content?.map((entry, _, content) => toResponseContent(entry, content)) }))\n .filter((response) => response.content?.[0]?.schema)\n const success = withSchema.filter((response) => ast.http.status.isSuccess(response))\n const responses = success.length > 0 ? success : withSchema\n\n if (!responses.length) {\n return null\n }\n\n if (responses.length === 1) {\n const schemas = responses[0]!.content?.flatMap((content) => (content.schema ? [content.schema] : [])) ?? []\n const schema = schemas.length > 1 ? ast.factory.createSchema({ type: 'union', members: schemas }) : schemas[0]\n if (schema && shouldInlineSingleResponseSchema(schema)) {\n return schema\n }\n\n return ast.factory.createSchema({\n type: 'ref',\n name: resolver.response.status(node, responses[0]!.statusCode),\n schema: responses[0]!.content?.length === 1 ? schema : undefined,\n })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: responses.map((response) => {\n const schema = (response.content?.length ?? 0) === 1 ? response.content?.[0]?.schema : undefined\n return ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, response.statusCode), schema })\n }),\n })\n}\n\nexport const SCALAR_TYPES = new Set<ast.SchemaNode['type']>([\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])\n\n/**\n * Resolves a type reference, determining if it needs an import statement or inline type reference.\n * Takes into account whether the type can be overridden and the file paths.\n */\nexport function resolveTypeReference({\n node,\n canOverride,\n name,\n typeName,\n filePath,\n typeFilePath,\n}: {\n node: ast.SchemaNode\n canOverride: boolean\n name: string\n typeName: string\n filePath: string\n typeFilePath: string\n}): { importPath?: string; typeName: string } {\n const { usesTypeName } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!usesTypeName) {\n return { typeName }\n }\n\n if (name === typeName) {\n return {\n typeName: `import('${getRelativePath(posix.dirname(filePath), typeFilePath)}').${typeName}`,\n }\n }\n\n return {\n importPath: typeFilePath,\n typeName,\n }\n}\n\n/**\n * Maps a schema node type to its corresponding scalar type representation.\n * Returns the type name for enums or the base type (string, number, etc.) for primitives.\n */\nfunction getScalarType(node: ast.SchemaNode, typeName: string): string {\n switch (node.type) {\n case 'string':\n case 'email':\n case 'url':\n case 'uuid':\n return 'string'\n case 'number':\n case 'integer':\n return 'number'\n case 'bigint':\n return 'bigint'\n case 'boolean':\n return 'boolean'\n case 'date':\n case 'time':\n return node.representation === 'date' ? 'Date' : 'string'\n case 'datetime':\n return 'string'\n case 'blob':\n return 'Blob'\n default:\n return typeName\n }\n}\n\n/**\n * Resolves faker type usage information for a schema.\n * Determines the data type, return type, and whether it uses the type name.\n */\nexport function resolveFakerTypeUsage(\n node: ast.SchemaNode,\n typeName: string,\n canOverride: boolean,\n): {\n dataType: string\n returnType: string | null\n usesTypeName: boolean\n} {\n // A nullable scalar inlines its primitive, so reapply the nullability the type plugin emitted.\n const resolvedNode = ast.ref.getSchema(node)\n const scalarType = SCALAR_TYPES.has(resolvedNode.type)\n ? `${getScalarType(resolvedNode, typeName)}${node.nullable || resolvedNode.nullable ? ' | null' : ''}`\n : undefined\n\n // Reference factories must accept the same overrides as the referenced factory.\n const dataType = scalarType ?? `Partial<${typeName}>`\n const returnType = scalarType ?? (canOverride ? typeName : null)\n\n return {\n dataType,\n returnType,\n // A non-overridable factory has no `data` param, so `dataType` never reaches the output.\n usesTypeName: (canOverride && dataType.includes(typeName)) || Boolean(returnType?.includes(typeName)),\n }\n}\n","import { jsDocEscape, objectKey } from '@internals/utils'\nimport { ast } from '@kubb/kit'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { PrinterFakerFactory } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { isObjectSchema, resolveFakerTypeUsage, SCALAR_TYPES } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.SchemaNode\n printer: ast.Printer<PrinterFakerFactory>\n description?: string\n canOverride: boolean\n typeMode?: PluginFaker['resolvedOptions']['typeMode']\n keysToOmit?: Array<string> | null\n}\n\nexport function Faker({ node, description, name, typeName, printer, canOverride, typeMode = 'inferred', keysToOmit }: Props): KubbReactNode {\n const fakerText = printer.print(node) ?? 'undefined'\n const imports = printer.drainImports().map((imp) => <File.Import key={[name, imp.path, imp.name].join('-')} {...imp} />)\n\n const isArray = node.type === 'array'\n const isObject = !!ast.schema.narrow(node, ast.schema.types.object) || (node.type === ast.schema.types.intersection && isObjectSchema(node))\n const isValueIntersection = node.type === ast.schema.types.intersection && !isObject\n const isTuple = node.type === 'tuple'\n const isScalar = SCALAR_TYPES.has(node.type)\n const isUnion = node.type === 'union'\n\n const useObjectOverride = canOverride && (isObject || !!keysToOmit?.length)\n const fakerTextWithOverride = (() => {\n if (canOverride && node.type === 'tuple') {\n return `data && data.length === ${node.items?.length ?? 0} && !data.includes(undefined) ? data : ${fakerText}`\n }\n if (canOverride && isArray) return `[\\n ...${fakerText},\\n ...(data || []).filter((item) => item !== undefined),\\n]`\n // `??` treats an explicit `null` as \"not provided\", so a nullable factory could never return\n // the `null` its own signature promises. Only `undefined` means \"generate one\".\n if (canOverride && (isScalar || isUnion || isValueIntersection)) {\n return node.nullable ? `data !== undefined ? data : ${fakerText}` : `data ?? ${fakerText}`\n }\n // A nullable ref to a scalar calls the referenced factory, whose `data` does not take `null`.\n if (canOverride && node.type === 'ref' && node.nullable && SCALAR_TYPES.has(ast.ref.getSchema(node).type)) {\n return `data === null ? data : ${fakerText}`\n }\n return fakerText\n })()\n\n const { dataType, returnType: resolvedReturnType } = resolveFakerTypeUsage(node, typeName, canOverride)\n\n if (!useObjectOverride) {\n const usesData = /\\bdata\\b/.test(fakerTextWithOverride)\n const dataParamName = usesData ? 'data' : '_data'\n const paramsSignature = `${dataParamName}?: ${dataType}`\n const returnType = resolvedReturnType\n\n // `as` binds tighter than `??`/`?:`, so tuple/union need parens or `data`'s own type leaks through.\n const needsCast = canOverride && !!returnType && ((node.type === 'ref' && !SCALAR_TYPES.has(ast.ref.getSchema(node).type)) || isArray || isTuple || isUnion)\n const needsParens = isTuple || isUnion\n const returnExpression = needsCast ? `${needsParens ? `(${fakerTextWithOverride})` : fakerTextWithOverride} as ${returnType}` : fakerTextWithOverride\n\n return (\n <>\n {imports}\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsDocEscape(description)}`] : [] }}\n params={canOverride ? paramsSignature : undefined}\n returnType={returnType ?? undefined}\n >\n {`return ${returnExpression}`}\n </Function>\n </File.Source>\n </>\n )\n }\n\n // Generate function with defaultFakeData structure\n const { cyclicSchemas, schemaName } = printer.options\n const isCyclic = !!schemaName && !!cyclicSchemas?.has(schemaName)\n const baseType = isCyclic ? typeName : 'typeof defaultFakeData'\n const returnType = typeMode === 'schema' ? typeName : `Omit<${baseType}, keyof NoInfer<TData>> & NoInfer<TData>`\n\n // When the object node has properties that transitively reference a cyclic schema,\n // the printer emits memoizing getters for those properties. Spreading the object\n // literal would immediately invoke those getters, triggering recursive faker calls\n // and causing a stack overflow. Detect this upfront via ast helpers so we can\n // use Object.defineProperty-based merging instead of spread.\n const hasGetters =\n node.type === 'object' &&\n !!cyclicSchemas &&\n (node.properties ?? []).some((p) => ast.graph.containsCircular(p.schema, { circularSchemas: cyclicSchemas, excludeName: schemaName }))\n\n // A non-object root (such as an `allOf` with a `oneOf` member) or an object padded up to `minProperties` gives\n // `defaultFakeData` a type TypeScript does not relate to the `Omit` of it.\n const castThroughUnknown = (node.type !== 'object' || node.min !== undefined) && typeMode !== 'schema'\n\n const defaults = keysToOmit?.length\n ? `{ ${keysToOmit.map((key, index) => `${objectKey(key)}: _omit${index}`).join(', ')}, ...defaultFakeData }`\n : 'defaultFakeData'\n const declaration = `const ${defaults} = ${fakerText}`\n const functionBody = hasGetters\n ? `${declaration}\nif (data) {\n for (const [key, value] of Object.entries(data)) {\n Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })\n }\n}\nreturn defaultFakeData as ${returnType}`\n : `${declaration}\nreturn {\n ...defaultFakeData,\n ...(data || {}),\n} as ${castThroughUnknown ? 'unknown as ' : ''}${returnType}`\n\n return (\n <>\n {imports}\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: description ? [`@description ${jsDocEscape(description)}`] : [] }}\n generics={typeMode === 'schema' ? undefined : `TData extends Partial<${typeName}> = object`}\n params={typeMode === 'schema' ? `data?: Partial<${typeName}>` : 'data?: TData'}\n returnType={typeMode === 'schema' || isCyclic ? returnType : undefined}\n >\n {functionBody}\n </Function>\n </File.Source>\n </>\n )\n}\n","export type ImportName = string | { propertyName: string; name?: string }\n\nexport type ImportEntry = {\n name: string | Array<ImportName>\n path: string\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction getImportNames(entry: ImportEntry): Array<string> {\n return (Array.isArray(entry.name) ? entry.name : [entry.name])\n .map((name) => {\n if (typeof name === 'string') {\n return name\n }\n\n return name.name ?? name.propertyName\n })\n .filter((name): name is string => Boolean(name))\n}\n\n/**\n * Keeps the imports whose names `text` calls, as `name(` or `name<`, minus `skipImportNames`.\n */\nexport function filterUsedImports(imports: Array<ImportEntry>, text: string, skipImportNames: Array<string> = []): Array<ImportEntry> {\n const skip = new Set(skipImportNames)\n // One scan of `text` instead of a new RegExp per import name. Generated helpers can use explicit\n // type arguments, such as `createPet<object>()`.\n const called = new Set(text.match(/\\b\\w+(?=\\s*[<(])/g))\n\n return imports.filter((entry) => {\n const names = getImportNames(entry)\n\n return names.some((name) => {\n if (skip.has(name)) {\n return false\n }\n\n return /^\\w+$/.test(name) ? called.has(name) : new RegExp(`\\\\b${escapeRegExp(name)}\\\\b(?=\\\\s*[<(])`).test(text)\n })\n })\n}\n\nexport function aliasConflictingImports(\n imports: Array<ImportEntry>,\n reservedNames: Iterable<string>,\n): { imports: Array<ImportEntry>; aliases: Map<string, string> } {\n const reservedNameSet = new Set(reservedNames)\n const aliases = new Map<string, string>()\n\n const aliasedImports = imports.map((entry) => {\n const names = Array.isArray(entry.name) ? entry.name : [entry.name]\n const aliasedNames = names.map((item): ImportName => {\n if (typeof item !== 'string' || !reservedNameSet.has(item)) {\n return item\n }\n\n const alias = `${item}Schema`\n aliases.set(item, alias)\n\n return { propertyName: item, name: alias }\n })\n\n return aliasedNames.some((item) => typeof item === 'object' && item.name)\n ? {\n ...entry,\n name: aliasedNames,\n }\n : entry\n })\n\n return {\n imports: aliasedImports,\n aliases,\n }\n}\n\nexport function rewriteAliasedImports(text: string, aliases: ReadonlyMap<string, string>): string {\n return Array.from(aliases).reduce((acc, [name, alias]) => acc.replace(new RegExp(`\\\\b${escapeRegExp(name)}\\\\b`, 'g'), alias), text)\n}\n","import { buildObject, objectKey, toRegExpString } from '@internals/utils'\nimport { ast, createPrinter, Diagnostics, text } from '@kubb/kit'\nimport type { PluginFaker, ResolverFaker } from '../types.ts'\nimport { canOverrideSchema, dateParserName, isObjectSchema } from '../utils.ts'\n\n/**\n * Partial map of node-type overrides for the Faker printer. Each key is a\n * `SchemaType` (`'string'`, `'date'`, ...) and each handler returns the\n * Faker expression for that schema as a string. Use `this.transform` to\n * recurse into nested schema nodes, `this.base` to reuse the built-in handler,\n * and `this.options` to read printer options.\n *\n * @example Override the integer handler\n * ```ts\n * pluginFaker({\n * printer: {\n * nodes: {\n * integer() {\n * return 'faker.number.float()'\n * },\n * },\n * },\n * })\n * ```\n */\nexport type PrinterFakerNodes = ast.PrinterPartial<string, PrinterFakerOptions>\n\n/**\n * Options passed to the Faker printer at instantiation: the parser library\n * for date strings, the regex generator, and the resolver used to compute\n * identifiers.\n */\nexport type PrinterFakerOptions = {\n dateParser?: PluginFaker['resolvedOptions']['dateParser']\n regexGenerator?: PluginFaker['resolvedOptions']['regexGenerator']\n resolver: ResolverFaker\n typeName?: string\n schemaName?: string\n nestedInObject?: boolean\n /**\n * Set while printing the members of a union (`oneOf`). Object properties then index their\n * type as `(NonNullable<T> & Record<K, unknown>)[K]` instead of `NonNullable<T>[K]`, so a key\n * carried by only some branches stays valid (a plain index would be a TS2339).\n */\n nestedInUnion?: boolean\n nodes?: PrinterFakerNodes\n /**\n * Names of schemas that participate in a circular dependency chain.\n * Properties whose schema transitively references one of these are emitted\n * as lazy getters so that user overrides via the `data` parameter prevent\n * the recursive faker call from ever executing (avoiding stack overflow).\n */\n cyclicSchemas?: ReadonlySet<string>\n}\n\n/**\n * Factory options for the Faker printer, defining input/output types and configuration.\n */\nexport type PrinterFakerFactory = ast.PrinterFactoryOptions<'faker', PrinterFakerOptions, string, string>\n\n/**\n * Formats that put a whole number inside a `type: 'string'` schema, the way ProtoJSON encodes\n * 64-bit integers, so the mock has to be digits rather than letters.\n *\n * @see https://protobuf.dev/programming-guides/json/#int64-strings\n */\nconst integerFormats: ReadonlySet<string> = new Set(['int32', 'int64', 'uint64'])\n\nconst maxInt32 = 2_147_483_647\n// The largest value of a 32-bit format, which faker's default `max` exceeds.\nconst maxValueByFormat: Record<string, number> = { int32: maxInt32, uint32: 4_294_967_295 }\n\n// A ref back into its own cycle is left empty, so a mock of a recursive schema is finite and can be serialized.\nfunction isCyclicRef(node: ast.SchemaNode, { schemaName, cyclicSchemas }: PrinterFakerOptions): boolean {\n if (node.type !== 'ref' || !schemaName) return false\n const refName = ast.ref.getName(node)\n\n return refName === schemaName || Boolean(refName && cyclicSchemas?.has(schemaName) && cyclicSchemas.has(refName))\n}\n\n/**\n * `faker.number.float()`, `faker.number.int()` or `faker.number.bigInt()`, with `min` and `max` passed only when set,\n * moved inside an exclusive bound, or needed so a lone bound does not contradict faker's default for the other.\n */\nfunction numberCall(\n kind: 'float' | 'int' | 'bigInt',\n { min, max, exclusive, multipleOf }: Pick<ast.NumberSchemaNode, 'min' | 'max' | 'exclusive' | 'multipleOf'>,\n): string {\n const isWhole = kind !== 'float'\n // Faker's `int` and `bigInt` reject a fractional `multipleOf`.\n const grid = isWhole && !Number.isInteger(multipleOf) ? undefined : multipleOf\n // Faker returns points of the `multipleOf` grid, ends included, so an exclusive bound moves to the next point.\n // shortcut: without a grid a float's exclusive `min` is passed as is, so faker can return it by chance; nudge it up once a mock hits it.\n const { min: lower, max: upper } = ast.schema.getNumberBounds({ min, max, exclusive, integer: isWhole, step: grid })\n // Faker fills a missing `min` with `0`, and a float's missing `max` with `1`, which a lone bound on the other side contradicts.\n // The span holds grid points, so faker always finds a multiple.\n const span = 100 * (grid ?? 1)\n const maxValue = kind === 'float' && lower !== undefined && upper === undefined && (lower >= 1 || grid !== undefined) ? lower + span : upper\n const minValue = maxValue !== undefined && lower === undefined && (isWhole ? maxValue < 0 : maxValue <= 0) ? maxValue - span : lower\n const suffix = kind === 'bigInt' ? 'n' : ''\n const args = [\n minValue !== undefined && `min: ${minValue}${suffix}`,\n maxValue !== undefined && `max: ${maxValue}${suffix}`,\n grid !== undefined && `multipleOf: ${grid}${suffix}`,\n ]\n .filter(Boolean)\n .join(', ')\n\n return `faker.number.${kind}(${args ? `{ ${args} }` : ''})`\n}\n\n/**\n * A `date` or `time` value: an ISO substring, a `dateParser` call, or a `Date` when `representation` is `'date'`.\n */\nfunction dateTimeCall(\n representation: 'date' | 'string',\n { format, substring }: { format: string; substring: string },\n parser: PluginFaker['resolvedOptions']['dateParser'] = 'faker',\n schemaName?: string,\n): string {\n if (representation === 'string') {\n return parser !== 'faker'\n ? `${dateParserName(parser)}(faker.date.anytime()).format(\"${format}\")`\n : `faker.date.anytime().toISOString().substring(${substring})`\n }\n\n if (parser !== 'faker') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Option \\`dateParser: '${parser}'\\` cannot format the adapter's \\`dateType: 'date'\\` values${schemaName ? ` in schema \"${schemaName}\"` : ''}.`,\n help: \"Set adapterOas({ dateType: 'string' }) or remove `dateParser`.\",\n location: { kind: 'config' },\n plugin: 'plugin-faker',\n })\n }\n\n return 'faker.date.anytime()'\n}\n\n// Eight letters or digits are base64url as they are: no padding, and none of the characters base64 swaps.\nconst encodingCalls = new Map<string | undefined, string>([\n ['base64', 'btoa(faker.string.alpha())'],\n ['base64url', 'faker.string.alphanumeric(8)'],\n])\n\n// Formats `plugin-zod` checks with a dedicated constructor, which a random string fails.\nconst stringFormatCalls = new Map<string | undefined, string>([\n ['jwt', 'faker.internet.jwt()'],\n ['ulid', 'faker.string.ulid()'],\n ['iban', 'faker.finance.iban()'],\n ['duration', \"'P1D'\"],\n ['hostname', 'faker.internet.domainName()'],\n])\n\n// The members an escape becomes inside a character class: `\\d` and `\\w`, and the punctuation `faker.helpers.fromRegExp` reads there.\nconst classEscapes = new Map<string, string>([['d', '0-9'], ['w', 'A-Za-z0-9_'], ...Array.from('-!@#$&()`.+,\"', (char): [string, string] => [char, char])])\n\n// `faker.helpers.fromRegExp` prints `\\d`, `\\w`, escaped literals and an open-ended `{n,}` as written, so they become classes and `{n,n+10}`.\n// shortcut: groups, alternation and `\\s` stay unsupported, as `regexGenerator: 'randexp'` covers them.\nfunction toFakerPattern(pattern: string): string {\n let result = ''\n let inClass = false\n // Where the open class's members start, after `[` or `[^`: faker reads a literal `-` only there.\n let classStart = -1\n for (let index = 0; index < pattern.length; index++) {\n const char = pattern[index]!\n const next = pattern[index + 1]\n if (char === '\\\\' && next !== undefined) {\n index++\n if (inClass && next === '-') {\n if (result[classStart] !== '-') result = `${result.slice(0, classStart)}-${result.slice(classStart)}`\n continue\n }\n const classMembers = classEscapes.get(next)\n if (classMembers === undefined) {\n result += `\\\\${next}`\n continue\n }\n result += inClass ? classMembers : `[${classMembers}]`\n continue\n }\n if (char === '[' && !inClass) {\n inClass = true\n result += next === '^' ? '[^' : '['\n if (next === '^') index++\n classStart = result.length\n continue\n }\n if (char === ']') inClass = false\n result += char\n }\n\n return result.replace(/\\{(\\d+),\\}/g, (_, min: string) => `{${min},${Number(min) + 10}}`)\n}\n\nfunction matches(value: string, regexGenerator: 'faker' | 'randexp' = 'faker'): string {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n\n return `faker.helpers.fromRegExp(${toRegExpString(toFakerPattern(value), null)})`\n}\n\nfunction parseEnumValue(value: string | number | boolean | null | undefined) {\n if (typeof value === 'string') {\n return text.quote(value)\n }\n\n return value\n}\n\n/**\n * Reads the discriminator literal off a variant, with whether its property is required, or\n * `undefined` when it can't be determined.\n *\n * A variant carries exactly one discriminator value, so a property resolving to several literals\n * (a `ref` to the enum shared by every branch, say) identifies no branch and narrows nothing.\n */\nfunction getDiscriminator(\n member: ast.SchemaNode,\n discriminatorPropertyName: string,\n): { value: string | number | boolean | null; required: boolean } | undefined {\n for (const property of ast.schema.findProperties({ node: member, propertyName: discriminatorPropertyName })) {\n const values = ast.schema.getLiterals(property.schema)\n if (values.length === 1) {\n return { value: values[0]!, required: property.required }\n }\n }\n\n return undefined\n}\n\n/**\n * Type expression for an object property's value, indexed off the parent `typeName`.\n *\n * In a union (`oneOf`), a key that only some branches declare turns a plain `NonNullable<T>[K]`\n * into a TS2339 error, so union members guard the access. The breakdown is below.\n */\nfunction indexedTypeName(typeName: string, propertyName: string, nestedInUnion?: boolean): string {\n const key = JSON.stringify(propertyName)\n\n // `(NonNullable<T> & Record<K, unknown>)[K]`, read inside-out:\n // NonNullable<T> strips null and undefined from the parent type T.\n // & Record<K, unknown> forces every branch to have key K. A branch that already declares K\n // keeps it (`T[K] & unknown` is `T[K]`); a branch missing K gains it as `unknown`.\n // [K] reads the key, which is now always present, so it never hits TS2339.\n // For a single object T the intersection does nothing, leaving `T[K]`.\n return nestedInUnion ? `(NonNullable<${typeName}> & Record<${key}, unknown>)[${key}]` : `NonNullable<${typeName}>[${key}]`\n}\n\n// In a union only some branches are arrays, and indexing the others with `number` is a TS2537 error.\nfunction itemTypeName(typeName: string, nestedInUnion?: boolean): string {\n return nestedInUnion ? `Extract<NonNullable<${typeName}>, ReadonlyArray<unknown>>[number]` : `NonNullable<${typeName}>[number]`\n}\n\n/**\n * Creates a Faker printer that generates mock data generation code from schema nodes.\n * Handles circular references gracefully by emitting memoizing getters for cyclic properties.\n */\nexport const printerFaker: (options: PrinterFakerOptions) => ast.Printer<PrinterFakerFactory> = createPrinter<PrinterFakerFactory>((options) => {\n const printNested = (node: ast.SchemaNode, overrideOptions: Partial<PrinterFakerOptions> = {}): string => {\n return (\n printerFaker({\n ...options,\n ...overrideOptions,\n nodes: options.nodes,\n }).print(node) ?? 'undefined'\n )\n }\n\n return {\n name: 'faker',\n options,\n nodes: {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n boolean: () => 'faker.datatype.boolean()',\n null: () => 'null',\n string(node) {\n if (node.pattern) {\n return matches(node.pattern, this.options.regexGenerator)\n }\n\n if (node.format && integerFormats.has(node.format)) {\n return node.format === 'int32' ? `faker.number.int({ max: ${maxInt32} }).toString()` : 'faker.number.bigInt().toString()'\n }\n\n const formatCall = stringFormatCalls.get(node.format)\n if (formatCall) return formatCall\n\n const contentSchema = ast.schema.getEmbeddedJson(node)\n // The document is typed by its own schema, not by the string that holds it.\n if (contentSchema) return `JSON.stringify(${printNested(contentSchema, { typeName: undefined, nestedInObject: true, nestedInUnion: false })})`\n\n const encodingCall = encodingCalls.get(node.content?.encoding?.toLowerCase())\n if (encodingCall) return encodingCall\n\n const { min, max } = node\n // A string as long as a large `maxLength` makes a mock of megabytes, so the length stays within 100 of the minimum.\n if (max !== undefined) return `faker.string.alpha({ length: { min: ${min ?? Math.min(1, max)}, max: ${Math.min(max, (min ?? 0) + 100)} } })`\n if (min !== undefined) return `faker.string.alpha({ length: ${min} })`\n\n return 'faker.string.alpha()'\n },\n email: () => 'faker.internet.email()',\n url: () => 'faker.internet.url()',\n uuid: () => 'faker.string.uuid()',\n ipv4: () => 'faker.internet.ipv4()',\n ipv6: () => 'faker.internet.ipv6()',\n number: (node) => numberCall('float', node),\n integer: (node) =>\n numberCall(\n 'int',\n node.format && node.format in maxValueByFormat ? { ...node, max: Math.min(node.max ?? Infinity, maxValueByFormat[node.format]!) } : node,\n ),\n bigint: (node) => numberCall('bigInt', node),\n blob: () => 'new Blob([faker.string.alpha()])',\n datetime(node) {\n const parser = this.options.dateParser ?? 'faker'\n if (parser === 'faker') return 'faker.date.anytime().toISOString()'\n // ISO 8601 that matches the node: no zone when local, a numeric offset, or UTC `Z`.\n const format = node.local ? 'YYYY-MM-DDTHH:mm:ss' : node.offset ? 'YYYY-MM-DDTHH:mm:ssZ' : 'YYYY-MM-DDTHH:mm:ss[Z]'\n\n return `${dateParserName(parser)}(faker.date.anytime()).format(\"${format}\")`\n },\n date(node) {\n return dateTimeCall(node.representation ?? 'string', { format: 'YYYY-MM-DD', substring: '0, 10' }, this.options.dateParser, this.options.schemaName)\n },\n time(node) {\n return dateTimeCall(node.representation ?? 'string', { format: 'HH:mm:ss', substring: '11, 19' }, this.options.dateParser, this.options.schemaName)\n },\n ref(node) {\n // `ast.ref.getName` prefers the node's `targetName` (set for collision or macro renames),\n // then the $ref path segment, since node.name may have been overridden (e.g. by\n // single-member allOf flatten using the property-derived child name). Inline refs\n // (without $ref) from faker utils already carry resolved helper names.\n const refName = ast.ref.getName(node)\n\n if (!refName) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.pluginFailed,\n severity: 'error',\n message: `Ref node \"${node.ref ?? node.name ?? 'unknown'}\"${this.options.schemaName ? ` in schema \"${this.options.schemaName}\"` : ''} has no name.`,\n plugin: 'plugin-faker',\n })\n }\n\n if (isCyclicRef(node, this.options)) {\n return this.options.typeName ? `undefined as unknown as ${this.options.typeName}` : 'undefined as unknown'\n }\n\n // Internal helper refs (for generated response/data helpers) are already\n // emitted with resolver output and should not be transformed twice.\n const resolvedName = node.ref ? this.options.resolver.name(refName) : refName\n\n if (!this.options.nestedInObject && canOverrideSchema(ast.ref.getSchema(node))) {\n return `${resolvedName}(data)`\n }\n\n return `${resolvedName}()`\n },\n enum(node) {\n const { typeName } = this.options\n const values = ast.schema.getLiterals(node)\n\n if (values.length === 1 && values[0] !== null && typeof values[0] === 'object') {\n return JSON.stringify(values[0])\n }\n\n // The values are asserted as the property's type, not checked against it. Inside an `allOf` or `oneOf` that type can be\n // narrower than the enum, or `never`, and a type argument would then reject the values the schema itself lists.\n return `faker.helpers.arrayElement([${values.map(parseEnumValue).join(', ')}]${typeName ? ` as Array<${typeName}>` : ''})`\n },\n union(node): string {\n const { discriminatorPropertyName } = node\n const baseTypeName = this.options.typeName\n\n // A member that points back into the cycle would print `undefined`, so the mock picks among the others. A discriminated\n // variant (`allOf: [ref, { type }]`) counts too: spreading its ref reads every lazy getter, which recurses without end.\n const isCyclicMember = (member: ast.SchemaNode) =>\n isCyclicRef(member, this.options) || (member.type === 'intersection' && (member.members ?? []).some((part) => isCyclicRef(part, this.options)))\n const acyclicMembers = (node.members ?? []).filter((member) => !isCyclicMember(member))\n const members = acyclicMembers.length ? acyclicMembers : node.members\n\n const items: Array<string> = (members ?? [])\n .map((member) => {\n // For a discriminated union, narrow each variant to its own branch so nested\n // `NonNullable<T>[K]` indexes resolve against that branch instead of the whole union.\n const discriminator = discriminatorPropertyName ? getDiscriminator(member, discriminatorPropertyName) : undefined\n\n if (baseTypeName && discriminator) {\n // An optional discriminator (`strategy?: 'a'`) does not extend `{ strategy: 'a' }`,\n // so match it as optional too.\n const key = `${JSON.stringify(discriminatorPropertyName)}${discriminator.required ? '' : '?'}`\n const typeName = `Extract<NonNullable<${baseTypeName}>, { ${key}: ${parseEnumValue(discriminator.value)} }>`\n\n return printNested(member, { typeName, nestedInObject: true, nestedInUnion: true })\n }\n\n // Without a discriminator, keep the union type but guard each indexed access (see\n // `indexedTypeName`) so a key carried by only some branches resolves to `unknown`\n // rather than erroring with TS2339.\n return printNested(member, { typeName: baseTypeName, nestedInObject: true, nestedInUnion: true })\n })\n .filter((item): item is string => Boolean(item))\n\n return `faker.helpers.arrayElement([${items.join(', ')}])`\n },\n intersection(node): string {\n const objectMembers = (node.members ?? []).filter((member) => isObjectSchema(member))\n // A ref (the base) spreads first and a union last, so neither a base nor a sibling object overwrites the narrower value\n // an extension or a discriminator sets.\n const memberRank = (member: ast.SchemaNode) => (member.type === 'ref' ? 0 : member.type === 'union' ? 2 : 1)\n const members = objectMembers.length ? objectMembers.toSorted((a, b) => memberRank(a) - memberRank(b)) : node.members\n const items: Array<string> = (members ?? [])\n .map((member) =>\n printNested(member, {\n nestedInObject: true,\n // Only a ref to the schema itself is cut: a cycle through another schema is cut at the property that closes it.\n ...(member.type === 'ref' && ast.ref.getName(member) !== this.options.schemaName ? { cyclicSchemas: undefined } : {}),\n }),\n )\n // An `allOf` member with no shape (any/unknown/void → 'undefined') adds no\n // constraint. Keeping it would spread `...undefined` into the merged object.\n .filter((item): item is string => Boolean(item) && item !== 'undefined')\n\n if (items.length === 0) return '{}'\n\n return !objectMembers.length || items.length === 1 ? items.at(-1)! : `{...${items.join(', ...')}}`\n },\n array(node): string {\n // An array of items that would recurse stays empty, which is valid where a list of `undefined` is not.\n if (node.items?.length === 1 && isCyclicRef(node.items[0]!, this.options)) return this.options.typeName ? `[] as ${this.options.typeName}` : '[]'\n\n const items: Array<string> = (node.items ?? [])\n .map((member) =>\n printNested(member, {\n typeName: this.options.typeName ? itemTypeName(this.options.typeName, this.options.nestedInUnion) : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n\n const { min, max } = node\n const item = items[0]\n // Like a string, a list stays within 100 items of its minimum, however large `maxItems` is.\n const countRange = max === undefined ? undefined : `{ min: ${min ?? 0}, max: ${Math.min(max, (min ?? 0) + 100)} }`\n // `uniqueArray` takes a fixed length and compares like the zod `Set` check. It returns fewer items when the generator runs out of values.\n if (node.unique) return `faker.helpers.uniqueArray(() => (${item}), ${countRange ? `faker.number.int(${countRange})` : (min ?? 3)})`\n if (countRange) return `faker.helpers.multiple(() => (${item}), { count: ${countRange}})`\n if (min !== undefined) return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple(node): string {\n const items: Array<string> = (node.items ?? [])\n .map((member, index) =>\n printNested(member, {\n typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${index}]` : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return `[${items.join(', ')}]`\n },\n object(node): string {\n const cyclicSchemas = this.options.cyclicSchemas\n const keySchema = node.propertyNames && ast.ref.mergeSchema(node.propertyNames)\n const valueSchema = node.additionalProperties\n const recordProperties =\n keySchema?.type === 'enum' && typeof valueSchema === 'object'\n ? ast.schema\n .getLiterals(keySchema)\n .filter((key): key is string => typeof key === 'string' && !node.properties.some((property) => property.name === key))\n .map((name) => ast.factory.createProperty({ name, schema: valueSchema }))\n : []\n const properties = [...node.properties, ...recordProperties]\n // `maxProperties` keeps the required properties first.\n const keptProperties = node.max === undefined ? properties : properties.toSorted((a, b) => Number(b.required) - Number(a.required)).slice(0, node.max)\n // `minProperties` adds keys from `additionalProperties`, skipping any name a declared property uses.\n const declaredNames = new Set(properties.map((property) => property.name))\n const extras: typeof keptProperties = []\n for (let index = 1; typeof valueSchema === 'object' && keptProperties.length + extras.length < (node.min ?? 0); index++) {\n const name = `additionalProperty${index}`\n if (!declaredNames.has(name)) extras.push(ast.factory.createProperty({ name, schema: valueSchema }))\n }\n const entries = [...keptProperties, ...extras].map((property): string => {\n const value: string =\n printNested(property.schema, {\n typeName: this.options.typeName ? indexedTypeName(this.options.typeName, property.name, this.options.nestedInUnion) : undefined,\n nestedInObject: true,\n // A required ref to another schema stays, since `undefined` would fail it: the lazy getter keeps the mock finite,\n // and the cycle is cut where it is optional, in a union, or in an array.\n ...(property.required && property.schema.type === 'ref' ? { cyclicSchemas: undefined } : {}),\n }) ?? 'undefined'\n\n // When the property's schema transitively references a schema that is\n // part of a circular dependency (other than the current schema itself),\n // emit a memoizing lazy getter. On first access it computes the value,\n // replaces itself with a plain data property via Object.defineProperty,\n // and returns the cached value, so every subsequent read is stable.\n if (cyclicSchemas && ast.graph.containsCircular(property.schema, { circularSchemas: cyclicSchemas, excludeName: this.options.schemaName })) {\n return `get ${objectKey(property.name)}() { const _value = ${value}; Object.defineProperty(this, ${JSON.stringify(property.name)}, { value: _value, configurable: true, writable: true, enumerable: true }); return _value }`\n }\n\n return `${objectKey(property.name)}: ${value}`\n })\n\n return buildObject(entries)\n },\n },\n overrides: options.nodes,\n }\n})\n","import { getCircularNames, getPerContentTypeName, resolveContentTypeVariants, resolveOperationFile, toResponseContent } from '@internals/shared'\nimport { aliasConflictingImports, filterUsedImports, rewriteAliasedImports } from '../utils/imports.ts'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { buildParams, enumTypeName, pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Faker } from '../components/Faker.tsx'\nimport { printerFaker } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport { buildResponseUnionSchema, canOverrideSchema, dateParserName, localeToFakerImport, resolveTypeReference } from '../utils.ts'\n\ntype RenderUnit = {\n schema: ast.SchemaNode | null\n name: string\n typeName: string\n description?: string\n keysToOmit?: Array<string> | null\n skipImportNames?: Array<string>\n}\n\n/**\n * Built-in generator for `@kubb/plugin-faker`. Emits one `createX` factory\n * per schema in the spec plus per-operation request/response factories. Each\n * factory returns a value matching the corresponding TypeScript type from\n * `@kubb/plugin-ts`.\n */\nexport const fakerGenerator = defineGenerator<PluginFaker>({\n name: 'faker',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, dateParser, regexGenerator, seed, locale, printer, typeMode } = ctx.options\n const pluginTs = ctx.requirePlugin(pluginTsName)\n\n if (!node.name) {\n return\n }\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const schemaName = node.name\n const isEnumSchema = !!ast.schema.narrow(node, ast.schema.types.enum)\n const schemaTypeName = enumTypeName({ resolver: tsResolver, name: schemaName, enumOptions: pluginTs.options?.enum, isEnum: isEnumSchema })\n const meta = {\n name: resolver.name(schemaName),\n file: resolver.file({ name: schemaName, extname: '.ts', root, output, group: group ?? undefined }),\n typeName: schemaTypeName,\n typeFile: tsResolver.file({\n name: schemaName,\n extname: '.ts',\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n } as const\n const canOverride = canOverrideSchema(node)\n const cyclicSchemas = getCircularNames(ctx)\n const printerInstance = printerFaker({\n resolver,\n schemaName,\n typeName: meta.typeName,\n dateParser,\n regexGenerator,\n nodes: printer?.nodes,\n cyclicSchemas,\n })\n const fakerText = printerInstance.print(node) ?? 'undefined'\n const typeReference = resolveTypeReference({\n node,\n canOverride,\n name: meta.name,\n typeName: meta.typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n const imports = resolver.imports({ node, root, output, group: group ?? undefined, checks: true })\n const usedImports = filterUsedImports(imports, fakerText)\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParserName(dateParser)} />}\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[meta.typeName]} />}\n {usedImports.map((imp) => (\n <File.Import key={[schemaName, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n {seed !== undefined ? <File.Source name=\"faker-seed\">{`faker.seed(${JSON.stringify(seed)})`}</File.Source> : undefined}\n <Faker\n name={meta.name}\n typeName={typeReference.typeName}\n description={node.description}\n node={node}\n printer={printerInstance}\n canOverride={canOverride}\n typeMode={typeMode}\n />\n </File>\n )\n },\n operation(node, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, dateParser, regexGenerator, seed, locale, printer, typeMode } = ctx.options\n const pluginTs = ctx.requirePlugin(pluginTsName)\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const { path: pathParams, query: queryParams, header: headerParams, cookie: cookieParams } = ast.http.groupParameters(node)\n const paramGroups = (\n [\n { params: pathParams, name: resolver.param.path, typeName: tsResolver.param.path },\n { params: queryParams, name: resolver.param.query, typeName: tsResolver.param.query },\n { params: headerParams, name: resolver.param.headers, typeName: tsResolver.param.headers },\n { params: cookieParams, name: resolver.param.cookies, typeName: tsResolver.param.cookies },\n ] as const\n )\n .filter((group) => group.params.length > 0)\n .map((group) => ({\n schema: buildParams({ params: group.params }),\n name: group.name(node, group.params[0]!),\n typeName: group.typeName(node, group.params[0]!),\n }))\n // Expands a content array into render units: one faker per content type plus a union faker\n // (named `baseName`) when more than one content type carries a schema, else a single faker.\n function expandContentUnits(\n entries: Array<ast.ContentNode>,\n baseName: string,\n tsBaseName: string,\n description: string | undefined,\n decorate?: (schema: ast.SchemaNode) => ast.SchemaNode,\n ): Array<RenderUnit> {\n const withSchema = entries.filter((entry) => entry.schema)\n if (withSchema.length <= 1) {\n const primary = withSchema[0] ?? entries[0]\n if (!primary?.schema) return []\n return [\n {\n schema: decorate ? decorate(primary.schema) : primary.schema,\n name: baseName,\n typeName: tsBaseName,\n description,\n keysToOmit: primary.keysToOmit,\n },\n ]\n }\n const variants = resolveContentTypeVariants(entries, baseName)\n const unionSchema = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name, schema: variant.schema })),\n })\n return [\n ...variants.map((variant) => ({\n schema: decorate ? decorate(variant.schema) : variant.schema,\n name: variant.name,\n typeName: getPerContentTypeName(tsBaseName, variant.suffix),\n description,\n keysToOmit: variant.keysToOmit,\n })),\n { schema: unionSchema, name: baseName, typeName: tsBaseName, description, skipImportNames: variants.map((variant) => variant.name) },\n ]\n }\n\n const responseUnits = node.responses.flatMap((response) =>\n expandContentUnits(\n (response.content ?? []).map((entry, _, content) => toResponseContent(entry, content)),\n resolver.response.status(node, response.statusCode),\n tsResolver.response.status(node, response.statusCode),\n response.description,\n ),\n )\n const dataUnits = expandContentUnits(\n node.requestBody?.content ?? [],\n resolver.response.body(node),\n tsResolver.response.body(node),\n node.requestBody?.description,\n (schema) => ({ ...schema, description: node.requestBody?.description ?? schema.description }),\n )\n const responseName = resolver.response.response(node)\n const importedResponseNames = new Set(ast.http.responses.getImportedNames(node.responses).map((name) => resolver.name(name)))\n const hasResponseNameCollision = importedResponseNames.has(responseName)\n const localHelperNames = new Set([\n ...paramGroups.map((group) => group.name),\n ...responseUnits.map((unit) => unit.name),\n ...dataUnits.map((unit) => unit.name),\n ...(hasResponseNameCollision ? [] : [responseName]),\n ])\n const cyclicSchemas = getCircularNames(ctx)\n\n const meta = {\n file: resolveOperationFile({ ctx, node, resolver, root, output, group }),\n typeFile: resolveOperationFile({\n ctx,\n node,\n resolver: tsResolver,\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n }),\n } as const\n\n function resolveMockImports(schema: ast.SchemaNode) {\n return resolver.imports({ node: schema, root, output, group: group ?? undefined, checks: true }).filter((entry) => entry.path !== meta.file.path)\n }\n\n function renderEntry({ schema, name, typeName, description, keysToOmit, skipImportNames = [] }: RenderUnit) {\n if (!schema) {\n return null\n }\n\n if (schema.type === ast.schema.types.object && keysToOmit?.length) {\n schema = { ...schema, properties: schema.properties.filter((property) => !keysToOmit?.includes(property.name)) }\n keysToOmit = undefined\n }\n\n const canOverride = canOverrideSchema(schema)\n const printerInstance = printerFaker({\n resolver,\n schemaName: name,\n typeName,\n dateParser,\n regexGenerator,\n nodes: printer?.nodes,\n cyclicSchemas,\n nestedInObject: !!keysToOmit?.length,\n })\n const fakerText = printerInstance.print(schema) ?? 'undefined'\n const usedImports = filterUsedImports(resolveMockImports(schema), fakerText, skipImportNames)\n const { imports, aliases } = aliasConflictingImports(usedImports, localHelperNames)\n const rewrittenFakerText = rewriteAliasedImports(fakerText, aliases)\n const typeReference = resolveTypeReference({\n node: schema,\n canOverride,\n name,\n typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n return (\n <>\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[typeName]} />}\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={name}\n typeName={typeReference.typeName}\n description={description}\n node={schema}\n printer={{ ...printerInstance, print: () => rewrittenFakerText }}\n canOverride={canOverride}\n typeMode={typeMode}\n keysToOmit={keysToOmit}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParserName(dateParser)} />}\n {seed !== undefined ? <File.Source name=\"faker-seed\">{`faker.seed(${JSON.stringify(seed)})`}</File.Source> : undefined}\n {paramGroups.map((group) => renderEntry(group))}\n {responseUnits.map((unit) => renderEntry(unit))}\n {dataUnits.map((unit) => renderEntry(unit))}\n {!hasResponseNameCollision &&\n renderEntry({\n schema: buildResponseUnionSchema(node, resolver),\n name: responseName,\n typeName: tsResolver.response.response(node),\n skipImportNames: responseUnits.map((unit) => unit.name),\n })}\n </File>\n )\n },\n})\n","","","import { createCasedFile, createOperationParamResolver, createOperationResponseResolver } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, createResolver } from '@kubb/kit'\nimport type { PluginFaker } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-faker`. Decides the names and file\n * paths for every generated mock factory. Functions and files are prefixed\n * with `create` so `Pet` becomes `createPet`.\n *\n * @example Resolve a factory name\n * ```ts\n * import { resolverFaker } from '@kubb/plugin-faker'\n *\n * resolverFaker.name('list pets') // 'createListPets'\n * ```\n */\nexport const resolverFaker = createResolver<PluginFaker>({\n pluginName: 'plugin-faker',\n name(name) {\n return this.memo(`name:${name}`, () => ensureValidVarName(casing.camel(name, { prefix: 'create' })))\n },\n file: createCasedFile((part) => casing.camel(part, { prefix: 'create' })),\n param: createOperationParamResolver(),\n response: createOperationResponseResolver(),\n})\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport { resolverFaker } from './resolvers/resolverFaker.ts'\nimport type { PluginFaker } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-faker`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\n/**\n * Generates one mock-data factory per OpenAPI schema using Faker.js. Call\n * `createPet()` to get a realistic `Pet` object. Useful for tests, Storybook,\n * and local development without a running backend.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginFaker } from '@kubb/plugin-faker'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginFaker({\n * output: { path: './mocks' },\n * seed: [100],\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginFaker = defineExtension<PluginFaker>({\n kind: 'plugin',\n meta: { name: pluginFakerName, version, compatibility },\n dependencies: { [pluginTsName]: {} },\n setup(options) {\n const {\n output = { path: 'mocks', barrel: { type: 'named' } },\n seed,\n locale = 'en',\n group,\n exclude = [],\n include,\n override = [],\n typeMode = 'inferred',\n dateParser = 'faker',\n regexGenerator = 'faker',\n printer,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n setResolver(userResolver ? Resolver.merge(resolverFaker, userResolver) : resolverFaker)\n if (userMacros?.length) {\n setMacros(userMacros)\n }\n addGenerator(fakerGenerator)\n\n return {\n output,\n seed,\n locale,\n exclude,\n include,\n override,\n typeMode,\n group: group ?? null,\n dateParser,\n regexGenerator,\n printer,\n }\n },\n})\n\nexport default pluginFaker\n"],"mappings":";;;;;;;;;;;;;;AAIA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;;;;;;;;;;;AAYV,SAAgB,eAAe,MAAuB;CACpD,IAAI,CAAC,QAAQ,cAAc,IAAI,IAAiB,GAC9C,OAAO;CAET,OAAO,aAAa,IAAI;AAC1B;;;;;;;;;;;;;;;;;AAkBA,SAAgB,mBAAmB,MAAsB;CACvD,IAAI,CAAC,QAAQ,eAAe,IAAI,GAC9B,OAAO;CAET,OAAO,IAAI;AACb;;;;;;;;;;;;;;AAeA,SAAgB,aAAa,MAAuB;CAClD,OAAO,6BAA6B,KAAK,IAAI;AAC/C;;;;;;;;;;;;;AC7FA,SAAgB,YAAY,SAAgC;CAC1D,IAAI,QAAQ,WAAW,GAAG,OAAO;CAGjC,OAAO,MAFM,QAAQ,KAAK,UAAU,GAAGA,UAAAA,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAE7D,EAAE;AACpB;;;;;;;;;AA8CA,SAAgB,UAAU,MAAsB;CAC9C,OAAO,aAAa,IAAI,IAAI,OAAOA,UAAAA,KAAK,MAAM,IAAI;AACpD;;ACtGA,SAAS,QAAQ,GAA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