UNPKG

@hey-api/openapi-ts

Version:

🌀 OpenAPI to TypeScript codegen. Production-ready SDKs, Zod schemas, TanStack Query hooks, and 20+ plugins. Used by Vercel, OpenCode, and PayPal.

1 lines 49.9 kB
{"version":3,"file":"src-CB7dCcql.cjs","names":["ConfigError","path","path","fs","getClientPlugin","generateClientBundle","path","result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'>","path","queryParams: Array<string>","lines: Array<string>","colors","createClient","watches: ReadonlyArray<WatchValues>","getSpec","context: Context | undefined","$RefParser","data","parseOpenApiSpec","buildGraph","lines: Array<string>","loadPackageJson","colors","colors","event: LoggerEvent | undefined","event: LoggerEvent","result: StoredEventResult","getLogs","configs: Configs | undefined","initConfigs","result","ConfigValidationError","pCreateClient","JobError","logCrashReport","shouldReportCrash","openGitHubIssueWithCrashReport","toCase"],"sources":["../src/config/engine.ts","../src/ir/intents.ts","../src/generate/output.ts","../src/openApi/shared/utils/patch.ts","../src/createClient.ts","../src/utils/cli.ts","../src/utils/logger.ts","../src/generate.ts","../src/utils/exports.ts","../src/index.ts"],"sourcesContent":["import { ConfigError } from '~/error';\n\nexport const checkNodeVersion = () => {\n if (typeof Bun !== 'undefined') {\n const [major] = Bun.version.split('.').map(Number);\n if (major! < 1) {\n throw new ConfigError(\n `Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`,\n );\n }\n } else if (typeof process !== 'undefined' && process.versions?.node) {\n const [major] = process.versions.node.split('.').map(Number);\n if (major! < 20) {\n throw new ConfigError(\n `Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`,\n );\n }\n }\n};\n","import type { CodeSampleObject } from '~/openApi/shared/types';\nimport type { MaybePromise } from '~/types/utils';\n\nimport type { IR } from './types';\n\nexport interface ExampleIntent {\n run(ctx: IntentContext): MaybePromise<void>;\n}\n\nexport class IntentContext<Spec extends Record<string, any> = any> {\n private spec: Spec;\n\n constructor(spec: Spec) {\n this.spec = spec;\n }\n\n private getOperation(\n path: string,\n method: string,\n ): Record<string, any> | undefined {\n const paths = (this.spec as any).paths;\n if (!paths) return;\n return paths[path]?.[method];\n }\n\n setExample(operation: IR.OperationObject, example: CodeSampleObject): void {\n const source = this.getOperation(operation.path, operation.method);\n if (!source) return;\n source['x-codeSamples'] ||= [];\n source['x-codeSamples'].push(example);\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport type { Context } from '~/ir/context';\nimport { IntentContext } from '~/ir/intents';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport { generateClientBundle } from './client';\n\nexport const generateOutput = async ({ context }: { context: Context }) => {\n const outputPath = path.resolve(context.config.output.path);\n\n if (context.config.output.clean) {\n if (fs.existsSync(outputPath)) {\n fs.rmSync(outputPath, { force: true, recursive: true });\n }\n }\n\n const client = getClientPlugin(context.config);\n if (\n 'bundle' in client.config &&\n client.config.bundle &&\n !context.config.dryRun\n ) {\n // not proud of this one\n // @ts-expect-error\n context.config._FRAGILE_CLIENT_BUNDLE_RENAMED = generateClientBundle({\n meta: {\n importFileExtension: context.config.output.importFileExtension,\n },\n outputPath,\n // @ts-expect-error\n plugin: client,\n project: context.gen,\n });\n }\n\n for (const plugin of context.registerPlugins()) {\n await plugin.run();\n }\n\n context.gen.plan();\n\n const ctx = new IntentContext(context.spec);\n for (const intent of context.intents) {\n await intent.run(ctx);\n }\n\n for (const file of context.gen.render()) {\n const filePath = path.resolve(outputPath, file.path);\n const dir = path.dirname(filePath);\n if (!context.config.dryRun) {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(filePath, file.content, { encoding: 'utf8' });\n }\n }\n\n const { source } = context.config.output;\n if (source.enabled) {\n const sourcePath =\n source.path === null ? undefined : path.resolve(outputPath, source.path);\n if (!context.config.dryRun && sourcePath && sourcePath !== outputPath) {\n fs.mkdirSync(sourcePath, { recursive: true });\n }\n const serialized = await source.serialize(context.spec);\n // TODO: handle yaml (convert before writing)\n if (!context.config.dryRun && sourcePath) {\n fs.writeFileSync(\n path.resolve(sourcePath, `${source.fileName}.${source.extension}`),\n serialized,\n { encoding: 'utf8' },\n );\n }\n if (source.callback) {\n await source.callback(serialized);\n }\n }\n};\n","import type { OpenApi } from '~/openApi/types';\n\nimport type { Patch } from '../../../types/parser';\n\nexport const patchOpenApiSpec = ({\n patchOptions,\n spec: _spec,\n}: {\n patchOptions: Patch | undefined;\n spec: unknown;\n}) => {\n if (!patchOptions) {\n return;\n }\n\n const spec = _spec as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X;\n\n if ('swagger' in spec) {\n if (patchOptions.version && spec.swagger) {\n spec.swagger = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.swagger)\n ) as typeof spec.swagger;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (patchOptions.schemas && spec.definitions) {\n for (const key in patchOptions.schemas) {\n const schema = spec.definitions[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n return;\n }\n\n if (patchOptions.version && spec.openapi) {\n spec.openapi = (\n typeof patchOptions.version === 'string'\n ? patchOptions.version\n : patchOptions.version(spec.openapi)\n ) as typeof spec.openapi;\n }\n\n if (patchOptions.meta && spec.info) {\n patchOptions.meta(spec.info);\n }\n\n if (spec.components) {\n if (patchOptions.schemas && spec.components.schemas) {\n for (const key in patchOptions.schemas) {\n const schema = spec.components.schemas[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.schemas[key]!;\n patchFn(schema as Parameters<typeof patchFn>[0]);\n }\n }\n\n if (patchOptions.parameters && spec.components.parameters) {\n for (const key in patchOptions.parameters) {\n const schema = spec.components.parameters[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.parameters[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.requestBodies && spec.components.requestBodies) {\n for (const key in patchOptions.requestBodies) {\n const schema = spec.components.requestBodies[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.requestBodies[key]!;\n patchFn(schema);\n }\n }\n\n if (patchOptions.responses && spec.components.responses) {\n for (const key in patchOptions.responses) {\n const schema = spec.components.responses[key];\n if (!schema || typeof schema !== 'object') continue;\n\n const patchFn = patchOptions.responses[key]!;\n patchFn(schema);\n }\n }\n }\n\n if (patchOptions.operations && spec.paths) {\n for (const key in patchOptions.operations) {\n const [method, path] = key.split(' ');\n if (!method || !path) continue;\n\n const pathItem = spec.paths[path as keyof typeof spec.paths];\n if (!pathItem) continue;\n\n const operation =\n pathItem[method.toLocaleLowerCase() as keyof typeof pathItem] ||\n pathItem[method.toLocaleUpperCase() as keyof typeof pathItem];\n if (!operation || typeof operation !== 'object') continue;\n\n const patchFn = patchOptions.operations[key]!;\n patchFn(operation as any);\n }\n }\n};\n","import path from 'node:path';\n\nimport { $RefParser } from '@hey-api/json-schema-ref-parser';\nimport colors from 'ansi-colors';\n\nimport { postprocessOutput } from '~/config/output';\nimport { generateOutput } from '~/generate/output';\nimport { getSpec } from '~/getSpec';\nimport type { Context } from '~/ir/context';\nimport { parseOpenApiSpec } from '~/openApi';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { patchOpenApiSpec } from '~/openApi/shared/utils/patch';\nimport type { Config } from '~/types/config';\nimport type { Input } from '~/types/input';\nimport type { WatchValues } from '~/types/types';\nimport type { Logger } from '~/utils/logger';\n\nexport const compileInputPath = (input: Omit<Input, 'watch'>) => {\n const result: Pick<\n Partial<Input>,\n | 'api_key'\n | 'branch'\n | 'commit_sha'\n | 'organization'\n | 'project'\n | 'registry'\n | 'tags'\n | 'version'\n > &\n Pick<Input, 'path'> = {\n ...input,\n path: '',\n };\n\n if (\n input.path &&\n (typeof input.path !== 'string' || input.registry !== 'hey-api')\n ) {\n result.path = input.path;\n return result;\n }\n\n const [basePath, baseQuery] = input.path.split('?');\n const queryParts = (baseQuery || '').split('&');\n const queryPath = queryParts.map((part) => part.split('='));\n\n let path = basePath || '';\n if (path.endsWith('/')) {\n path = path.slice(0, path.length - 1);\n }\n\n const [, pathUrl] = path.split('://');\n const [baseUrl, organization, project] = (pathUrl || '').split('/');\n result.organization = organization || input.organization;\n result.project = project || input.project;\n\n const queryParams: Array<string> = [];\n\n const kApiKey = 'api_key';\n result.api_key =\n queryPath.find(([key]) => key === kApiKey)?.[1] ||\n input.api_key ||\n process.env.HEY_API_TOKEN;\n if (result.api_key) {\n queryParams.push(`${kApiKey}=${result.api_key}`);\n }\n\n const kBranch = 'branch';\n result.branch =\n queryPath.find(([key]) => key === kBranch)?.[1] || input.branch;\n if (result.branch) {\n queryParams.push(`${kBranch}=${result.branch}`);\n }\n\n const kCommitSha = 'commit_sha';\n result.commit_sha =\n queryPath.find(([key]) => key === kCommitSha)?.[1] || input.commit_sha;\n if (result.commit_sha) {\n queryParams.push(`${kCommitSha}=${result.commit_sha}`);\n }\n\n const kTags = 'tags';\n result.tags =\n queryPath.find(([key]) => key === kTags)?.[1]?.split(',') || input.tags;\n if (result.tags?.length) {\n queryParams.push(`${kTags}=${result.tags.join(',')}`);\n }\n\n const kVersion = 'version';\n result.version =\n queryPath.find(([key]) => key === kVersion)?.[1] || input.version;\n if (result.version) {\n queryParams.push(`${kVersion}=${result.version}`);\n }\n\n if (!result.organization) {\n throw new Error(\n 'missing organization - from which Hey API Platform organization do you want to generate your output?',\n );\n }\n\n if (!result.project) {\n throw new Error(\n 'missing project - from which Hey API Platform project do you want to generate your output?',\n );\n }\n\n const query = queryParams.join('&');\n const platformUrl = baseUrl || 'get.heyapi.dev';\n const isLocalhost = platformUrl.startsWith('localhost');\n const platformUrlWithProtocol = [\n isLocalhost ? 'http' : 'https',\n platformUrl,\n ].join('://');\n const compiledPath = isLocalhost\n ? [\n platformUrlWithProtocol,\n 'v1',\n 'get',\n result.organization,\n result.project,\n ].join('/')\n : [platformUrlWithProtocol, result.organization, result.project].join('/');\n result.path = query ? `${compiledPath}?${query}` : compiledPath;\n\n return result;\n};\n\nconst logInputPaths = (\n inputPaths: ReadonlyArray<ReturnType<typeof compileInputPath>>,\n jobIndex: number,\n) => {\n const lines: Array<string> = [];\n\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n const count = inputPaths.length;\n const baseString = colors.cyan(\n `Generating from ${count} ${count === 1 ? 'input' : 'inputs'}:`,\n );\n lines.push(`${jobPrefix}⏳ ${baseString}`);\n\n inputPaths.forEach((inputPath, index) => {\n const itemPrefixStr = ` [${index + 1}] `;\n const itemPrefix = colors.cyan(itemPrefixStr);\n const detailIndent = ' '.repeat(itemPrefixStr.length);\n\n if (typeof inputPath.path !== 'string') {\n lines.push(`${jobPrefix}${itemPrefix}raw OpenAPI specification`);\n return;\n }\n\n switch (inputPath.registry) {\n case 'hey-api': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n if (inputPath.branch) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('branch:')} ${colors.green(\n inputPath.branch,\n )}`,\n );\n }\n if (inputPath.commit_sha) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('commit:')} ${colors.green(\n inputPath.commit_sha,\n )}`,\n );\n }\n if (inputPath.tags?.length) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('tags:')} ${colors.green(\n inputPath.tags.join(', '),\n )}`,\n );\n }\n if (inputPath.version) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('version:')} ${colors.green(\n inputPath.version,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Hey API')}`,\n );\n break;\n }\n case 'readme': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n if (!baseInput) {\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n } else {\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n }\n // @ts-expect-error\n if (inputPath.uuid) {\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('uuid:')} ${colors.green(\n // @ts-expect-error\n inputPath.uuid,\n )}`,\n );\n }\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('ReadMe')}`,\n );\n break;\n }\n case 'scalar': {\n const baseInput = [inputPath.organization, inputPath.project]\n .filter(Boolean)\n .join('/');\n lines.push(`${jobPrefix}${itemPrefix}${baseInput}`);\n lines.push(\n `${jobPrefix}${detailIndent}${colors.gray('registry:')} ${colors.green('Scalar')}`,\n );\n break;\n }\n default:\n lines.push(`${jobPrefix}${itemPrefix}${inputPath.path}`);\n break;\n }\n });\n\n for (const line of lines) {\n console.log(line);\n }\n};\n\nexport const createClient = async ({\n config,\n dependencies,\n jobIndex,\n logger,\n watches: _watches,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n jobIndex: number;\n logger: Logger;\n /**\n * Always undefined on the first run, defined on subsequent runs.\n */\n watches?: ReadonlyArray<WatchValues>;\n}): Promise<Context | undefined> => {\n const watches: ReadonlyArray<WatchValues> =\n _watches ||\n Array.from({ length: config.input.length }, () => ({\n headers: new Headers(),\n }));\n\n const inputPaths = config.input.map((input) => compileInputPath(input));\n\n // on first run, print the message as soon as possible\n if (config.logs.level !== 'silent' && !_watches) {\n logInputPaths(inputPaths, jobIndex);\n }\n\n const getSpecData = async (input: Input, index: number) => {\n const eventSpec = logger.timeEvent('spec');\n const { arrayBuffer, error, resolvedInput, response } = await getSpec({\n fetchOptions: input.fetch,\n inputPath: inputPaths[index]!.path,\n timeout: input.watch.timeout,\n watch: watches[index]!,\n });\n eventSpec.timeEnd();\n\n // throw on first run if there's an error to preserve user experience\n // if in watch mode, subsequent errors won't throw to gracefully handle\n // cases where server might be reloading\n if (error && !_watches) {\n throw new Error(\n `Request failed with status ${response.status}: ${response.statusText}`,\n );\n }\n\n return { arrayBuffer, resolvedInput };\n };\n const specData = (\n await Promise.all(\n config.input.map((input, index) => getSpecData(input, index)),\n )\n ).filter((data) => data.arrayBuffer || data.resolvedInput);\n\n let context: Context | undefined;\n\n if (specData.length) {\n const refParser = new $RefParser();\n const data =\n specData.length > 1\n ? await refParser.bundleMany({\n arrayBuffer: specData.map((data) => data.arrayBuffer!),\n pathOrUrlOrSchemas: [],\n resolvedInputs: specData.map((data) => data.resolvedInput!),\n })\n : await refParser.bundle({\n arrayBuffer: specData[0]!.arrayBuffer,\n pathOrUrlOrSchema: undefined,\n resolvedInput: specData[0]!.resolvedInput,\n });\n\n // on subsequent runs in watch mode, print the message only if we know we're\n // generating the output\n if (config.logs.level !== 'silent' && _watches) {\n console.clear();\n logInputPaths(inputPaths, jobIndex);\n }\n\n const eventInputPatch = logger.timeEvent('input.patch');\n patchOpenApiSpec({ patchOptions: config.parser.patch, spec: data });\n eventInputPatch.timeEnd();\n\n const eventParser = logger.timeEvent('parser');\n context = parseOpenApiSpec({ config, dependencies, logger, spec: data });\n context.graph = buildGraph(context.ir, logger).graph;\n eventParser.timeEnd();\n\n const eventGenerator = logger.timeEvent('generator');\n await generateOutput({ context });\n eventGenerator.timeEnd();\n\n const eventPostprocess = logger.timeEvent('postprocess');\n if (!config.dryRun) {\n postprocessOutput(config.output);\n\n if (config.logs.level !== 'silent') {\n const outputPath = process.env.INIT_CWD\n ? `./${path.relative(process.env.INIT_CWD, config.output.path)}`\n : config.output.path;\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n console.log(\n `${jobPrefix}${colors.green('✅ Done!')} Your output is in ${colors.cyanBright(outputPath)}`,\n );\n }\n }\n eventPostprocess.timeEnd();\n }\n\n const watchedInput = config.input.find(\n (input, index) =>\n input.watch.enabled && typeof inputPaths[index]!.path === 'string',\n );\n\n if (watchedInput) {\n setTimeout(() => {\n createClient({\n config,\n dependencies,\n jobIndex,\n logger,\n watches,\n });\n }, watchedInput.watch.interval);\n }\n\n return context;\n};\n","import colors from 'ansi-colors';\n\nimport { loadPackageJson } from '~/generate/tsConfig';\n\nconst textAscii = `\n888 | e 888~-_ 888\n888___| e88~~8e Y88b / d8b 888 \\\\ 888\n888 | d888 88b Y888/ /Y88b 888 | 888\n888 | 8888__888 Y8/ / Y88b 888 / 888\n888 | Y888 , Y /____Y88b 888_-~ 888\n888 | \"88___/ / / Y88b 888 888\n _/\n`;\n\nconst asciiToLines = (\n ascii: string,\n options?: {\n padding?: number;\n },\n) => {\n const lines: Array<string> = [];\n const padding = Array.from<string>({ length: options?.padding ?? 0 }).fill(\n '',\n );\n lines.push(...padding);\n let maxLineLength = 0;\n let line = '';\n for (const char of ascii) {\n if (char === '\\n') {\n if (line) {\n lines.push(line);\n maxLineLength = Math.max(maxLineLength, line.length);\n line = '';\n }\n } else {\n line += char;\n }\n }\n lines.push(...padding);\n return { lines, maxLineLength };\n};\n\nexport function printCliIntro() {\n const packageJson = loadPackageJson();\n const text = asciiToLines(textAscii, { padding: 1 });\n for (const line of text.lines) {\n console.log(colors.cyan(line));\n }\n console.log(colors.gray(`${packageJson.name} v${packageJson.version}`));\n console.log('');\n}\n","import colors from 'ansi-colors';\n\ninterface LoggerEvent {\n end?: PerformanceMark;\n events: Array<LoggerEvent>;\n id: string; // unique internal key\n name: string;\n start: PerformanceMark;\n}\n\ninterface Severity {\n color: colors.StyleFunction;\n type: 'duration' | 'percentage';\n}\n\ninterface StoredEventResult {\n position: ReadonlyArray<number>;\n}\n\nlet loggerCounter = 0;\nconst nameToId = (name: string) => `${name}-${loggerCounter++}`;\nconst idEnd = (id: string) => `${id}-end`;\nconst idLength = (id: string) => `${id}-length`;\nconst idStart = (id: string) => `${id}-start`;\n\nconst getSeverity = (\n duration: number,\n percentage: number,\n): Severity | undefined => {\n if (duration > 200) {\n return {\n color: colors.red,\n type: 'duration',\n };\n }\n if (percentage > 30) {\n return {\n color: colors.red,\n type: 'percentage',\n };\n }\n if (duration > 50) {\n return {\n color: colors.yellow,\n type: 'duration',\n };\n }\n if (percentage > 10) {\n return {\n color: colors.yellow,\n type: 'percentage',\n };\n }\n return;\n};\n\nexport class Logger {\n private events: Array<LoggerEvent> = [];\n\n private end(result: StoredEventResult): void {\n let event: LoggerEvent | undefined;\n let events = this.events;\n for (const index of result.position) {\n event = events[index];\n if (event?.events) {\n events = event.events;\n }\n }\n if (event && !event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n }\n\n /**\n * Recursively end all unended events in the event tree.\n * This ensures all events have end marks before measuring.\n */\n private endAllEvents(events: Array<LoggerEvent>): void {\n for (const event of events) {\n if (!event.end) {\n event.end = performance.mark(idEnd(event.id));\n }\n if (event.events.length > 0) {\n this.endAllEvents(event.events);\n }\n }\n }\n\n report(print: boolean = true): PerformanceMeasure | undefined {\n const firstEvent = this.events[0];\n if (!firstEvent) return;\n\n // Ensure all events are ended before reporting\n this.endAllEvents(this.events);\n\n const lastEvent = this.events[this.events.length - 1]!;\n const name = 'root';\n const id = nameToId(name);\n\n try {\n const measure = performance.measure(\n idLength(id),\n idStart(firstEvent.id),\n idEnd(lastEvent.id),\n );\n if (print) {\n this.reportEvent({\n end: lastEvent.end,\n events: this.events,\n id,\n indent: 0,\n measure,\n name,\n start: firstEvent!.start,\n });\n }\n return measure;\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip reporting\n // to avoid crashing the application\n return;\n }\n }\n\n private reportEvent({\n indent,\n ...parent\n }: LoggerEvent & {\n indent: number;\n measure: PerformanceMeasure;\n }): void {\n const color = !indent ? colors.cyan : colors.gray;\n const lastIndex = parent.events.length - 1;\n\n parent.events.forEach((event, index) => {\n try {\n const measure = performance.measure(\n idLength(event.id),\n idStart(event.id),\n idEnd(event.id),\n );\n const duration = Math.ceil(measure.duration * 100) / 100;\n const percentage =\n Math.ceil((measure.duration / parent.measure.duration) * 100 * 100) /\n 100;\n const severity = indent ? getSeverity(duration, percentage) : undefined;\n\n let durationLabel = `${duration.toFixed(2).padStart(8)}ms`;\n if (severity?.type === 'duration') {\n durationLabel = severity.color(durationLabel);\n }\n\n const branch = index === lastIndex ? '└─ ' : '├─ ';\n const prefix = !indent ? '' : '│ '.repeat(indent - 1) + branch;\n const maxLength = 38 - prefix.length;\n\n const percentageBranch = !indent ? '' : '↳ ';\n const percentagePrefix = indent\n ? ' '.repeat(indent - 1) + percentageBranch\n : '';\n let percentageLabel = `${percentagePrefix}${percentage.toFixed(2)}%`;\n if (severity?.type === 'percentage') {\n percentageLabel = severity.color(percentageLabel);\n }\n const jobPrefix = colors.gray('[root] ');\n console.log(\n `${jobPrefix}${colors.gray(prefix)}${color(\n `${event.name.padEnd(maxLength)} ${durationLabel} (${percentageLabel})`,\n )}`,\n );\n this.reportEvent({ ...event, indent: indent + 1, measure });\n } catch {\n // If measuring fails (e.g., marks don't exist), silently skip this event\n // to avoid crashing the application\n }\n });\n }\n\n private start(id: string): PerformanceMark {\n return performance.mark(idStart(id));\n }\n\n private storeEvent({\n result,\n ...event\n }: Pick<LoggerEvent, 'events' | 'id' | 'name' | 'start'> & {\n result: StoredEventResult;\n }): void {\n const lastEventIndex = event.events.length - 1;\n const lastEvent = event.events[lastEventIndex];\n if (lastEvent && !lastEvent.end) {\n result.position = [...result.position, lastEventIndex];\n this.storeEvent({ ...event, events: lastEvent.events, result });\n return;\n }\n const length = event.events.push({ ...event, events: [] });\n result.position = [...result.position, length - 1];\n }\n\n timeEvent(name: string) {\n const id = nameToId(name);\n const start = this.start(id);\n const event: LoggerEvent = {\n events: this.events,\n id,\n name,\n start,\n };\n const result: StoredEventResult = {\n position: [],\n };\n this.storeEvent({ ...event, result });\n return {\n mark: start,\n timeEnd: () => this.end(result),\n };\n }\n}\n","import { checkNodeVersion } from '~/config/engine';\nimport type { Configs } from '~/config/init';\nimport { initConfigs } from '~/config/init';\nimport { getLogs } from '~/config/logs';\nimport { createClient as pCreateClient } from '~/createClient';\nimport {\n ConfigValidationError,\n JobError,\n logCrashReport,\n openGitHubIssueWithCrashReport,\n printCrashReport,\n shouldReportCrash,\n} from '~/error';\nimport type { Context } from '~/ir/context';\nimport type { UserConfig } from '~/types/config';\nimport type { LazyOrAsync, MaybeArray } from '~/types/utils';\nimport { printCliIntro } from '~/utils/cli';\nimport { Logger } from '~/utils/logger';\n\n/**\n * Generate a client from the provided configuration.\n *\n * @param userConfig User provided {@link UserConfig} configuration(s).\n */\nexport const createClient = async (\n userConfig?: LazyOrAsync<MaybeArray<UserConfig>>,\n logger = new Logger(),\n): Promise<ReadonlyArray<Context>> => {\n const resolvedConfig =\n typeof userConfig === 'function' ? await userConfig() : userConfig;\n const userConfigs = resolvedConfig\n ? resolvedConfig instanceof Array\n ? resolvedConfig\n : [resolvedConfig]\n : [];\n\n let rawLogs = userConfigs.find(\n (config) => getLogs(config).level !== 'silent',\n )?.logs;\n if (typeof rawLogs === 'string') {\n rawLogs = getLogs({ logs: rawLogs });\n }\n\n let configs: Configs | undefined;\n\n try {\n checkNodeVersion();\n\n const eventCreateClient = logger.timeEvent('createClient');\n\n const eventConfig = logger.timeEvent('config');\n configs = await initConfigs({ logger, userConfigs });\n const printIntro = configs.results.some(\n (result) => result.config.logs.level !== 'silent',\n );\n if (printIntro) {\n printCliIntro();\n }\n eventConfig.timeEnd();\n\n const allConfigErrors = configs.results.flatMap((result) =>\n result.errors.map((error) => ({ error, jobIndex: result.jobIndex })),\n );\n if (allConfigErrors.length) {\n throw new ConfigValidationError(allConfigErrors);\n }\n\n const clients = await Promise.all(\n configs.results.map(async (result) => {\n try {\n return await pCreateClient({\n config: result.config,\n dependencies: configs!.dependencies,\n jobIndex: result.jobIndex,\n logger,\n });\n } catch (error) {\n throw new JobError('', {\n error,\n jobIndex: result.jobIndex,\n });\n }\n }),\n );\n const result = clients.filter((client) =>\n Boolean(client),\n ) as ReadonlyArray<Context>;\n\n eventCreateClient.timeEnd();\n\n const printLogs = configs.results.some(\n (result) => result.config.logs.level === 'debug',\n );\n logger.report(printLogs);\n\n return result;\n } catch (error) {\n const results = configs?.results ?? [];\n\n const logs =\n results.find((result) => result.config.logs.level !== 'silent')?.config\n .logs ??\n results[0]?.config.logs ??\n rawLogs;\n const dryRun =\n results.some((result) => result.config.dryRun) ??\n userConfigs.some((config) => config.dryRun) ??\n false;\n const logPath =\n logs?.file && !dryRun\n ? logCrashReport(error, logs.path ?? '')\n : undefined;\n if (!logs || logs.level !== 'silent') {\n printCrashReport({ error, logPath });\n const isInteractive =\n results.some((result) => result.config.interactive) ??\n userConfigs.some((config) => config.interactive) ??\n false;\n if (await shouldReportCrash({ error, isInteractive })) {\n await openGitHubIssueWithCrashReport(error);\n }\n }\n\n throw error;\n }\n};\n","import type { Casing } from './naming';\nimport { toCase } from './naming';\n\n/**\n * Utilities shared across the package.\n */\nexport const utils = {\n /**\n * @deprecated use `toCase` instead\n */\n stringCase({\n case: casing,\n stripLeadingSeparators,\n value,\n }: {\n readonly case: Casing | undefined;\n /**\n * If leading separators have a semantic meaning, we might not want to\n * remove them.\n */\n stripLeadingSeparators?: boolean;\n value: string;\n }) {\n return toCase(value, casing, { stripLeadingSeparators });\n },\n /**\n * Converts the given string to the specified casing.\n */\n toCase,\n};\n","// OVERRIDES\n// hard-coded here because build process doesn't pick up overrides from separate files\nimport '@hey-api/codegen-core';\n\ndeclare module '@hey-api/codegen-core' {\n interface ProjectRenderMeta {\n /**\n * If specified, this will be the file extension used when importing\n * other modules. By default, we don't add a file extension and let the\n * runtime resolve it.\n *\n * @default null\n */\n importFileExtension?: (string & {}) | null;\n }\n\n interface SymbolMeta {\n category?:\n | 'client'\n | 'external'\n | 'hook'\n | 'schema'\n | 'sdk'\n | 'transform'\n | 'type'\n | 'utility'\n | (string & {});\n /**\n * Path to the resource this symbol represents.\n */\n path?: ReadonlyArray<string | number>;\n /**\n * Name of the plugin that registered this symbol.\n */\n pluginName?: string;\n resource?:\n | 'client'\n | 'definition'\n | 'operation'\n | 'webhook'\n | (string & {});\n resourceId?: string;\n role?:\n | 'data'\n | 'error'\n | 'errors'\n | 'options'\n | 'response'\n | 'responses'\n | (string & {});\n /**\n * Tags associated with this symbol.\n */\n tags?: ReadonlyArray<string>;\n tool?:\n | 'angular'\n | 'arktype'\n | 'fastify'\n | 'json-schema'\n | 'sdk'\n | 'typescript'\n | 'valibot'\n | 'zod'\n | (string & {});\n variant?: 'container' | (string & {});\n }\n}\n// END OVERRIDES\n\nimport colors from 'ansi-colors';\n// @ts-expect-error\nimport colorSupport from 'color-support';\n\nimport type { UserConfig } from '~/types/config';\nimport type { LazyOrAsync, MaybeArray } from '~/types/utils';\n\ncolors.enabled = colorSupport().hasBasic;\n\nexport { createClient } from '~/generate';\n\n/**\n * Type helper for openapi-ts.config.ts, returns {@link MaybeArray<UserConfig>} object(s)\n */\nexport const defineConfig = async <T extends MaybeArray<UserConfig>>(\n config: LazyOrAsync<T>,\n): Promise<T> => (typeof config === 'function' ? await config() : config);\n\nexport { defaultPaginationKeywords } from '~/config/parser';\nexport { defaultPlugins } from '~/config/plugins';\nexport type { IR } from '~/ir/types';\nexport { OperationPath, OperationStrategy } from '~/openApi/shared/locations';\nexport type {\n OpenApi,\n OpenApiMetaObject,\n OpenApiOperationObject,\n OpenApiParameterObject,\n OpenApiRequestBodyObject,\n OpenApiResponseObject,\n OpenApiSchemaObject,\n} from '~/openApi/types';\nexport type { DefinePlugin, Plugin } from '~/plugins';\nexport type { AngularClient } from '~/plugins/@hey-api/client-angular';\nexport type { AxiosClient } from '~/plugins/@hey-api/client-axios';\nexport {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nexport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nexport type { Client } from '~/plugins/@hey-api/client-core/types';\nexport type { FetchClient } from '~/plugins/@hey-api/client-fetch';\nexport type { NextClient } from '~/plugins/@hey-api/client-next';\nexport type { NuxtClient } from '~/plugins/@hey-api/client-nuxt';\nexport type { OfetchClient } from '~/plugins/@hey-api/client-ofetch';\nexport type { ExpressionTransformer } from '~/plugins/@hey-api/transformers/expressions';\nexport type { TypeTransformer } from '~/plugins/@hey-api/transformers/types';\nexport { definePluginConfig } from '~/plugins/shared/utils/config';\nexport * from '~/ts-dsl';\nexport type { UserConfig } from '~/types/config';\nexport { utils } from '~/utils/exports';\nexport { Logger } from '~/utils/logger';\n"],"mappings":";kRAEA,MAAa,MAAyB,CACpC,GAAI,OAAO,IAAQ,IAAa,CAC9B,GAAM,CAAC,GAAS,IAAI,QAAQ,MAAM,IAAI,CAAC,IAAI,OAAO,CAClD,GAAI,EAAS,EACX,MAAM,IAAIA,EAAAA,EACR,2BAA2B,IAAI,QAAQ,kCACxC,SAEM,OAAO,QAAY,KAAe,QAAQ,UAAU,KAAM,CACnE,GAAM,CAAC,GAAS,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC,IAAI,OAAO,CAC5D,GAAI,EAAS,GACX,MAAM,IAAIA,EAAAA,EACR,4BAA4B,QAAQ,SAAS,KAAK,gCACnD,GCNP,IAAa,EAAb,KAAmE,CACjE,KAEA,YAAY,EAAY,CACtB,KAAK,KAAO,EAGd,aACE,EACA,EACiC,CACjC,IAAM,EAAS,KAAK,KAAa,MAC5B,KACL,OAAO,EAAMC,KAAQ,GAGvB,WAAW,EAA+B,EAAiC,CACzE,IAAM,EAAS,KAAK,aAAa,EAAU,KAAM,EAAU,OAAO,CAC7D,IACL,EAAO,mBAAqB,EAAE,CAC9B,EAAO,iBAAiB,KAAK,EAAQ,ICpBzC,MAAa,EAAiB,MAAO,CAAE,aAAoC,CACzE,IAAM,EAAaC,EAAAA,QAAK,QAAQ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