zenko 0.1.8 → 0.1.9
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/cli.cjs +18 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +18 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +17 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -400,7 +400,8 @@ function generateWithMetadata(spec, options = {}) {
|
|
|
400
400
|
const typesConfig = normalizeTypesConfig(options.types);
|
|
401
401
|
const schemaOptions = {
|
|
402
402
|
strictDates,
|
|
403
|
-
strictNumeric
|
|
403
|
+
strictNumeric,
|
|
404
|
+
optionalType: typesConfig.optionalType
|
|
404
405
|
};
|
|
405
406
|
output.push('import { z } from "zod";');
|
|
406
407
|
const nameMap = /* @__PURE__ */ new Map();
|
|
@@ -543,8 +544,8 @@ function generateWithMetadata(spec, options = {}) {
|
|
|
543
544
|
}
|
|
544
545
|
const schemaFields = op.requestHeaders.map((header) => {
|
|
545
546
|
const zodType = mapHeaderToZodType(header);
|
|
546
|
-
const
|
|
547
|
-
return ` ${formatPropertyName(header.name)}: ${
|
|
547
|
+
const finalType = header.required ? zodType : applyOptionalModifier(zodType, schemaOptions.optionalType);
|
|
548
|
+
return ` ${formatPropertyName(header.name)}: ${finalType},`;
|
|
548
549
|
}).join("\n");
|
|
549
550
|
output.push(` ${formatPropertyName(camelCaseOperationId)}: z.object({`);
|
|
550
551
|
output.push(schemaFields);
|
|
@@ -777,7 +778,8 @@ function normalizeTypesConfig(config) {
|
|
|
777
778
|
emit: config?.emit ?? true,
|
|
778
779
|
helpers: config?.helpers ?? "package",
|
|
779
780
|
helpersOutput: config?.helpersOutput ?? "./zenko-types",
|
|
780
|
-
treeShake: config?.treeShake ?? true
|
|
781
|
+
treeShake: config?.treeShake ?? true,
|
|
782
|
+
optionalType: config?.optionalType ?? "optional"
|
|
781
783
|
};
|
|
782
784
|
}
|
|
783
785
|
function appendHelperTypesImport(buffer, config, operations) {
|
|
@@ -1168,6 +1170,16 @@ function convertQueryParamValue(schema, accessor) {
|
|
|
1168
1170
|
return `String(${accessor})`;
|
|
1169
1171
|
}
|
|
1170
1172
|
}
|
|
1173
|
+
function applyOptionalModifier(zodType, optionalType) {
|
|
1174
|
+
switch (optionalType) {
|
|
1175
|
+
case "optional":
|
|
1176
|
+
return `${zodType}.optional()`;
|
|
1177
|
+
case "nullable":
|
|
1178
|
+
return `${zodType}.nullable()`;
|
|
1179
|
+
case "nullish":
|
|
1180
|
+
return `${zodType}.nullish()`;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1171
1183
|
function generateZodSchema(name, schema, generatedTypes, options, nameMap) {
|
|
1172
1184
|
if (generatedTypes.has(name)) return "";
|
|
1173
1185
|
generatedTypes.add(name);
|
|
@@ -1252,7 +1264,7 @@ function buildZodObject(schema, options, nameMap) {
|
|
|
1252
1264
|
)) {
|
|
1253
1265
|
const isRequired = schema.required?.includes(propName) ?? false;
|
|
1254
1266
|
const zodType = getZodTypeFromSchema(propSchema, options, nameMap);
|
|
1255
|
-
const finalType = isRequired ? zodType :
|
|
1267
|
+
const finalType = isRequired ? zodType : applyOptionalModifier(zodType, options.optionalType);
|
|
1256
1268
|
properties.push(` ${formatPropertyName(propName)}: ${finalType},`);
|
|
1257
1269
|
}
|
|
1258
1270
|
if (properties.length === 0) {
|
|
@@ -1449,7 +1461,7 @@ function printHelp() {
|
|
|
1449
1461
|
console.log("");
|
|
1450
1462
|
console.log("Config file format:");
|
|
1451
1463
|
console.log(
|
|
1452
|
-
' {"types"?: { emit?, helpers?, helpersOutput? }, "schemas": [{ input, output, strictDates?, strictNumeric?, types? }] }'
|
|
1464
|
+
' {"types"?: { emit?, helpers?, helpersOutput?, optionalType?, treeShake? }, "schemas": [{ input, output, strictDates?, strictNumeric?, types? }] }'
|
|
1453
1465
|
);
|
|
1454
1466
|
}
|
|
1455
1467
|
async function runFromConfig(parsed) {
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/utils/topological-sort.ts","../src/utils/property-name.ts","../src/utils/string-utils.ts","../src/utils/http-status.ts","../src/utils/tree-shaking.ts","../src/utils/collect-inline-types.ts","../src/utils/generate-helper-file.ts","../src/zenko.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as fs from \"fs\"\nimport * as path from \"path\"\nimport { pathToFileURL } from \"url\"\nimport { load } from \"js-yaml\"\nimport {\n generateWithMetadata,\n type OpenAPISpec,\n type TypesConfig,\n} from \"./zenko.js\"\n\ntype CliConfigEntry = {\n input: string\n output: string\n strictDates?: boolean\n strictNumeric?: boolean\n types?: TypesConfig\n}\n\ntype CliConfigFile = {\n schemas: CliConfigEntry[]\n types?: TypesConfig\n}\n\ntype ParsedArgs = {\n showHelp: boolean\n strictDates: boolean\n strictNumeric: boolean\n configPath?: string\n positional: string[]\n}\n\nasync function main() {\n const args = process.argv.slice(2)\n const parsed = parseArgs(args)\n\n if (\n parsed.showHelp ||\n (!parsed.configPath && parsed.positional.length === 0)\n ) {\n printHelp()\n process.exit(parsed.showHelp ? 0 : 1)\n return\n }\n\n try {\n if (parsed.configPath) {\n await runFromConfig(parsed)\n } else {\n if (parsed.positional.length !== 2) {\n printHelp()\n process.exit(1)\n return\n }\n\n const [inputFile, outputFile] = parsed.positional\n if (!inputFile || !outputFile) {\n printHelp()\n process.exit(1)\n return\n }\n await generateSingle({\n inputFile,\n outputFile,\n strictDates: parsed.strictDates,\n strictNumeric: parsed.strictNumeric,\n })\n }\n } catch (error) {\n console.error(\"❌ Error:\", error)\n process.exit(1)\n }\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n const parsed: ParsedArgs = {\n showHelp: false,\n strictDates: false,\n strictNumeric: false,\n positional: [],\n }\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!\n\n if (arg === \"-h\" || arg === \"--help\") {\n parsed.showHelp = true\n continue\n }\n\n if (arg === \"--strict-dates\") {\n parsed.strictDates = true\n continue\n }\n\n if (arg === \"--strict-numeric\") {\n parsed.strictNumeric = true\n continue\n }\n\n if (arg === \"--config\" || arg === \"-c\") {\n const next = args[index + 1]\n if (!next) {\n throw new Error(\"--config flag requires a file path\")\n }\n parsed.configPath = next\n index += 1\n continue\n }\n\n parsed.positional.push(arg)\n }\n\n return parsed\n}\n\nfunction printHelp() {\n console.log(\"Usage:\")\n console.log(\" zenko <input-file> <output-file> [options]\")\n console.log(\" zenko --config <config-file> [options]\")\n console.log(\"\")\n console.log(\"Options:\")\n console.log(\" -h, --help Show this help message\")\n console.log(\n \" --strict-dates Use ISO datetime parsing (can be set per config entry)\"\n )\n console.log(\n \" --strict-numeric Preserve numeric min/max bounds (can be set per config entry)\"\n )\n console.log(\n \" -c, --config Path to config file (JSON, YAML, or JS module)\"\n )\n console.log(\"\")\n console.log(\"Config file format:\")\n console.log(\n ' {\"types\"?: { emit?, helpers?, helpersOutput? }, \"schemas\": [{ input, output, strictDates?, strictNumeric?, types? }] }'\n )\n}\n\nasync function runFromConfig(parsed: ParsedArgs) {\n const configPath = parsed.configPath!\n const resolvedConfigPath = path.resolve(configPath)\n const config = await loadConfig(resolvedConfigPath)\n validateConfig(config)\n\n const baseDir = path.dirname(resolvedConfigPath)\n const baseTypesConfig = config.types\n\n for (const entry of config.schemas) {\n const inputFile = resolvePath(entry.input, baseDir)\n const outputFile = resolvePath(entry.output, baseDir)\n const typesConfig = resolveTypesConfig(baseTypesConfig, entry.types)\n await generateSingle({\n inputFile,\n outputFile,\n strictDates: entry.strictDates ?? parsed.strictDates,\n strictNumeric: entry.strictNumeric ?? parsed.strictNumeric,\n typesConfig,\n })\n }\n}\n\nasync function loadConfig(filePath: string): Promise<unknown> {\n const extension = path.extname(filePath).toLowerCase()\n\n if (extension === \".json\") {\n const content = fs.readFileSync(filePath, \"utf8\")\n return JSON.parse(content)\n }\n\n if (extension === \".yaml\" || extension === \".yml\") {\n const content = fs.readFileSync(filePath, \"utf8\")\n return load(content)\n }\n\n const fileUrl = pathToFileURL(filePath).href\n const module = await import(fileUrl)\n return module.default ?? module.config ?? module\n}\n\nfunction validateConfig(config: unknown): asserts config is CliConfigFile {\n if (!config || typeof config !== \"object\") {\n throw new Error(\"Config file must export an object\")\n }\n\n if (!Array.isArray((config as CliConfigFile).schemas)) {\n throw new Error(\"Config file must contain a 'schemas' array\")\n }\n\n for (const entry of (config as CliConfigFile).schemas) {\n if (!entry || typeof entry !== \"object\") {\n throw new Error(\"Each schema entry must be an object\")\n }\n if (typeof entry.input !== \"string\" || typeof entry.output !== \"string\") {\n throw new Error(\"Each schema entry requires 'input' and 'output' paths\")\n }\n }\n}\n\nfunction resolvePath(filePath: string, baseDir: string): string {\n return path.isAbsolute(filePath) ? filePath : path.join(baseDir, filePath)\n}\n\nfunction resolveTypesConfig(\n baseConfig: TypesConfig | undefined,\n entryConfig: TypesConfig | undefined\n): TypesConfig | undefined {\n if (!baseConfig && !entryConfig) return undefined\n return {\n ...baseConfig,\n ...entryConfig,\n }\n}\n\nasync function generateSingle(options: {\n inputFile: string\n outputFile: string\n strictDates: boolean\n strictNumeric: boolean\n typesConfig?: TypesConfig\n}) {\n const { inputFile, outputFile, strictDates, strictNumeric, typesConfig } =\n options\n const resolvedInput = path.resolve(inputFile)\n const resolvedOutput = path.resolve(outputFile)\n\n const spec = readSpec(resolvedInput)\n const result = generateWithMetadata(spec, {\n strictDates,\n strictNumeric,\n types: typesConfig,\n })\n\n fs.mkdirSync(path.dirname(resolvedOutput), { recursive: true })\n fs.writeFileSync(resolvedOutput, result.output)\n\n console.log(`✅ Generated TypeScript types in ${resolvedOutput}`)\n console.log(`📄 Processed ${Object.keys(spec.paths || {}).length} paths`)\n if (spec.webhooks) {\n console.log(`🪝 Processed ${Object.keys(spec.webhooks).length} webhooks`)\n }\n\n // Write helper file if needed\n if (result.helperFile) {\n const helperPath = path.isAbsolute(result.helperFile.path)\n ? result.helperFile.path\n : path.resolve(path.dirname(resolvedOutput), result.helperFile.path)\n\n // Resolve both paths to absolute paths for comparison\n const absoluteResolvedOutput = path.resolve(resolvedOutput)\n const absoluteHelperPath = path.resolve(helperPath)\n\n // Check if helper file would overwrite the main output\n if (absoluteResolvedOutput === absoluteHelperPath) {\n console.warn(\n `⚠️ Skipping helper file generation: would overwrite main output at ${absoluteResolvedOutput}`\n )\n return\n }\n\n fs.mkdirSync(path.dirname(helperPath), { recursive: true })\n fs.writeFileSync(helperPath, result.helperFile.content, {\n encoding: \"utf8\",\n })\n\n console.log(`📦 Generated helper types in ${helperPath}`)\n }\n}\n\nfunction readSpec(filePath: string): OpenAPISpec {\n if (!fs.existsSync(filePath)) {\n throw new Error(`Input file not found: ${filePath}`)\n }\n\n const content = fs.readFileSync(filePath, \"utf8\")\n\n if (filePath.endsWith(\".yaml\") || filePath.endsWith(\".yml\")) {\n return load(content) as OpenAPISpec\n }\n\n return JSON.parse(content) as OpenAPISpec\n}\n\nmain().catch((error) => {\n console.error(\"❌ Error:\", error)\n process.exit(1)\n})\n","export function topologicalSort(schemas: Record<string, any>): string[] {\n const visited = new Set<string>()\n const visiting = new Set<string>()\n const result: string[] = []\n\n const visit = (name: string): void => {\n if (visited.has(name)) return\n if (visiting.has(name)) {\n // Circular dependency detected, just add it anyway\n return\n }\n\n visiting.add(name)\n\n // Find dependencies of this schema\n const schema = schemas[name]\n const dependencies = extractDependencies(schema)\n\n // Visit dependencies first\n for (const dep of dependencies) {\n if (schemas[dep]) {\n visit(dep)\n }\n }\n\n visiting.delete(name)\n visited.add(name)\n result.push(name)\n }\n\n // Visit all schemas\n for (const name of Object.keys(schemas)) {\n visit(name)\n }\n\n return result\n}\n\nexport function extractDependencies(schema: any): string[] {\n const dependencies: string[] = []\n\n const traverse = (obj: any): void => {\n if (typeof obj !== \"object\" || obj === null) return\n\n if (obj.$ref && typeof obj.$ref === \"string\") {\n const refName = extractRefName(obj.$ref)\n dependencies.push(refName)\n return\n }\n\n if (Array.isArray(obj)) {\n obj.forEach(traverse)\n } else {\n Object.values(obj).forEach(traverse)\n }\n }\n\n traverse(schema)\n return [...new Set(dependencies)] // Remove duplicates\n}\n\nexport function extractRefName(ref: string): string {\n return ref.split(\"/\").pop() || \"Unknown\"\n}\n","/**\n * Checks if a string is a valid JavaScript identifier\n */\nexport function isValidJSIdentifier(name: string): boolean {\n // Check if name is empty\n if (!name) return false\n\n // Check if first character is valid (letter, underscore, or $)\n const firstChar = name.at(0)\n if (firstChar === undefined) return false\n if (!/[a-zA-Z_$]/.test(firstChar)) return false\n\n if (!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)) return false\n\n // Check if it's a reserved word\n const 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 \"async\",\n ])\n\n return !reservedWords.has(name)\n}\n\n/**\n * Formats a property name for use in JavaScript/TypeScript object literals\n * Quotes the name if it's not a valid JavaScript identifier\n */\nexport function formatPropertyName(name: string): string {\n return isValidJSIdentifier(name) ? name : `\"${name}\"`\n}\n","/**\n * Converts a string with hyphens to camelCase.\n * Example: \"Links-Self\" -> \"LinksSelf\"\n */\nexport function toCamelCase(str: string): string {\n return str\n .replace(/-([a-zA-Z])/g, (_, letter) => letter.toUpperCase())\n .replace(/-+$/, \"\") // Remove trailing hyphens\n}\n\n/**\n * Capitalizes the first letter of a string.\n * Example: \"linksSelf\" -> \"LinksSelf\"\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n","const statusNameMap: Record<string, string> = {\n \"400\": \"badRequest\",\n \"401\": \"unauthorized\",\n \"402\": \"paymentRequired\",\n \"403\": \"forbidden\",\n \"404\": \"notFound\",\n \"405\": \"methodNotAllowed\",\n \"406\": \"notAcceptable\",\n \"407\": \"proxyAuthenticationRequired\",\n \"408\": \"requestTimeout\",\n \"409\": \"conflict\",\n \"410\": \"gone\",\n \"411\": \"lengthRequired\",\n \"412\": \"preconditionFailed\",\n \"413\": \"payloadTooLarge\",\n \"414\": \"uriTooLong\",\n \"415\": \"unsupportedMediaType\",\n \"416\": \"rangeNotSatisfiable\",\n \"417\": \"expectationFailed\",\n \"418\": \"imATeapot\",\n \"421\": \"misdirectedRequest\",\n \"422\": \"unprocessableEntity\",\n \"423\": \"locked\",\n \"424\": \"failedDependency\",\n \"425\": \"tooEarly\",\n \"426\": \"upgradeRequired\",\n \"428\": \"preconditionRequired\",\n \"429\": \"tooManyRequests\",\n \"431\": \"requestHeaderFieldsTooLarge\",\n \"451\": \"unavailableForLegalReasons\",\n \"500\": \"internalServerError\",\n \"501\": \"notImplemented\",\n \"502\": \"badGateway\",\n \"503\": \"serviceUnavailable\",\n \"504\": \"gatewayTimeout\",\n \"505\": \"httpVersionNotSupported\",\n \"506\": \"variantAlsoNegotiates\",\n \"507\": \"insufficientStorage\",\n \"508\": \"loopDetected\",\n \"510\": \"notExtended\",\n \"511\": \"networkAuthenticationRequired\",\n} as const\n\nexport type StatusCategory = \"client\" | \"server\" | \"default\" | \"unknown\"\n\nexport function mapStatusToIdentifier(status: string): string {\n if (status === \"default\") return \"defaultError\"\n\n const trimmed = status.trim()\n const mapped = statusNameMap[trimmed]\n if (mapped) return mapped\n\n if (/^\\d{3}$/.test(trimmed)) {\n return `status${trimmed}`\n }\n\n const sanitized = trimmed\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .trim()\n\n if (!sanitized) return \"unknownError\"\n\n const parts = sanitized.split(/\\s+/)\n const [first, ...rest] = parts\n const candidate =\n first +\n rest\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(\"\")\n\n if (!candidate) return \"unknownError\"\n\n return /^[a-zA-Z_$]/.test(candidate)\n ? candidate\n : `status${candidate.charAt(0).toUpperCase()}${candidate.slice(1)}`\n}\n\nexport function getStatusCategory(status: string): StatusCategory {\n if (status === \"default\") return \"default\"\n\n const code = Number(status)\n if (!Number.isInteger(code)) return \"unknown\"\n\n if (code >= 400 && code <= 499) return \"client\"\n if (code >= 500 && code <= 599) return \"server\"\n\n return \"unknown\"\n}\n\nexport function isErrorStatus(status: string): boolean {\n if (status === \"default\") return true\n const code = Number(status)\n if (!Number.isInteger(code)) return false\n return code >= 400\n}\n","import type { Operation, OperationErrorGroup } from \"../types/operation\"\n\nexport type ZenkoUsage = {\n usesHeaderFn: boolean\n usesOperationDefinition: boolean\n usesOperationErrors: boolean\n}\n\n/**\n * Analyzes operations to determine which Zenko types are actually used\n */\nexport function analyzeZenkoUsage(operations: Operation[]): ZenkoUsage {\n const usage: ZenkoUsage = {\n usesHeaderFn: false,\n usesOperationDefinition: false,\n usesOperationErrors: false,\n }\n\n // If there are any operations, OperationDefinition is always used\n if (operations.length > 0) {\n usage.usesOperationDefinition = true\n }\n\n for (const op of operations) {\n // PathFn is never used in package/file mode - only in inline helpers\n // So we never set usesPathFn to true here\n\n // HeaderFn is never used in package/file mode - the generated code uses\n // `typeof headers.xxx` which TypeScript can infer without needing HeaderFn\n // So we never set usesHeaderFn to true here\n\n // OperationErrors is used if there are any error responses\n // Note: Even if there are no explicit errors, the type might still be used\n // as a default in OperationDefinition, so we need to check if it's actually needed\n if (op.errors && hasAnyErrors(op.errors)) {\n usage.usesOperationErrors = true\n }\n }\n\n // Special case: if there are operations but no errors, OperationErrors is still used\n // as the default type in OperationDefinition\n if (operations.length > 0 && !usage.usesOperationErrors) {\n // Check if any operation has the default OperationErrors type\n const hasDefaultErrors = operations.some(\n (op) => !op.errors || !hasAnyErrors(op.errors)\n )\n if (hasDefaultErrors) {\n usage.usesOperationErrors = true\n }\n }\n\n return usage\n}\n\n/**\n * Generates the import statement based on usage analysis\n */\nexport function generateZenkoImport(\n usage: ZenkoUsage,\n mode: \"package\" | \"file\",\n helpersOutput?: string\n): string {\n const types: string[] = []\n\n // PathFn is never used in package/file mode - only in inline helpers\n if (usage.usesHeaderFn) types.push(\"HeaderFn\")\n if (usage.usesOperationDefinition) types.push(\"OperationDefinition\")\n if (usage.usesOperationErrors) types.push(\"OperationErrors\")\n\n // If no types are used, return empty string\n if (types.length === 0) {\n return \"\"\n }\n\n const importSource = mode === \"package\" ? '\"zenko\"' : `\"${helpersOutput}\"`\n return `import type { ${types.join(\", \")} } from ${importSource};`\n}\n\nfunction hasAnyErrors(errors: OperationErrorGroup): boolean {\n return Boolean(errors && Object.keys(errors).length > 0)\n}\n","import { toCamelCase, capitalize } from \"./string-utils\"\nimport type { Operation } from \"../types/operation\"\nimport type { OpenAPISpec as FullOpenAPISpec } from \"../zenko\"\n/**\n * Minimal OpenAPI types for the properties we access\n */\ntype OpenAPIOperation = {\n operationId?: string\n requestBody?: {\n content?: Record<string, { schema?: OpenAPISchema }>\n }\n responses?: Record<\n string,\n { content?: Record<string, { schema?: OpenAPISchema }> }\n >\n}\n\ntype OpenAPISchema = {\n $ref?: string\n allOf?: OpenAPISchema[]\n oneOf?: OpenAPISchema[]\n anyOf?: OpenAPISchema[]\n [key: string]: any // Allow arbitrary properties\n}\n\ntype OpenAPISpec = {\n paths?: FullOpenAPISpec[\"paths\"]\n webhooks?: FullOpenAPISpec[\"webhooks\"]\n}\n\n/**\n * Collects all inline request types that need to be generated.\n *\n * @param operations - Processed operations with metadata\n * @param spec - Raw OpenAPI specification\n * @returns Map of type names to their schemas\n */\nexport function collectInlineRequestTypes(\n operations: Operation[],\n spec: OpenAPISpec\n): Map<string, any> {\n const requestTypesToGenerate = new Map<string, any>()\n\n // Build a lookup map of operationId -> operation for O(1) access\n const operationLookup = new Map<string, OpenAPIOperation>()\n\n // Process paths\n for (const [, pathItem] of Object.entries(spec.paths || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n // Process webhooks\n for (const [, pathItem] of Object.entries(spec.webhooks || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n for (const op of operations) {\n const operation = operationLookup.get(op.operationId)\n if (!operation) continue\n\n const requestBody = operation.requestBody\n if (requestBody && requestBody.content) {\n const content = requestBody.content\n const jsonContent = content[\"application/json\"]\n\n if (jsonContent && jsonContent.schema) {\n const schema = jsonContent.schema\n const typeName = `${capitalize(toCamelCase(op.operationId))}Request`\n\n // Generate if it's not a simple $ref (those are already handled)\n // This includes allOf, oneOf, anyOf, and complex inline schemas\n if (!schema.$ref || schema.allOf || schema.oneOf || schema.anyOf) {\n requestTypesToGenerate.set(typeName, schema)\n }\n }\n }\n }\n\n return requestTypesToGenerate\n}\n\n/**\n * Collects all inline response types that need to be generated.\n *\n * @param operations - Processed operations with metadata\n * @param spec - Raw OpenAPI specification\n * @returns Map of type names to their schemas\n */\nexport function collectInlineResponseTypes(\n operations: Operation[],\n spec: OpenAPISpec\n): Map<string, any> {\n const responseTypesToGenerate = new Map<string, any>()\n\n // Build a lookup map of operationId -> operation for O(1) access\n const operationLookup = new Map<string, OpenAPIOperation>()\n\n // Process paths\n for (const [, pathItem] of Object.entries(spec.paths || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n // Process webhooks\n for (const [, pathItem] of Object.entries(spec.webhooks || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n for (const op of operations) {\n const operation = operationLookup.get(op.operationId)\n if (!operation) continue\n\n const responses = operation.responses || {}\n for (const [statusCode, response] of Object.entries(responses)) {\n if (/^2\\d\\d$/.test(statusCode) && (response as any).content) {\n const content = (response as any).content\n const jsonContent = content[\"application/json\"]\n\n if (jsonContent && jsonContent.schema) {\n const schema = jsonContent.schema\n const typeName = `${capitalize(toCamelCase(op.operationId))}Response`\n\n // Generate if it's not a simple $ref (those are already handled)\n // This includes allOf, oneOf, anyOf, and complex inline schemas\n if (!schema.$ref || schema.allOf || schema.oneOf || schema.anyOf) {\n responseTypesToGenerate.set(typeName, schema)\n }\n }\n }\n }\n }\n\n return responseTypesToGenerate\n}\n","/**\n * Generate a standalone helper types file for use with `helpers: \"file\"` mode.\n *\n * @returns TypeScript source containing PathFn, RequestMethod, HeaderFn, AnyHeaderFn, OperationErrors, and OperationDefinition type definitions.\n */\nexport function generateHelperFile(): string {\n const output: string[] = []\n\n output.push(\"// Generated helper types for Zenko\")\n output.push(\n \"// This file provides type definitions for operation objects and path functions\"\n )\n output.push(\"\")\n output.push(\n \"export type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string\"\n )\n output.push(\"\")\n output.push(\n 'export type RequestMethod = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"'\n )\n output.push(\"\")\n output.push(\n \"export type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult\"\n )\n output.push(\"\")\n output.push(\n \"export type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown)\"\n )\n output.push(\"\")\n output.push(\n \"export type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;\"\n )\n output.push(\"\")\n output.push(\n \"export type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {\"\n )\n output.push(\" method: TMethod\")\n output.push(\" path: TPath\")\n output.push(\" request?: TRequest\")\n output.push(\" response?: TResponse\")\n output.push(\" headers?: THeaders\")\n output.push(\" errors?: TErrors\")\n output.push(\"}\")\n output.push(\"\")\n\n return output.join(\"\\n\")\n}\n","import { topologicalSort, extractRefName } from \"./utils/topological-sort\"\nimport { formatPropertyName, isValidJSIdentifier } from \"./utils/property-name\"\nimport { toCamelCase, capitalize } from \"./utils/string-utils\"\nimport { isErrorStatus, mapStatusToIdentifier } from \"./utils/http-status\"\nimport { analyzeZenkoUsage, generateZenkoImport } from \"./utils/tree-shaking\"\nimport {\n collectInlineRequestTypes,\n collectInlineResponseTypes,\n} from \"./utils/collect-inline-types\"\nimport type { RequestMethod } from \"./types\"\nimport type {\n PathParam,\n QueryParam,\n RequestHeader,\n Operation,\n OperationErrorGroup,\n OperationErrorMap,\n} from \"./types/operation\"\nimport { generateHelperFile } from \"./utils/generate-helper-file\"\n\nexport type OpenAPISpec = {\n openapi: string\n info: unknown\n paths: Record<string, Record<string, unknown>>\n webhooks?: Record<string, Record<string, unknown>>\n components?: {\n schemas?: Record<string, unknown>\n parameters?: Record<string, unknown>\n }\n}\n\nexport type TypesHelperMode = \"package\" | \"inline\" | \"file\"\n\nexport type TypesConfig = {\n emit?: boolean\n helpers?: TypesHelperMode\n helpersOutput?: string\n treeShake?: boolean\n}\n\nexport type GenerateOptions = {\n strictDates?: boolean\n strictNumeric?: boolean\n types?: TypesConfig\n}\n\nexport type GenerateResult = {\n output: string\n helperFile?: {\n path: string\n content: string\n }\n}\n\n/**\n * Generate TypeScript source with additional metadata about helper files.\n *\n * @param spec - The OpenAPI specification to generate code from.\n * @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.\n * @returns Object containing the generated output and optional helper file information.\n */\nexport function generateWithMetadata(\n spec: OpenAPISpec,\n options: GenerateOptions = {}\n): GenerateResult {\n const output: string[] = []\n const generatedTypes = new Set<string>()\n const { strictDates = false, strictNumeric = false } = options\n const typesConfig = normalizeTypesConfig(options.types)\n const schemaOptions: SchemaOptions = {\n strictDates,\n strictNumeric,\n }\n\n output.push('import { z } from \"zod\";')\n\n // Create mapping from original names to sanitized names\n const nameMap = new Map<string, string>()\n if (spec.components?.schemas) {\n for (const name of Object.keys(spec.components.schemas)) {\n nameMap.set(name, toCamelCase(name))\n }\n }\n\n // Parse all operations early for tree-shaking\n const operations = parseOperations(spec, nameMap)\n\n // Generate helper types import right after Zod import\n appendHelperTypesImport(output, typesConfig, operations)\n output.push(\"\")\n\n // Generate Zod schemas from components/schemas\n if (spec.components?.schemas) {\n output.push(\"// Generated Zod Schemas\")\n output.push(\"\")\n\n // Sort schemas by dependencies (topological sort)\n const sortedSchemas = topologicalSort(spec.components.schemas)\n\n for (const name of sortedSchemas) {\n const schema = spec.components.schemas[name]\n const sanitizedName = nameMap.get(name)!\n output.push(\n generateZodSchema(\n sanitizedName,\n schema,\n generatedTypes,\n schemaOptions,\n nameMap\n )\n )\n output.push(\"\")\n // Export inferred type\n output.push(\n `export type ${sanitizedName} = z.infer<typeof ${sanitizedName}>;`\n )\n output.push(\"\")\n }\n }\n\n // Generate path functions\n output.push(\"// Path Functions\")\n output.push(\"export const paths = {\")\n\n for (const op of operations) {\n const pathParamNames = op.pathParams.map((p) => p.name)\n const hasPathParams = pathParamNames.length > 0\n const hasQueryParams = op.queryParams.length > 0\n const camelCaseOperationId = toCamelCase(op.operationId)\n\n if (!hasPathParams && !hasQueryParams) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: () => \"${op.path}\",`\n )\n continue\n }\n\n const alias = (n: string) => {\n if (isValidJSIdentifier(n)) return n\n let aliased = toCamelCase(n)\n // If still not valid (e.g., starts with number), prefix with underscore\n if (!isValidJSIdentifier(aliased)) {\n aliased = `_${aliased}`\n }\n return aliased\n }\n const destructPieces: string[] = []\n const typePieces: string[] = []\n for (const param of op.pathParams) {\n destructPieces.push(\n isValidJSIdentifier(param.name)\n ? param.name\n : `${formatPropertyName(param.name)}: ${alias(param.name)}`\n )\n typePieces.push(`${formatPropertyName(param.name)}: string`)\n }\n for (const param of op.queryParams) {\n destructPieces.push(\n isValidJSIdentifier(param.name)\n ? param.name\n : `${formatPropertyName(param.name)}: ${alias(param.name)}`\n )\n typePieces.push(\n `${formatPropertyName(param.name)}${param.required ? \"\" : \"?\"}: ${mapQueryType(param)}`\n )\n }\n const needsDefaultObject =\n !hasPathParams &&\n hasQueryParams &&\n op.queryParams.every((param) => !param.required)\n const signatureArgs = destructPieces.length\n ? `{ ${destructPieces.join(\", \")} }`\n : \"{}\"\n const signature = `${signatureArgs}: { ${typePieces.join(\", \")} }${\n needsDefaultObject ? \" = {}\" : \"\"\n }`\n\n const pathWithParams = op.path.replace(\n /{([^}]+)}/g,\n (_m, n) => `\\${${alias(n)}}`\n )\n\n if (!hasQueryParams) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (${signature}) => \\`${pathWithParams}\\`,`\n )\n continue\n }\n\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (${signature}) => {`\n )\n\n output.push(\" const params = new URLSearchParams()\")\n for (const param of op.queryParams) {\n const accessor = isValidJSIdentifier(param.name)\n ? param.name\n : alias(toCamelCase(param.name))\n const schema = param.schema ?? {}\n\n if (schema?.type === \"array\") {\n const itemValueExpression = convertQueryParamValue(\n schema.items ?? {},\n \"value\"\n )\n\n if (param.required) {\n output.push(` for (const value of ${accessor}) {`)\n output.push(\n ` params.append(\"${param.name}\", ${itemValueExpression})`\n )\n output.push(\" }\")\n } else {\n output.push(` if (${accessor} !== undefined) {`)\n output.push(` for (const value of ${accessor}) {`)\n output.push(\n ` params.append(\"${param.name}\", ${itemValueExpression})`\n )\n output.push(\" }\")\n output.push(\" }\")\n }\n\n continue\n }\n\n const valueExpression = convertQueryParamValue(schema, accessor)\n if (param.required) {\n output.push(` params.set(\"${param.name}\", ${valueExpression})`)\n } else {\n output.push(` if (${accessor} !== undefined) {`)\n output.push(` params.set(\"${param.name}\", ${valueExpression})`)\n output.push(\" }\")\n }\n }\n\n output.push(\" const _searchParams = params.toString()\")\n output.push(\n ` return \\`${pathWithParams}\\${_searchParams ? \\`?\\${_searchParams}\\` : \"\"}\\``\n )\n output.push(\" },\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate header schemas\n output.push(\"// Header Schemas\")\n output.push(\"export const headerSchemas = {\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n if (!op.requestHeaders || op.requestHeaders.length === 0) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: z.object({}),`\n )\n continue\n }\n\n const schemaFields = op.requestHeaders\n .map((header) => {\n const zodType = mapHeaderToZodType(header)\n const optional = header.required ? \"\" : \".optional()\"\n return ` ${formatPropertyName(header.name)}: ${zodType}${optional},`\n })\n .join(\"\\n\")\n\n output.push(` ${formatPropertyName(camelCaseOperationId)}: z.object({`)\n output.push(schemaFields)\n output.push(\" }),\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate header functions using Zod schemas\n output.push(\"// Header Functions\")\n output.push(\"export const headers = {\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n if (!op.requestHeaders || op.requestHeaders.length === 0) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: () => ${\n isValidJSIdentifier(camelCaseOperationId)\n ? `headerSchemas.${camelCaseOperationId}`\n : `headerSchemas[${formatPropertyName(camelCaseOperationId)}]`\n }.parse({}),`\n )\n continue\n }\n\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (params: z.input<${\n isValidJSIdentifier(camelCaseOperationId)\n ? `typeof headerSchemas.${camelCaseOperationId}`\n : `(typeof headerSchemas)[${formatPropertyName(camelCaseOperationId)}]`\n }>) => {`\n )\n output.push(\n ` return ${\n isValidJSIdentifier(camelCaseOperationId)\n ? `headerSchemas.${camelCaseOperationId}`\n : `headerSchemas[${formatPropertyName(camelCaseOperationId)}]`\n }.parse(params)`\n )\n output.push(\" },\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate request and response types before operation types\n generateRequestTypes(output, operations, spec, nameMap, schemaOptions)\n generateResponseTypes(output, operations, spec, nameMap, schemaOptions)\n\n // Generate operation types first (needed for type annotations)\n generateOperationTypes(output, operations, typesConfig)\n\n // Generate operation objects\n output.push(\"// Operation Objects\")\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n const typeAnnotation = typesConfig.emit\n ? `: ${capitalize(camelCaseOperationId)}Operation`\n : \"\"\n output.push(`export const ${camelCaseOperationId}${typeAnnotation} = {`)\n output.push(` method: \"${op.method}\",`)\n output.push(` path: paths.${camelCaseOperationId},`)\n\n appendOperationField(output, \"request\", op.requestType)\n appendOperationField(output, \"response\", op.responseType)\n\n if (op.requestHeaders && op.requestHeaders.length > 0) {\n output.push(` headers: headers.${camelCaseOperationId},`)\n }\n\n if (op.errors && hasAnyErrors(op.errors)) {\n appendErrorGroup(output, \"errors\", op.errors)\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n }\n\n const result: GenerateResult = {\n output: output.join(\"\\n\"),\n }\n\n // If using file-based helpers, include helper file information\n if (\n typesConfig.emit &&\n typesConfig.helpers === \"file\" &&\n typesConfig.helpersOutput\n ) {\n result.helperFile = {\n path: typesConfig.helpersOutput,\n content: generateHelperFile(),\n }\n }\n\n return result\n}\n\n/**\n * Generates TypeScript type definitions for inline request schemas.\n *\n * @param output - Array to which generated TypeScript code will be appended.\n * @param operations - Processed operations with metadata.\n * @param spec - The OpenAPI specification object.\n * @param nameMap - Mapping from original schema names to sanitized names.\n * @param schemaOptions - Options for schema generation.\n */\nfunction generateRequestTypes(\n output: string[],\n operations: Operation[],\n spec: OpenAPISpec,\n nameMap: Map<string, string>,\n schemaOptions: SchemaOptions\n) {\n const requestTypesToGenerate = collectInlineRequestTypes(operations, spec)\n\n // Generate the request type definitions\n if (requestTypesToGenerate.size > 0) {\n output.push(\"// Generated Request Types\")\n output.push(\"\")\n\n for (const [typeName, schema] of requestTypesToGenerate) {\n const generatedSchema = generateZodSchema(\n typeName,\n schema,\n new Set(),\n schemaOptions,\n nameMap\n )\n output.push(generatedSchema)\n output.push(\"\")\n output.push(`export type ${typeName} = z.infer<typeof ${typeName}>;`)\n output.push(\"\")\n }\n }\n}\n\n/**\n * Generates TypeScript type definitions for inline response schemas.\n *\n * @param output - Array to which generated TypeScript code will be appended.\n * @param operations - Processed operations with metadata.\n * @param spec - The OpenAPI specification object.\n * @param nameMap - Mapping from original schema names to sanitized names.\n * @param schemaOptions - Options for schema generation.\n */\nfunction generateResponseTypes(\n output: string[],\n operations: Operation[],\n spec: OpenAPISpec,\n nameMap: Map<string, string>,\n schemaOptions: SchemaOptions\n) {\n const responseTypesToGenerate = collectInlineResponseTypes(operations, spec)\n\n // Generate the response type definitions\n if (responseTypesToGenerate.size > 0) {\n output.push(\"// Generated Response Types\")\n output.push(\"\")\n\n for (const [typeName, schema] of responseTypesToGenerate) {\n const generatedSchema = generateZodSchema(\n typeName,\n schema,\n new Set(),\n schemaOptions,\n nameMap\n )\n output.push(generatedSchema)\n output.push(\"\")\n output.push(`export type ${typeName} = z.infer<typeof ${typeName}>;`)\n output.push(\"\")\n }\n }\n}\n\n/**\n * Generates TypeScript client code from an OpenAPI specification.\n *\n * @param spec - The OpenAPI specification object.\n * @param options - Configuration options controlling code generation behavior.\n * @returns Generated TypeScript code as a string.\n */\nexport function generate(\n spec: OpenAPISpec,\n options: GenerateOptions = {}\n): string {\n return generateWithMetadata(spec, options).output\n}\n\nfunction appendOperationField(\n buffer: string[],\n key: string,\n value?: string\n): void {\n if (!value) return\n buffer.push(` ${key}: ${value},`)\n}\n\nfunction appendErrorGroup(\n buffer: string[],\n label: string,\n errors?: OperationErrorMap\n): void {\n if (!errors || Object.keys(errors).length === 0) return\n buffer.push(` ${label}: {`)\n for (const [name, typeName] of Object.entries(errors)) {\n buffer.push(` ${formatPropertyName(name)}: ${typeName},`)\n }\n buffer.push(\" },\")\n}\n\n/**\n * Determines whether any error bucket in an operation error group contains entries.\n *\n * @param group - The operation error group to inspect (client, server, default, other buckets)\n * @returns `true` if at least one bucket has one or more entries, `false` otherwise.\n */\nfunction hasAnyErrors(group: OperationErrorGroup): boolean {\n return Boolean(group && Object.keys(group).length > 0)\n}\n\n/**\n * Determines whether a given string is one of the supported HTTP request methods.\n *\n * @param method - The HTTP method name to check (expected in lowercase).\n * @returns `true` if `method` is one of `\"get\"`, `\"put\"`, `\"post\"`, `\"delete\"`, `\"options\"`, `\"head\"`, `\"patch\"`, or `\"trace\"`, `false` otherwise.\n */\nfunction isRequestMethod(method: string): method is RequestMethod {\n switch (method) {\n case \"get\":\n case \"put\":\n case \"post\":\n case \"delete\":\n case \"options\":\n case \"head\":\n case \"patch\":\n case \"trace\":\n return true\n default:\n return false\n }\n}\n\n/**\n * Content-type priority mapping for response type inference.\n */\nconst CONTENT_TYPE_MAP: Record<string, string> = {\n \"application/json\": \"unknown\", // Will use schema when available\n \"text/csv\": \"string\",\n \"text/plain\": \"string\",\n // Binary/ambiguous types default to unknown for cross-platform compatibility\n \"application/octet-stream\": \"unknown\",\n \"application/pdf\": \"unknown\",\n}\n\n/**\n * Finds the most appropriate content type from available options.\n * Prefers JSON first, then uses content-type mapping, otherwise takes first available.\n */\nfunction findContentType(content: Record<string, any>): string {\n const contentTypes = Object.keys(content)\n\n // Prefer JSON\n if (contentTypes.includes(\"application/json\")) {\n return \"application/json\"\n }\n\n // Use first content type that has a mapping\n for (const contentType of contentTypes) {\n if (contentType in CONTENT_TYPE_MAP) {\n return contentType\n }\n }\n\n // Default to first available\n return contentTypes[0] || \"\"\n}\n\n/**\n * Infers the TypeScript type for a response based on content type and status code.\n */\nfunction inferResponseType(\n contentType: string,\n statusCode: string\n): string | undefined {\n // Handle NoContent and redirects\n if (statusCode === \"204\" || /^3\\d\\d$/.test(statusCode)) {\n return \"undefined\"\n }\n\n // Use content-type mapping\n if (contentType in CONTENT_TYPE_MAP) {\n return CONTENT_TYPE_MAP[contentType]\n }\n\n // Default to unknown for unrecognized types\n return \"unknown\"\n}\n\n/**\n * Collects operation metadata from an OpenAPI spec for operations that declare an `operationId` and use a supported HTTP method.\n *\n * @param spec - The OpenAPI specification to parse.\n * @returns An array of Operation objects describing each discovered operation (operationId, path, lowercase `method`, path and query parameters, request/response type names, request headers, and categorized errors).\n */\nfunction parseOperations(\n spec: OpenAPISpec,\n nameMap?: Map<string, string>\n): Operation[] {\n const operations: Operation[] = []\n\n // Process regular paths\n if (spec.paths) {\n for (const [path, pathItem] of Object.entries(spec.paths)) {\n for (const [method, operation] of Object.entries(pathItem)) {\n const normalizedMethod = method.toLowerCase()\n if (!isRequestMethod(normalizedMethod)) continue\n if (!(operation as any).operationId) continue\n\n const pathParams = extractPathParams(path)\n const requestType = getRequestType(operation)\n const { successResponse, errors } = getResponseTypes(\n operation,\n (operation as any).operationId,\n nameMap\n )\n const resolvedParameters = collectParameters(pathItem, operation, spec)\n const requestHeaders = getRequestHeaders(resolvedParameters)\n const queryParams = getQueryParams(resolvedParameters)\n\n operations.push({\n operationId: (operation as any).operationId,\n path,\n method: normalizedMethod,\n pathParams,\n queryParams,\n requestType,\n responseType: successResponse,\n requestHeaders,\n errors,\n })\n }\n }\n }\n\n // Process webhooks\n if (spec.webhooks) {\n for (const [webhookName, webhookItem] of Object.entries(spec.webhooks)) {\n for (const [method, operation] of Object.entries(webhookItem)) {\n const normalizedMethod = method.toLowerCase()\n if (!isRequestMethod(normalizedMethod)) continue\n if (!(operation as any).operationId) continue\n\n // For webhooks, we use the webhook name as the path identifier\n const path = webhookName\n const pathParams = extractPathParams(path)\n const requestType = getRequestType(operation)\n const { successResponse, errors } = getResponseTypes(\n operation,\n (operation as any).operationId\n )\n const resolvedParameters = collectParameters(\n webhookItem,\n operation,\n spec\n )\n const requestHeaders = getRequestHeaders(resolvedParameters)\n const queryParams = getQueryParams(resolvedParameters)\n\n operations.push({\n operationId: (operation as any).operationId,\n path,\n method: normalizedMethod,\n pathParams,\n queryParams,\n requestType,\n responseType: successResponse,\n requestHeaders,\n errors,\n })\n }\n }\n }\n\n return operations\n}\n\nfunction normalizeTypesConfig(\n config: TypesConfig | undefined\n): NormalizedTypesConfig {\n return {\n emit: config?.emit ?? true,\n helpers: config?.helpers ?? \"package\",\n helpersOutput: config?.helpersOutput ?? \"./zenko-types\",\n treeShake: config?.treeShake ?? true,\n }\n}\n\ntype NormalizedTypesConfig = {\n emit: boolean\n helpers: TypesHelperMode\n helpersOutput: string\n treeShake: boolean\n}\n\n/**\n * Appends helper type import or inline type declarations to the output buffer according to the types configuration.\n *\n * @param buffer - The output string buffer to which import lines or inline type declarations will be appended.\n * @param config - Normalized types configuration that controls whether to emit helpers and which helper mode to use (`package`, `file`, or `inline`). When `config.emit` is false no content is appended.\n */\nfunction appendHelperTypesImport(\n buffer: string[],\n config: NormalizedTypesConfig,\n operations: Operation[]\n) {\n if (!config.emit) return\n\n switch (config.helpers) {\n case \"package\":\n if (config.treeShake) {\n const usage = analyzeZenkoUsage(operations)\n const importStatement = generateZenkoImport(usage, \"package\")\n if (importStatement) {\n buffer.push(importStatement)\n }\n } else {\n buffer.push(\n 'import type { PathFn, HeaderFn, OperationDefinition, OperationErrors } from \"zenko\";'\n )\n }\n return\n case \"file\":\n if (config.treeShake) {\n const usage = analyzeZenkoUsage(operations)\n const importStatement = generateZenkoImport(\n usage,\n \"file\",\n config.helpersOutput\n )\n if (importStatement) {\n buffer.push(importStatement)\n }\n } else {\n buffer.push(\n `import type { PathFn, HeaderFn, OperationDefinition, OperationErrors } from \"${config.helpersOutput}\";`\n )\n }\n return\n case \"inline\":\n buffer.push(\n \"type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string;\"\n )\n buffer.push(\n 'type RequestMethod = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\";'\n )\n buffer.push(\n \"type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult;\"\n )\n buffer.push(\n \"type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown);\"\n )\n buffer.push(\n \"type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;\"\n )\n buffer.push(\n \"type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {\"\n )\n buffer.push(\" method: TMethod\")\n buffer.push(\" path: TPath\")\n buffer.push(\" request?: TRequest\")\n buffer.push(\" response?: TResponse\")\n buffer.push(\" headers?: THeaders\")\n buffer.push(\" errors?: TErrors\")\n buffer.push(\"}\")\n buffer.push(\"\")\n }\n}\n\n/**\n * Appends TypeScript operation type definitions to the output buffer.\n *\n * For each operation, emits an `export type <OperationId>Operation = OperationDefinition<...>` declaration\n * (including the HTTP method literal, path fn, request/response types, headers type, and errors type)\n * into the provided `buffer` when `config.emit` is true.\n *\n * @param buffer - Mutable array of output lines to append the generated type declarations to\n * @param operations - Array of operations to generate operation-type exports for\n * @param config - Normalized types configuration; generation is skipped when `config.emit` is false\n */\nfunction generateOperationTypes(\n buffer: string[],\n operations: Operation[],\n config: NormalizedTypesConfig\n) {\n if (!config.emit) return\n\n buffer.push(\"// Operation Types\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n const headerType = op.requestHeaders?.length\n ? isValidJSIdentifier(camelCaseOperationId)\n ? `typeof headers.${camelCaseOperationId}`\n : `(typeof headers)[${formatPropertyName(camelCaseOperationId)}]`\n : \"undefined\"\n const requestType = wrapTypeReference(op.requestType)\n const responseType = wrapTypeReference(op.responseType)\n const errorsType = buildOperationErrorsType(op.errors)\n\n buffer.push(\n `export type ${capitalize(camelCaseOperationId)}Operation = OperationDefinition<`\n )\n buffer.push(` \"${op.method}\",`)\n buffer.push(\n ` ${isValidJSIdentifier(camelCaseOperationId) ? `typeof paths.${camelCaseOperationId}` : `(typeof paths)[${formatPropertyName(camelCaseOperationId)}]`},`\n )\n buffer.push(` ${requestType},`)\n buffer.push(` ${responseType},`)\n buffer.push(` ${headerType},`)\n buffer.push(` ${errorsType}`)\n buffer.push(`>;`)\n buffer.push(\"\")\n }\n}\n\nfunction buildOperationErrorsType(errors?: OperationErrorGroup): string {\n if (!errors || !hasAnyErrors(errors)) {\n return \"OperationErrors\"\n }\n\n const errorBucket = buildErrorBucket(errors)\n\n return `OperationErrors<${errorBucket}>`\n}\n\nfunction buildErrorBucket(bucket?: OperationErrorMap): string {\n if (!bucket || Object.keys(bucket).length === 0) {\n return \"unknown\"\n }\n\n const entries = Object.entries(bucket)\n const accessibleEntries = entries.map(([name, type]) => {\n const propertyKey = formatPropertyName(name)\n const valueType = wrapErrorValueType(type)\n return `${propertyKey}: ${valueType}`\n })\n\n return `{ ${accessibleEntries.join(\"; \")} }`\n}\n\nconst TYPE_KEYWORDS = new Set([\n \"any\",\n \"unknown\",\n \"never\",\n \"void\",\n \"null\",\n \"undefined\",\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n])\nconst IDENTIFIER_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\nfunction wrapTypeReference(typeName?: string): string {\n if (!typeName) return \"undefined\"\n const normalized = typeName.trim()\n if (normalized === \"undefined\") return \"undefined\"\n if (TYPE_KEYWORDS.has(normalized)) return normalized\n if (normalized.startsWith(\"typeof \")) return normalized\n\n const arrayMatch = normalized.match(/^z\\.array\\((.+)\\)$/)\n if (arrayMatch) {\n return `z.ZodArray<${wrapTypeReference(arrayMatch[1])}>`\n }\n\n if (IDENTIFIER_PATTERN.test(normalized)) {\n return `typeof ${normalized}`\n }\n\n return normalized\n}\n\nfunction wrapErrorValueType(typeName?: string): string {\n if (!typeName) return \"unknown\"\n const normalized = typeName.trim()\n if (TYPE_KEYWORDS.has(normalized)) return normalized\n if (normalized.startsWith(\"typeof \")) return normalized\n\n const arrayMatch = normalized.match(/^z\\.array\\((.+)\\)$/)\n if (arrayMatch) {\n return `z.ZodArray<${wrapErrorValueType(arrayMatch[1])}>`\n }\n\n if (IDENTIFIER_PATTERN.test(normalized)) {\n return `typeof ${normalized}`\n }\n return normalized\n}\n\nfunction collectParameters(\n pathItem: Record<string, unknown>,\n operation: unknown,\n spec: OpenAPISpec\n): any[] {\n const parametersMap = new Map<string, any>()\n\n const addParameters = (params: unknown) => {\n if (!Array.isArray(params)) return\n\n for (const param of params) {\n const resolved = resolveParameter(param, spec)\n if (!resolved) continue\n const key = `${resolved.in}:${resolved.name}`\n parametersMap.set(key, resolved)\n }\n }\n\n addParameters((pathItem as any).parameters)\n addParameters((operation as any).parameters)\n\n return Array.from(parametersMap.values())\n}\n\nfunction resolveParameter(parameter: any, spec: OpenAPISpec) {\n if (!parameter) return undefined\n\n if (parameter.$ref) {\n const refName = extractRefName(parameter.$ref)\n const resolved = spec.components?.parameters?.[refName]\n if (!resolved) return undefined\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $ref, ...overrides } = parameter\n return {\n ...resolved,\n ...overrides,\n }\n }\n\n return parameter\n}\n\nfunction extractPathParams(path: string): PathParam[] {\n const params: PathParam[] = []\n const matches = path.match(/{([^}]+)}/g)\n\n if (matches) {\n for (const match of matches) {\n const paramName = match.slice(1, -1)\n params.push({\n name: paramName,\n type: \"string\", // OpenAPI path params are always strings\n })\n }\n }\n\n return params\n}\n\nfunction getRequestType(operation: any): string | undefined {\n const requestBody =\n operation.requestBody?.content?.[\"application/json\"]?.schema\n if (!requestBody) return undefined\n\n if (requestBody.$ref) {\n return extractRefName(requestBody.$ref)\n }\n\n // Generate inline type if needed\n const typeName = `${capitalize(toCamelCase(operation.operationId))}Request`\n return typeName\n}\n\n/**\n * Resolves success and error response typings for an operation.\n *\n * @param operation - The OpenAPI operation node to inspect.\n * @param operationId - The operation identifier used for synthesized names.\n * @returns The preferred success response type and categorized error groups.\n */\nfunction getResponseTypes(\n operation: any,\n operationId: string,\n nameMap?: Map<string, string>\n): {\n successResponse?: string\n errors?: OperationErrorGroup\n} {\n const responses = operation.responses ?? {}\n const successCodes = new Map<string, string>()\n const errorEntries: Array<{ code: string; schema: any }> = []\n\n for (const [statusCode, response] of Object.entries(responses)) {\n // Handle content types\n const content = (response as any)?.content\n if (!content || Object.keys(content).length === 0) {\n // No content - handle based on status code\n if (statusCode === \"204\" || /^3\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, \"undefined\")\n } else if (isErrorStatus(statusCode)) {\n // Include error responses even without content\n errorEntries.push({\n code: statusCode,\n schema: \"undefined\",\n })\n }\n continue\n }\n\n // Find the appropriate content type\n const contentType = findContentType(content)\n const resolvedSchema = content[contentType]?.schema\n\n if (!resolvedSchema) {\n // No schema - infer from content type\n const inferredType = inferResponseType(contentType, statusCode)\n if (inferredType) {\n if (isErrorStatus(statusCode)) {\n errorEntries.push({\n code: statusCode,\n schema: inferredType,\n })\n } else if (/^2\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, inferredType)\n }\n }\n continue\n }\n\n if (isErrorStatus(statusCode)) {\n errorEntries.push({ code: statusCode, schema: resolvedSchema })\n continue\n }\n\n if (/^2\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, resolvedSchema)\n }\n }\n\n const successResponse = selectSuccessResponse(\n successCodes,\n operationId,\n nameMap\n )\n const errors = buildErrorGroups(errorEntries, operationId, nameMap)\n\n return { successResponse, errors }\n}\n\n/**\n * Picks the most representative success response type from available candidates.\n *\n * Prefers 200/201/204 responses, falling back to the first declared status code.\n * When a schema is provided as a literal type string the literal is returned\n * directly; otherwise a synthetic type name is generated via `resolveResponseType`.\n *\n * @param responses - Map of status codes to resolved schemas or inferred literals.\n * @param operationId - Operation identifier used to construct synthetic names.\n * @returns The chosen TypeScript type name, or `undefined` when no success response exists.\n */\nfunction selectSuccessResponse(\n responses: Map<string, any>,\n operationId: string,\n nameMap?: Map<string, string>\n): string | undefined {\n if (responses.size === 0) return undefined\n\n const preferredOrder = [\"200\", \"201\", \"204\"]\n for (const code of preferredOrder) {\n const schema = responses.get(code)\n if (schema) {\n if (typeof schema === \"string\") {\n // Direct type (e.g., \"undefined\", \"string\", \"unknown\")\n return schema\n }\n return resolveResponseType(\n schema,\n `${capitalize(toCamelCase(operationId))}Response`,\n nameMap\n )\n }\n }\n\n const [, firstSchema] = responses.entries().next().value ?? []\n if (!firstSchema) return undefined\n\n if (typeof firstSchema === \"string\") {\n return firstSchema\n }\n\n return resolveResponseType(\n firstSchema,\n `${capitalize(toCamelCase(operationId))}Response`,\n nameMap\n )\n}\n\n/**\n * Buckets error responses by status-class and maps them to concrete type names.\n *\n * @param errors - Collection of HTTP status codes paired with schemas or literals.\n * @param operationId - Operation identifier used when synthesizing fallback names.\n * @returns Structured error groups keyed by client/server/default/other categories.\n */\nfunction buildErrorGroups(\n errors: Array<{ code: string; schema: any }> = [],\n operationId: string,\n nameMap?: Map<string, string>\n): OperationErrorGroup | undefined {\n if (!errors.length) return undefined\n\n const group: OperationErrorGroup = {}\n\n for (const { code, schema } of errors) {\n const identifier = mapStatusToIdentifier(code)\n const typeName = resolveResponseType(\n schema,\n `${capitalize(toCamelCase(operationId))}${capitalize(identifier)}`,\n nameMap\n )\n\n group[identifier] = typeName\n }\n\n return group\n}\n\n/**\n * Resolves the emitted TypeScript identifier for a response schema.\n *\n * @param schema - Schema object or inferred literal type returned by inference.\n * @param fallbackName - Synthetic name to use when the schema lacks a `$ref`.\n * @returns Reference name, literal type, or the provided fallback.\n */\nfunction resolveResponseType(\n schema: any,\n fallbackName: string,\n nameMap?: Map<string, string>\n): string {\n if (typeof schema === \"string\") {\n return schema\n }\n if (schema.$ref) {\n const refName = extractRefName(schema.$ref)\n return nameMap?.get(refName) || refName\n }\n // Handle array schemas with $ref items\n if (schema.type === \"array\" && schema.items?.$ref) {\n const itemRef = extractRefName(schema.items.$ref)\n const sanitizedItemRef = nameMap?.get(itemRef) || itemRef\n return `z.array(${sanitizedItemRef})`\n }\n // Handle allOf schemas - create synthetic type\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return fallbackName\n }\n return fallbackName\n}\n\nfunction getRequestHeaders(parameters: any[]): RequestHeader[] {\n const headers: RequestHeader[] = []\n\n for (const param of parameters ?? []) {\n if ((param as any).in === \"header\") {\n headers.push({\n name: (param as any).name,\n description: (param as any).description,\n schema: (param as any).schema,\n required: (param as any).required,\n })\n }\n }\n\n return headers\n}\n\nfunction getQueryParams(parameters: any[]): QueryParam[] {\n const queryParams: QueryParam[] = []\n\n for (const param of parameters ?? []) {\n if ((param as any).in === \"query\") {\n queryParams.push({\n name: (param as any).name,\n description: (param as any).description,\n schema: (param as any).schema,\n required: (param as any).required,\n })\n }\n }\n\n return queryParams\n}\n\nfunction mapHeaderToZodType(header: RequestHeader): string {\n const schema = header.schema ?? {}\n const schemaType = schema.type\n switch (schemaType) {\n case \"integer\":\n case \"number\":\n // Accept numeric header values provided as strings\n return \"z.coerce.number()\"\n case \"boolean\":\n // Accept boolean header values provided as strings\n return \"z.coerce.boolean()\"\n case \"array\": {\n const items = schema.items ?? { type: \"string\" }\n const itemType =\n items.type === \"integer\" || items.type === \"number\"\n ? \"z.coerce.number()\"\n : items.type === \"boolean\"\n ? \"z.coerce.boolean()\"\n : \"z.string()\"\n return `z.array(${itemType})`\n }\n default:\n return \"z.string()\"\n }\n}\n\nfunction mapQueryType(param: QueryParam): string {\n return mapQuerySchemaType(param.schema)\n}\n\nfunction mapQuerySchemaType(schema: any): string {\n if (!schema) return \"string\"\n\n if (schema.type === \"array\") {\n const itemType = mapQuerySchemaType(schema.items)\n return `Array<${itemType}>`\n }\n\n switch (schema.type) {\n case \"integer\":\n case \"number\":\n return \"number\"\n case \"boolean\":\n return \"boolean\"\n default:\n return \"string\"\n }\n}\n\nfunction convertQueryParamValue(schema: any, accessor: string): string {\n if (!schema) {\n return `String(${accessor})`\n }\n\n switch (schema.type) {\n case \"integer\":\n case \"number\":\n return `String(${accessor})`\n case \"boolean\":\n return `${accessor} ? \"true\" : \"false\"`\n default:\n return `String(${accessor})`\n }\n}\n\ntype SchemaOptions = {\n strictDates: boolean\n strictNumeric: boolean\n}\n\nfunction generateZodSchema(\n name: string,\n schema: any,\n generatedTypes: Set<string>,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n if (generatedTypes.has(name)) return \"\"\n generatedTypes.add(name)\n\n if (schema.enum) {\n const enumValues = schema.enum.map((v: string) => `\"${v}\"`).join(\", \")\n return `export const ${name} = z.enum([${enumValues}]);`\n }\n\n // Handle allOf schemas\n if (schema.allOf && Array.isArray(schema.allOf)) {\n const allOfParts = schema.allOf.map((part: any) =>\n getZodTypeFromSchema(part, options, nameMap)\n )\n if (allOfParts.length === 0) return `export const ${name} = z.object({});`\n if (allOfParts.length === 1)\n return `export const ${name} = ${allOfParts[0]};`\n const first = allOfParts[0]\n const rest = allOfParts\n .slice(1)\n .map((part: string) => `.and(${part})`)\n .join(\"\")\n return `export const ${name} = ${first}${rest};`\n }\n\n if (schema.type === \"object\" || schema.properties) {\n return `export const ${name} = ${buildZodObject(schema, options, nameMap)};`\n }\n\n if (schema.type === \"array\") {\n const itemSchema = schema.items ?? { type: \"unknown\" }\n const itemType = getZodTypeFromSchema(itemSchema, options, nameMap)\n const builder = applyStrictArrayBounds(\n schema,\n `z.array(${itemType})`,\n itemSchema,\n options.strictNumeric\n )\n return `export const ${name} = ${builder};`\n }\n\n return `export const ${name} = ${getZodTypeFromSchema(schema, options, nameMap)};`\n}\n\nfunction getZodTypeFromSchema(\n schema: any,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n if (schema.$ref) {\n const refName = extractRefName(schema.$ref)\n return nameMap?.get(refName) || refName\n }\n\n if (schema.enum) {\n const enumValues = schema.enum.map((v: string) => `\"${v}\"`).join(\", \")\n return `z.enum([${enumValues}])`\n }\n\n // Handle allOf schemas\n if (schema.allOf && Array.isArray(schema.allOf)) {\n const allOfParts = schema.allOf.map((part: any) =>\n getZodTypeFromSchema(part, options, nameMap)\n )\n if (allOfParts.length === 0) return \"z.object({})\"\n if (allOfParts.length === 1) return allOfParts[0]\n const first = allOfParts[0]\n const rest = allOfParts\n .slice(1)\n .map((part: string) => `.and(${part})`)\n .join(\"\")\n return `${first}${rest}`\n }\n\n // Check for object with properties (including those without explicit type)\n if (\n schema.type === \"object\" ||\n schema.properties ||\n schema.allOf ||\n schema.oneOf ||\n schema.anyOf\n ) {\n return buildZodObject(schema, options, nameMap)\n }\n\n switch (schema.type) {\n case \"string\":\n return buildString(schema, options)\n case \"boolean\":\n return \"z.boolean()\"\n case \"array\":\n return `z.array(${getZodTypeFromSchema(\n schema.items ?? { type: \"unknown\" },\n options,\n nameMap\n )})`\n case \"null\":\n return \"z.null()\"\n case \"number\":\n return buildNumber(schema, options)\n case \"integer\":\n return buildInteger(schema, options)\n default:\n return \"z.unknown()\"\n }\n}\n\nfunction buildZodObject(\n schema: any,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n const properties: string[] = []\n\n for (const [propName, propSchema] of Object.entries(\n schema.properties || {}\n )) {\n const isRequired = schema.required?.includes(propName) ?? false\n const zodType = getZodTypeFromSchema(propSchema as any, options, nameMap)\n const finalType = isRequired ? zodType : `${zodType}.optional()`\n properties.push(` ${formatPropertyName(propName)}: ${finalType},`)\n }\n\n if (properties.length === 0) {\n return \"z.object({})\"\n }\n\n return `z.object({\\n${properties.join(\"\\n\")}\\n})`\n}\n\nfunction buildString(schema: any, options: SchemaOptions): string {\n if (options.strictDates) {\n switch (schema.format) {\n case \"date-time\":\n return \"z.string().datetime()\"\n case \"date\":\n return \"z.string().date()\"\n case \"time\":\n return \"z.string().time()\"\n case \"duration\":\n return \"z.string().duration()\"\n }\n }\n\n let builder = \"z.string()\"\n\n if (options.strictNumeric) {\n if (typeof schema.minLength === \"number\") {\n builder += `.min(${schema.minLength})`\n }\n\n if (typeof schema.maxLength === \"number\") {\n builder += `.max(${schema.maxLength})`\n }\n\n if (schema.pattern) {\n builder += `.regex(new RegExp(${JSON.stringify(schema.pattern)}))`\n }\n }\n\n switch (schema.format) {\n case \"uuid\":\n return `${builder}.uuid()`\n case \"email\":\n return `${builder}.email()`\n case \"uri\":\n case \"url\":\n return `${builder}.url()`\n case \"ipv4\":\n return `${builder}.ip({ version: \"v4\" })`\n case \"ipv6\":\n return `${builder}.ip({ version: \"v6\" })`\n default:\n return builder\n }\n}\n\nfunction buildNumber(schema: any, options: SchemaOptions): string {\n let builder = \"z.number()\"\n\n if (options.strictNumeric) {\n builder = applyNumericBounds(schema, builder)\n\n if (typeof schema.multipleOf === \"number\" && schema.multipleOf !== 0) {\n builder += `.refine((value) => Math.abs(value / ${schema.multipleOf} - Math.round(value / ${schema.multipleOf})) < Number.EPSILON, { message: \"Must be a multiple of ${schema.multipleOf}\" })`\n }\n }\n\n return builder\n}\n\nfunction buildInteger(schema: any, options: SchemaOptions): string {\n let builder = buildNumber(schema, options)\n builder += \".int()\"\n return builder\n}\n\nfunction applyStrictArrayBounds(\n schema: any,\n builder: string,\n itemSchema: any,\n enforceBounds: boolean\n): string {\n if (!enforceBounds) {\n return builder\n }\n\n if (typeof schema.minItems === \"number\") {\n builder += `.min(${schema.minItems})`\n }\n\n if (typeof schema.maxItems === \"number\") {\n builder += `.max(${schema.maxItems})`\n }\n\n if (schema.uniqueItems && isPrimitiveLike(itemSchema)) {\n builder +=\n '.refine((items) => new Set(items).size === items.length, { message: \"Items must be unique\" })'\n }\n\n return builder\n}\n\nfunction isPrimitiveLike(schema: any): boolean {\n if (schema?.$ref) return false\n\n const primitiveTypes = new Set([\"string\", \"number\", \"integer\", \"boolean\"])\n return primitiveTypes.has(schema?.type)\n}\n\nfunction applyNumericBounds(schema: any, builder: string): string {\n if (typeof schema.minimum === \"number\") {\n if (schema.exclusiveMinimum === true) {\n builder += `.gt(${schema.minimum})`\n } else {\n builder += `.min(${schema.minimum})`\n }\n } else if (typeof schema.exclusiveMinimum === \"number\") {\n builder += `.gt(${schema.exclusiveMinimum})`\n }\n\n if (typeof schema.maximum === \"number\") {\n if (schema.exclusiveMaximum === true) {\n builder += `.lt(${schema.maximum})`\n } else {\n builder += `.max(${schema.maximum})`\n }\n } else if (typeof schema.exclusiveMaximum === \"number\") {\n builder += `.lt(${schema.exclusiveMaximum})`\n }\n\n return builder\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAoB;AACpB,WAAsB;AACtB,iBAA8B;AAC9B,qBAAqB;;;ACLd,SAAS,gBAAgB,SAAwC;AACtE,QAAM,UAAU,oBAAI,IAAY;AAChC,QAAM,WAAW,oBAAI,IAAY;AACjC,QAAM,SAAmB,CAAC;AAE1B,QAAM,QAAQ,CAAC,SAAuB;AACpC,QAAI,QAAQ,IAAI,IAAI,EAAG;AACvB,QAAI,SAAS,IAAI,IAAI,GAAG;AAEtB;AAAA,IACF;AAEA,aAAS,IAAI,IAAI;AAGjB,UAAM,SAAS,QAAQ,IAAI;AAC3B,UAAM,eAAe,oBAAoB,MAAM;AAG/C,eAAW,OAAO,cAAc;AAC9B,UAAI,QAAQ,GAAG,GAAG;AAChB,cAAM,GAAG;AAAA,MACX;AAAA,IACF;AAEA,aAAS,OAAO,IAAI;AACpB,YAAQ,IAAI,IAAI;AAChB,WAAO,KAAK,IAAI;AAAA,EAClB;AAGA,aAAW,QAAQ,OAAO,KAAK,OAAO,GAAG;AACvC,UAAM,IAAI;AAAA,EACZ;AAEA,SAAO;AACT;AAEO,SAAS,oBAAoB,QAAuB;AACzD,QAAM,eA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B,YAAQ,IAAI,uBAAgB,OAAO,KAAK,KAAK,QAAQ,EAAE,MAAM,WAAW;AAAA,EAC1E;AAGA,MAAI,OAAO,YAAY;AACrB,UAAM,aAAkB,gBAAW,OAAO,WAAW,IAAI,IACrD,OAAO,WAAW,OACb,aAAa,aAAQ,cAAc,GAAG,OAAO,WAAW,IAAI;AAGrE,UAAM,yBAA8B,aAAQ,cAAc;AAC1D,UAAM,qBAA0B,aAAQ,UAAU;AAGlD,QAAI,2BAA2B,oBAAoB;AACjD,cAAQ;AAAA,QACN,iFAAuE,sBAAsB;AAAA,MAC/F;AACA;AAAA,IACF;AAEA,IAAG,aAAe,aAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AAC1D,IAAG,iBAAc,YAAY,OAAO,WAAW,SAAS;AAAA,MACtD,UAAU;AAAA,IACZ,CAAC;AAED,YAAQ,IAAI,uCAAgC,UAAU,EAAE;AAAA,EAC1D;AACF;AAEA,SAAS,SAAS,UAA+B;AAC/C,MAAI,CAAI,cAAW,QAAQ,GAAG;AAC5B,UAAM,IAAI,MAAM,yBAAyB,QAAQ,EAAE;AAAA,EACrD;AAEA,QAAM,UAAa,gBAAa,UAAU,MAAM;AAEhD,MAAI,SAAS,SAAS,OAAO,KAAK,SAAS,SAAS,MAAM,GAAG;AAC3D,eAAO,qBAAK,OAAO;AAAA,EACrB;AAEA,SAAO,KAAK,MAAM,OAAO;AAC3B;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,iBAAY,KAAK;AAC/B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["hasAnyErrors","hasAnyErrors","path","module"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/utils/topological-sort.ts","../src/utils/property-name.ts","../src/utils/string-utils.ts","../src/utils/http-status.ts","../src/utils/tree-shaking.ts","../src/utils/collect-inline-types.ts","../src/utils/generate-helper-file.ts","../src/zenko.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as fs from \"fs\"\nimport * as path from \"path\"\nimport { pathToFileURL } from \"url\"\nimport { load } from \"js-yaml\"\nimport {\n generateWithMetadata,\n type OpenAPISpec,\n type TypesConfig,\n} from \"./zenko.js\"\n\ntype CliConfigEntry = {\n input: string\n output: string\n strictDates?: boolean\n strictNumeric?: boolean\n types?: TypesConfig\n}\n\ntype CliConfigFile = {\n schemas: CliConfigEntry[]\n types?: TypesConfig\n}\n\ntype ParsedArgs = {\n showHelp: boolean\n strictDates: boolean\n strictNumeric: boolean\n configPath?: string\n positional: string[]\n}\n\nasync function main() {\n const args = process.argv.slice(2)\n const parsed = parseArgs(args)\n\n if (\n parsed.showHelp ||\n (!parsed.configPath && parsed.positional.length === 0)\n ) {\n printHelp()\n process.exit(parsed.showHelp ? 0 : 1)\n return\n }\n\n try {\n if (parsed.configPath) {\n await runFromConfig(parsed)\n } else {\n if (parsed.positional.length !== 2) {\n printHelp()\n process.exit(1)\n return\n }\n\n const [inputFile, outputFile] = parsed.positional\n if (!inputFile || !outputFile) {\n printHelp()\n process.exit(1)\n return\n }\n await generateSingle({\n inputFile,\n outputFile,\n strictDates: parsed.strictDates,\n strictNumeric: parsed.strictNumeric,\n })\n }\n } catch (error) {\n console.error(\"❌ Error:\", error)\n process.exit(1)\n }\n}\n\nfunction parseArgs(args: string[]): ParsedArgs {\n const parsed: ParsedArgs = {\n showHelp: false,\n strictDates: false,\n strictNumeric: false,\n positional: [],\n }\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!\n\n if (arg === \"-h\" || arg === \"--help\") {\n parsed.showHelp = true\n continue\n }\n\n if (arg === \"--strict-dates\") {\n parsed.strictDates = true\n continue\n }\n\n if (arg === \"--strict-numeric\") {\n parsed.strictNumeric = true\n continue\n }\n\n if (arg === \"--config\" || arg === \"-c\") {\n const next = args[index + 1]\n if (!next) {\n throw new Error(\"--config flag requires a file path\")\n }\n parsed.configPath = next\n index += 1\n continue\n }\n\n parsed.positional.push(arg)\n }\n\n return parsed\n}\n\nfunction printHelp() {\n console.log(\"Usage:\")\n console.log(\" zenko <input-file> <output-file> [options]\")\n console.log(\" zenko --config <config-file> [options]\")\n console.log(\"\")\n console.log(\"Options:\")\n console.log(\" -h, --help Show this help message\")\n console.log(\n \" --strict-dates Use ISO datetime parsing (can be set per config entry)\"\n )\n console.log(\n \" --strict-numeric Preserve numeric min/max bounds (can be set per config entry)\"\n )\n console.log(\n \" -c, --config Path to config file (JSON, YAML, or JS module)\"\n )\n console.log(\"\")\n console.log(\"Config file format:\")\n console.log(\n ' {\"types\"?: { emit?, helpers?, helpersOutput?, optionalType?, treeShake? }, \"schemas\": [{ input, output, strictDates?, strictNumeric?, types? }] }'\n )\n}\n\nasync function runFromConfig(parsed: ParsedArgs) {\n const configPath = parsed.configPath!\n const resolvedConfigPath = path.resolve(configPath)\n const config = await loadConfig(resolvedConfigPath)\n validateConfig(config)\n\n const baseDir = path.dirname(resolvedConfigPath)\n const baseTypesConfig = config.types\n\n for (const entry of config.schemas) {\n const inputFile = resolvePath(entry.input, baseDir)\n const outputFile = resolvePath(entry.output, baseDir)\n const typesConfig = resolveTypesConfig(baseTypesConfig, entry.types)\n await generateSingle({\n inputFile,\n outputFile,\n strictDates: entry.strictDates ?? parsed.strictDates,\n strictNumeric: entry.strictNumeric ?? parsed.strictNumeric,\n typesConfig,\n })\n }\n}\n\nasync function loadConfig(filePath: string): Promise<unknown> {\n const extension = path.extname(filePath).toLowerCase()\n\n if (extension === \".json\") {\n const content = fs.readFileSync(filePath, \"utf8\")\n return JSON.parse(content)\n }\n\n if (extension === \".yaml\" || extension === \".yml\") {\n const content = fs.readFileSync(filePath, \"utf8\")\n return load(content)\n }\n\n const fileUrl = pathToFileURL(filePath).href\n const module = await import(fileUrl)\n return module.default ?? module.config ?? module\n}\n\nfunction validateConfig(config: unknown): asserts config is CliConfigFile {\n if (!config || typeof config !== \"object\") {\n throw new Error(\"Config file must export an object\")\n }\n\n if (!Array.isArray((config as CliConfigFile).schemas)) {\n throw new Error(\"Config file must contain a 'schemas' array\")\n }\n\n for (const entry of (config as CliConfigFile).schemas) {\n if (!entry || typeof entry !== \"object\") {\n throw new Error(\"Each schema entry must be an object\")\n }\n if (typeof entry.input !== \"string\" || typeof entry.output !== \"string\") {\n throw new Error(\"Each schema entry requires 'input' and 'output' paths\")\n }\n }\n}\n\nfunction resolvePath(filePath: string, baseDir: string): string {\n return path.isAbsolute(filePath) ? filePath : path.join(baseDir, filePath)\n}\n\nfunction resolveTypesConfig(\n baseConfig: TypesConfig | undefined,\n entryConfig: TypesConfig | undefined\n): TypesConfig | undefined {\n if (!baseConfig && !entryConfig) return undefined\n return {\n ...baseConfig,\n ...entryConfig,\n }\n}\n\nasync function generateSingle(options: {\n inputFile: string\n outputFile: string\n strictDates: boolean\n strictNumeric: boolean\n typesConfig?: TypesConfig\n}) {\n const { inputFile, outputFile, strictDates, strictNumeric, typesConfig } =\n options\n const resolvedInput = path.resolve(inputFile)\n const resolvedOutput = path.resolve(outputFile)\n\n const spec = readSpec(resolvedInput)\n const result = generateWithMetadata(spec, {\n strictDates,\n strictNumeric,\n types: typesConfig,\n })\n\n fs.mkdirSync(path.dirname(resolvedOutput), { recursive: true })\n fs.writeFileSync(resolvedOutput, result.output)\n\n console.log(`✅ Generated TypeScript types in ${resolvedOutput}`)\n console.log(`📄 Processed ${Object.keys(spec.paths || {}).length} paths`)\n if (spec.webhooks) {\n console.log(`🪝 Processed ${Object.keys(spec.webhooks).length} webhooks`)\n }\n\n // Write helper file if needed\n if (result.helperFile) {\n const helperPath = path.isAbsolute(result.helperFile.path)\n ? result.helperFile.path\n : path.resolve(path.dirname(resolvedOutput), result.helperFile.path)\n\n // Resolve both paths to absolute paths for comparison\n const absoluteResolvedOutput = path.resolve(resolvedOutput)\n const absoluteHelperPath = path.resolve(helperPath)\n\n // Check if helper file would overwrite the main output\n if (absoluteResolvedOutput === absoluteHelperPath) {\n console.warn(\n `⚠️ Skipping helper file generation: would overwrite main output at ${absoluteResolvedOutput}`\n )\n return\n }\n\n fs.mkdirSync(path.dirname(helperPath), { recursive: true })\n fs.writeFileSync(helperPath, result.helperFile.content, {\n encoding: \"utf8\",\n })\n\n console.log(`📦 Generated helper types in ${helperPath}`)\n }\n}\n\nfunction readSpec(filePath: string): OpenAPISpec {\n if (!fs.existsSync(filePath)) {\n throw new Error(`Input file not found: ${filePath}`)\n }\n\n const content = fs.readFileSync(filePath, \"utf8\")\n\n if (filePath.endsWith(\".yaml\") || filePath.endsWith(\".yml\")) {\n return load(content) as OpenAPISpec\n }\n\n return JSON.parse(content) as OpenAPISpec\n}\n\nmain().catch((error) => {\n console.error(\"❌ Error:\", error)\n process.exit(1)\n})\n","export function topologicalSort(schemas: Record<string, any>): string[] {\n const visited = new Set<string>()\n const visiting = new Set<string>()\n const result: string[] = []\n\n const visit = (name: string): void => {\n if (visited.has(name)) return\n if (visiting.has(name)) {\n // Circular dependency detected, just add it anyway\n return\n }\n\n visiting.add(name)\n\n // Find dependencies of this schema\n const schema = schemas[name]\n const dependencies = extractDependencies(schema)\n\n // Visit dependencies first\n for (const dep of dependencies) {\n if (schemas[dep]) {\n visit(dep)\n }\n }\n\n visiting.delete(name)\n visited.add(name)\n result.push(name)\n }\n\n // Visit all schemas\n for (const name of Object.keys(schemas)) {\n visit(name)\n }\n\n return result\n}\n\nexport function extractDependencies(schema: any): string[] {\n const dependencies: string[] = []\n\n const traverse = (obj: any): void => {\n if (typeof obj !== \"object\" || obj === null) return\n\n if (obj.$ref && typeof obj.$ref === \"string\") {\n const refName = extractRefName(obj.$ref)\n dependencies.push(refName)\n return\n }\n\n if (Array.isArray(obj)) {\n obj.forEach(traverse)\n } else {\n Object.values(obj).forEach(traverse)\n }\n }\n\n traverse(schema)\n return [...new Set(dependencies)] // Remove duplicates\n}\n\nexport function extractRefName(ref: string): string {\n return ref.split(\"/\").pop() || \"Unknown\"\n}\n","/**\n * Checks if a string is a valid JavaScript identifier\n */\nexport function isValidJSIdentifier(name: string): boolean {\n // Check if name is empty\n if (!name) return false\n\n // Check if first character is valid (letter, underscore, or $)\n const firstChar = name.at(0)\n if (firstChar === undefined) return false\n if (!/[a-zA-Z_$]/.test(firstChar)) return false\n\n if (!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)) return false\n\n // Check if it's a reserved word\n const 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 \"async\",\n ])\n\n return !reservedWords.has(name)\n}\n\n/**\n * Formats a property name for use in JavaScript/TypeScript object literals\n * Quotes the name if it's not a valid JavaScript identifier\n */\nexport function formatPropertyName(name: string): string {\n return isValidJSIdentifier(name) ? name : `\"${name}\"`\n}\n","/**\n * Converts a string with hyphens to camelCase.\n * Example: \"Links-Self\" -> \"LinksSelf\"\n */\nexport function toCamelCase(str: string): string {\n return str\n .replace(/-([a-zA-Z])/g, (_, letter) => letter.toUpperCase())\n .replace(/-+$/, \"\") // Remove trailing hyphens\n}\n\n/**\n * Capitalizes the first letter of a string.\n * Example: \"linksSelf\" -> \"LinksSelf\"\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n}\n","const statusNameMap: Record<string, string> = {\n \"400\": \"badRequest\",\n \"401\": \"unauthorized\",\n \"402\": \"paymentRequired\",\n \"403\": \"forbidden\",\n \"404\": \"notFound\",\n \"405\": \"methodNotAllowed\",\n \"406\": \"notAcceptable\",\n \"407\": \"proxyAuthenticationRequired\",\n \"408\": \"requestTimeout\",\n \"409\": \"conflict\",\n \"410\": \"gone\",\n \"411\": \"lengthRequired\",\n \"412\": \"preconditionFailed\",\n \"413\": \"payloadTooLarge\",\n \"414\": \"uriTooLong\",\n \"415\": \"unsupportedMediaType\",\n \"416\": \"rangeNotSatisfiable\",\n \"417\": \"expectationFailed\",\n \"418\": \"imATeapot\",\n \"421\": \"misdirectedRequest\",\n \"422\": \"unprocessableEntity\",\n \"423\": \"locked\",\n \"424\": \"failedDependency\",\n \"425\": \"tooEarly\",\n \"426\": \"upgradeRequired\",\n \"428\": \"preconditionRequired\",\n \"429\": \"tooManyRequests\",\n \"431\": \"requestHeaderFieldsTooLarge\",\n \"451\": \"unavailableForLegalReasons\",\n \"500\": \"internalServerError\",\n \"501\": \"notImplemented\",\n \"502\": \"badGateway\",\n \"503\": \"serviceUnavailable\",\n \"504\": \"gatewayTimeout\",\n \"505\": \"httpVersionNotSupported\",\n \"506\": \"variantAlsoNegotiates\",\n \"507\": \"insufficientStorage\",\n \"508\": \"loopDetected\",\n \"510\": \"notExtended\",\n \"511\": \"networkAuthenticationRequired\",\n} as const\n\nexport type StatusCategory = \"client\" | \"server\" | \"default\" | \"unknown\"\n\nexport function mapStatusToIdentifier(status: string): string {\n if (status === \"default\") return \"defaultError\"\n\n const trimmed = status.trim()\n const mapped = statusNameMap[trimmed]\n if (mapped) return mapped\n\n if (/^\\d{3}$/.test(trimmed)) {\n return `status${trimmed}`\n }\n\n const sanitized = trimmed\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .trim()\n\n if (!sanitized) return \"unknownError\"\n\n const parts = sanitized.split(/\\s+/)\n const [first, ...rest] = parts\n const candidate =\n first +\n rest\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(\"\")\n\n if (!candidate) return \"unknownError\"\n\n return /^[a-zA-Z_$]/.test(candidate)\n ? candidate\n : `status${candidate.charAt(0).toUpperCase()}${candidate.slice(1)}`\n}\n\nexport function getStatusCategory(status: string): StatusCategory {\n if (status === \"default\") return \"default\"\n\n const code = Number(status)\n if (!Number.isInteger(code)) return \"unknown\"\n\n if (code >= 400 && code <= 499) return \"client\"\n if (code >= 500 && code <= 599) return \"server\"\n\n return \"unknown\"\n}\n\nexport function isErrorStatus(status: string): boolean {\n if (status === \"default\") return true\n const code = Number(status)\n if (!Number.isInteger(code)) return false\n return code >= 400\n}\n","import type { Operation, OperationErrorGroup } from \"../types/operation\"\n\nexport type ZenkoUsage = {\n usesHeaderFn: boolean\n usesOperationDefinition: boolean\n usesOperationErrors: boolean\n}\n\n/**\n * Analyzes operations to determine which Zenko types are actually used\n */\nexport function analyzeZenkoUsage(operations: Operation[]): ZenkoUsage {\n const usage: ZenkoUsage = {\n usesHeaderFn: false,\n usesOperationDefinition: false,\n usesOperationErrors: false,\n }\n\n // If there are any operations, OperationDefinition is always used\n if (operations.length > 0) {\n usage.usesOperationDefinition = true\n }\n\n for (const op of operations) {\n // PathFn is never used in package/file mode - only in inline helpers\n // So we never set usesPathFn to true here\n\n // HeaderFn is never used in package/file mode - the generated code uses\n // `typeof headers.xxx` which TypeScript can infer without needing HeaderFn\n // So we never set usesHeaderFn to true here\n\n // OperationErrors is used if there are any error responses\n // Note: Even if there are no explicit errors, the type might still be used\n // as a default in OperationDefinition, so we need to check if it's actually needed\n if (op.errors && hasAnyErrors(op.errors)) {\n usage.usesOperationErrors = true\n }\n }\n\n // Special case: if there are operations but no errors, OperationErrors is still used\n // as the default type in OperationDefinition\n if (operations.length > 0 && !usage.usesOperationErrors) {\n // Check if any operation has the default OperationErrors type\n const hasDefaultErrors = operations.some(\n (op) => !op.errors || !hasAnyErrors(op.errors)\n )\n if (hasDefaultErrors) {\n usage.usesOperationErrors = true\n }\n }\n\n return usage\n}\n\n/**\n * Generates the import statement based on usage analysis\n */\nexport function generateZenkoImport(\n usage: ZenkoUsage,\n mode: \"package\" | \"file\",\n helpersOutput?: string\n): string {\n const types: string[] = []\n\n // PathFn is never used in package/file mode - only in inline helpers\n if (usage.usesHeaderFn) types.push(\"HeaderFn\")\n if (usage.usesOperationDefinition) types.push(\"OperationDefinition\")\n if (usage.usesOperationErrors) types.push(\"OperationErrors\")\n\n // If no types are used, return empty string\n if (types.length === 0) {\n return \"\"\n }\n\n const importSource = mode === \"package\" ? '\"zenko\"' : `\"${helpersOutput}\"`\n return `import type { ${types.join(\", \")} } from ${importSource};`\n}\n\nfunction hasAnyErrors(errors: OperationErrorGroup): boolean {\n return Boolean(errors && Object.keys(errors).length > 0)\n}\n","import { toCamelCase, capitalize } from \"./string-utils\"\nimport type { Operation } from \"../types/operation\"\nimport type { OpenAPISpec as FullOpenAPISpec } from \"../zenko\"\n/**\n * Minimal OpenAPI types for the properties we access\n */\ntype OpenAPIOperation = {\n operationId?: string\n requestBody?: {\n content?: Record<string, { schema?: OpenAPISchema }>\n }\n responses?: Record<\n string,\n { content?: Record<string, { schema?: OpenAPISchema }> }\n >\n}\n\ntype OpenAPISchema = {\n $ref?: string\n allOf?: OpenAPISchema[]\n oneOf?: OpenAPISchema[]\n anyOf?: OpenAPISchema[]\n [key: string]: any // Allow arbitrary properties\n}\n\ntype OpenAPISpec = {\n paths?: FullOpenAPISpec[\"paths\"]\n webhooks?: FullOpenAPISpec[\"webhooks\"]\n}\n\n/**\n * Collects all inline request types that need to be generated.\n *\n * @param operations - Processed operations with metadata\n * @param spec - Raw OpenAPI specification\n * @returns Map of type names to their schemas\n */\nexport function collectInlineRequestTypes(\n operations: Operation[],\n spec: OpenAPISpec\n): Map<string, any> {\n const requestTypesToGenerate = new Map<string, any>()\n\n // Build a lookup map of operationId -> operation for O(1) access\n const operationLookup = new Map<string, OpenAPIOperation>()\n\n // Process paths\n for (const [, pathItem] of Object.entries(spec.paths || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n // Process webhooks\n for (const [, pathItem] of Object.entries(spec.webhooks || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n for (const op of operations) {\n const operation = operationLookup.get(op.operationId)\n if (!operation) continue\n\n const requestBody = operation.requestBody\n if (requestBody && requestBody.content) {\n const content = requestBody.content\n const jsonContent = content[\"application/json\"]\n\n if (jsonContent && jsonContent.schema) {\n const schema = jsonContent.schema\n const typeName = `${capitalize(toCamelCase(op.operationId))}Request`\n\n // Generate if it's not a simple $ref (those are already handled)\n // This includes allOf, oneOf, anyOf, and complex inline schemas\n if (!schema.$ref || schema.allOf || schema.oneOf || schema.anyOf) {\n requestTypesToGenerate.set(typeName, schema)\n }\n }\n }\n }\n\n return requestTypesToGenerate\n}\n\n/**\n * Collects all inline response types that need to be generated.\n *\n * @param operations - Processed operations with metadata\n * @param spec - Raw OpenAPI specification\n * @returns Map of type names to their schemas\n */\nexport function collectInlineResponseTypes(\n operations: Operation[],\n spec: OpenAPISpec\n): Map<string, any> {\n const responseTypesToGenerate = new Map<string, any>()\n\n // Build a lookup map of operationId -> operation for O(1) access\n const operationLookup = new Map<string, OpenAPIOperation>()\n\n // Process paths\n for (const [, pathItem] of Object.entries(spec.paths || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n // Process webhooks\n for (const [, pathItem] of Object.entries(spec.webhooks || {})) {\n for (const [, operation] of Object.entries(pathItem)) {\n const op = operation as OpenAPIOperation\n if (op.operationId) {\n operationLookup.set(op.operationId, op)\n }\n }\n }\n\n for (const op of operations) {\n const operation = operationLookup.get(op.operationId)\n if (!operation) continue\n\n const responses = operation.responses || {}\n for (const [statusCode, response] of Object.entries(responses)) {\n if (/^2\\d\\d$/.test(statusCode) && (response as any).content) {\n const content = (response as any).content\n const jsonContent = content[\"application/json\"]\n\n if (jsonContent && jsonContent.schema) {\n const schema = jsonContent.schema\n const typeName = `${capitalize(toCamelCase(op.operationId))}Response`\n\n // Generate if it's not a simple $ref (those are already handled)\n // This includes allOf, oneOf, anyOf, and complex inline schemas\n if (!schema.$ref || schema.allOf || schema.oneOf || schema.anyOf) {\n responseTypesToGenerate.set(typeName, schema)\n }\n }\n }\n }\n }\n\n return responseTypesToGenerate\n}\n","/**\n * Generate a standalone helper types file for use with `helpers: \"file\"` mode.\n *\n * @returns TypeScript source containing PathFn, RequestMethod, HeaderFn, AnyHeaderFn, OperationErrors, and OperationDefinition type definitions.\n */\nexport function generateHelperFile(): string {\n const output: string[] = []\n\n output.push(\"// Generated helper types for Zenko\")\n output.push(\n \"// This file provides type definitions for operation objects and path functions\"\n )\n output.push(\"\")\n output.push(\n \"export type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string\"\n )\n output.push(\"\")\n output.push(\n 'export type RequestMethod = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"'\n )\n output.push(\"\")\n output.push(\n \"export type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult\"\n )\n output.push(\"\")\n output.push(\n \"export type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown)\"\n )\n output.push(\"\")\n output.push(\n \"export type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;\"\n )\n output.push(\"\")\n output.push(\n \"export type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {\"\n )\n output.push(\" method: TMethod\")\n output.push(\" path: TPath\")\n output.push(\" request?: TRequest\")\n output.push(\" response?: TResponse\")\n output.push(\" headers?: THeaders\")\n output.push(\" errors?: TErrors\")\n output.push(\"}\")\n output.push(\"\")\n\n return output.join(\"\\n\")\n}\n","import { topologicalSort, extractRefName } from \"./utils/topological-sort\"\nimport { formatPropertyName, isValidJSIdentifier } from \"./utils/property-name\"\nimport { toCamelCase, capitalize } from \"./utils/string-utils\"\nimport { isErrorStatus, mapStatusToIdentifier } from \"./utils/http-status\"\nimport { analyzeZenkoUsage, generateZenkoImport } from \"./utils/tree-shaking\"\nimport {\n collectInlineRequestTypes,\n collectInlineResponseTypes,\n} from \"./utils/collect-inline-types\"\nimport type { RequestMethod } from \"./types\"\nimport type {\n PathParam,\n QueryParam,\n RequestHeader,\n Operation,\n OperationErrorGroup,\n OperationErrorMap,\n} from \"./types/operation\"\nimport { generateHelperFile } from \"./utils/generate-helper-file\"\n\nexport type OpenAPISpec = {\n openapi: string\n info: unknown\n paths: Record<string, Record<string, unknown>>\n webhooks?: Record<string, Record<string, unknown>>\n components?: {\n schemas?: Record<string, unknown>\n parameters?: Record<string, unknown>\n }\n}\n\nexport type TypesHelperMode = \"package\" | \"inline\" | \"file\"\n\nexport type TypesConfig = {\n emit?: boolean\n helpers?: TypesHelperMode\n helpersOutput?: string\n treeShake?: boolean\n optionalType?: \"optional\" | \"nullable\" | \"nullish\"\n}\n\nexport type GenerateOptions = {\n strictDates?: boolean\n strictNumeric?: boolean\n types?: TypesConfig\n}\n\nexport type GenerateResult = {\n output: string\n helperFile?: {\n path: string\n content: string\n }\n}\n\n/**\n * Generate TypeScript source with additional metadata about helper files.\n *\n * @param spec - The OpenAPI specification to generate code from.\n * @param options - Generation options (e.g., strictDates, strictNumeric, types) that adjust emitted schemas and helper types.\n * @returns Object containing the generated output and optional helper file information.\n */\nexport function generateWithMetadata(\n spec: OpenAPISpec,\n options: GenerateOptions = {}\n): GenerateResult {\n const output: string[] = []\n const generatedTypes = new Set<string>()\n const { strictDates = false, strictNumeric = false } = options\n const typesConfig = normalizeTypesConfig(options.types)\n const schemaOptions: SchemaOptions = {\n strictDates,\n strictNumeric,\n optionalType: typesConfig.optionalType,\n }\n\n output.push('import { z } from \"zod\";')\n\n // Create mapping from original names to sanitized names\n const nameMap = new Map<string, string>()\n if (spec.components?.schemas) {\n for (const name of Object.keys(spec.components.schemas)) {\n nameMap.set(name, toCamelCase(name))\n }\n }\n\n // Parse all operations early for tree-shaking\n const operations = parseOperations(spec, nameMap)\n\n // Generate helper types import right after Zod import\n appendHelperTypesImport(output, typesConfig, operations)\n output.push(\"\")\n\n // Generate Zod schemas from components/schemas\n if (spec.components?.schemas) {\n output.push(\"// Generated Zod Schemas\")\n output.push(\"\")\n\n // Sort schemas by dependencies (topological sort)\n const sortedSchemas = topologicalSort(spec.components.schemas)\n\n for (const name of sortedSchemas) {\n const schema = spec.components.schemas[name]\n const sanitizedName = nameMap.get(name)!\n output.push(\n generateZodSchema(\n sanitizedName,\n schema,\n generatedTypes,\n schemaOptions,\n nameMap\n )\n )\n output.push(\"\")\n // Export inferred type\n output.push(\n `export type ${sanitizedName} = z.infer<typeof ${sanitizedName}>;`\n )\n output.push(\"\")\n }\n }\n\n // Generate path functions\n output.push(\"// Path Functions\")\n output.push(\"export const paths = {\")\n\n for (const op of operations) {\n const pathParamNames = op.pathParams.map((p) => p.name)\n const hasPathParams = pathParamNames.length > 0\n const hasQueryParams = op.queryParams.length > 0\n const camelCaseOperationId = toCamelCase(op.operationId)\n\n if (!hasPathParams && !hasQueryParams) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: () => \"${op.path}\",`\n )\n continue\n }\n\n const alias = (n: string) => {\n if (isValidJSIdentifier(n)) return n\n let aliased = toCamelCase(n)\n // If still not valid (e.g., starts with number), prefix with underscore\n if (!isValidJSIdentifier(aliased)) {\n aliased = `_${aliased}`\n }\n return aliased\n }\n const destructPieces: string[] = []\n const typePieces: string[] = []\n for (const param of op.pathParams) {\n destructPieces.push(\n isValidJSIdentifier(param.name)\n ? param.name\n : `${formatPropertyName(param.name)}: ${alias(param.name)}`\n )\n typePieces.push(`${formatPropertyName(param.name)}: string`)\n }\n for (const param of op.queryParams) {\n destructPieces.push(\n isValidJSIdentifier(param.name)\n ? param.name\n : `${formatPropertyName(param.name)}: ${alias(param.name)}`\n )\n typePieces.push(\n `${formatPropertyName(param.name)}${param.required ? \"\" : \"?\"}: ${mapQueryType(param)}`\n )\n }\n const needsDefaultObject =\n !hasPathParams &&\n hasQueryParams &&\n op.queryParams.every((param) => !param.required)\n const signatureArgs = destructPieces.length\n ? `{ ${destructPieces.join(\", \")} }`\n : \"{}\"\n const signature = `${signatureArgs}: { ${typePieces.join(\", \")} }${\n needsDefaultObject ? \" = {}\" : \"\"\n }`\n\n const pathWithParams = op.path.replace(\n /{([^}]+)}/g,\n (_m, n) => `\\${${alias(n)}}`\n )\n\n if (!hasQueryParams) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (${signature}) => \\`${pathWithParams}\\`,`\n )\n continue\n }\n\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (${signature}) => {`\n )\n\n output.push(\" const params = new URLSearchParams()\")\n for (const param of op.queryParams) {\n const accessor = isValidJSIdentifier(param.name)\n ? param.name\n : alias(toCamelCase(param.name))\n const schema = param.schema ?? {}\n\n if (schema?.type === \"array\") {\n const itemValueExpression = convertQueryParamValue(\n schema.items ?? {},\n \"value\"\n )\n\n if (param.required) {\n output.push(` for (const value of ${accessor}) {`)\n output.push(\n ` params.append(\"${param.name}\", ${itemValueExpression})`\n )\n output.push(\" }\")\n } else {\n output.push(` if (${accessor} !== undefined) {`)\n output.push(` for (const value of ${accessor}) {`)\n output.push(\n ` params.append(\"${param.name}\", ${itemValueExpression})`\n )\n output.push(\" }\")\n output.push(\" }\")\n }\n\n continue\n }\n\n const valueExpression = convertQueryParamValue(schema, accessor)\n if (param.required) {\n output.push(` params.set(\"${param.name}\", ${valueExpression})`)\n } else {\n output.push(` if (${accessor} !== undefined) {`)\n output.push(` params.set(\"${param.name}\", ${valueExpression})`)\n output.push(\" }\")\n }\n }\n\n output.push(\" const _searchParams = params.toString()\")\n output.push(\n ` return \\`${pathWithParams}\\${_searchParams ? \\`?\\${_searchParams}\\` : \"\"}\\``\n )\n output.push(\" },\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate header schemas\n output.push(\"// Header Schemas\")\n output.push(\"export const headerSchemas = {\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n if (!op.requestHeaders || op.requestHeaders.length === 0) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: z.object({}),`\n )\n continue\n }\n\n const schemaFields = op.requestHeaders\n .map((header) => {\n const zodType = mapHeaderToZodType(header)\n const finalType = header.required\n ? zodType\n : applyOptionalModifier(zodType, schemaOptions.optionalType)\n return ` ${formatPropertyName(header.name)}: ${finalType},`\n })\n .join(\"\\n\")\n\n output.push(` ${formatPropertyName(camelCaseOperationId)}: z.object({`)\n output.push(schemaFields)\n output.push(\" }),\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate header functions using Zod schemas\n output.push(\"// Header Functions\")\n output.push(\"export const headers = {\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n if (!op.requestHeaders || op.requestHeaders.length === 0) {\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: () => ${\n isValidJSIdentifier(camelCaseOperationId)\n ? `headerSchemas.${camelCaseOperationId}`\n : `headerSchemas[${formatPropertyName(camelCaseOperationId)}]`\n }.parse({}),`\n )\n continue\n }\n\n output.push(\n ` ${formatPropertyName(camelCaseOperationId)}: (params: z.input<${\n isValidJSIdentifier(camelCaseOperationId)\n ? `typeof headerSchemas.${camelCaseOperationId}`\n : `(typeof headerSchemas)[${formatPropertyName(camelCaseOperationId)}]`\n }>) => {`\n )\n output.push(\n ` return ${\n isValidJSIdentifier(camelCaseOperationId)\n ? `headerSchemas.${camelCaseOperationId}`\n : `headerSchemas[${formatPropertyName(camelCaseOperationId)}]`\n }.parse(params)`\n )\n output.push(\" },\")\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n\n // Generate request and response types before operation types\n generateRequestTypes(output, operations, spec, nameMap, schemaOptions)\n generateResponseTypes(output, operations, spec, nameMap, schemaOptions)\n\n // Generate operation types first (needed for type annotations)\n generateOperationTypes(output, operations, typesConfig)\n\n // Generate operation objects\n output.push(\"// Operation Objects\")\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n const typeAnnotation = typesConfig.emit\n ? `: ${capitalize(camelCaseOperationId)}Operation`\n : \"\"\n output.push(`export const ${camelCaseOperationId}${typeAnnotation} = {`)\n output.push(` method: \"${op.method}\",`)\n output.push(` path: paths.${camelCaseOperationId},`)\n\n appendOperationField(output, \"request\", op.requestType)\n appendOperationField(output, \"response\", op.responseType)\n\n if (op.requestHeaders && op.requestHeaders.length > 0) {\n output.push(` headers: headers.${camelCaseOperationId},`)\n }\n\n if (op.errors && hasAnyErrors(op.errors)) {\n appendErrorGroup(output, \"errors\", op.errors)\n }\n\n output.push(\"} as const;\")\n output.push(\"\")\n }\n\n const result: GenerateResult = {\n output: output.join(\"\\n\"),\n }\n\n // If using file-based helpers, include helper file information\n if (\n typesConfig.emit &&\n typesConfig.helpers === \"file\" &&\n typesConfig.helpersOutput\n ) {\n result.helperFile = {\n path: typesConfig.helpersOutput,\n content: generateHelperFile(),\n }\n }\n\n return result\n}\n\n/**\n * Generates TypeScript type definitions for inline request schemas.\n *\n * @param output - Array to which generated TypeScript code will be appended.\n * @param operations - Processed operations with metadata.\n * @param spec - The OpenAPI specification object.\n * @param nameMap - Mapping from original schema names to sanitized names.\n * @param schemaOptions - Options for schema generation.\n */\nfunction generateRequestTypes(\n output: string[],\n operations: Operation[],\n spec: OpenAPISpec,\n nameMap: Map<string, string>,\n schemaOptions: SchemaOptions\n) {\n const requestTypesToGenerate = collectInlineRequestTypes(operations, spec)\n\n // Generate the request type definitions\n if (requestTypesToGenerate.size > 0) {\n output.push(\"// Generated Request Types\")\n output.push(\"\")\n\n for (const [typeName, schema] of requestTypesToGenerate) {\n const generatedSchema = generateZodSchema(\n typeName,\n schema,\n new Set(),\n schemaOptions,\n nameMap\n )\n output.push(generatedSchema)\n output.push(\"\")\n output.push(`export type ${typeName} = z.infer<typeof ${typeName}>;`)\n output.push(\"\")\n }\n }\n}\n\n/**\n * Generates TypeScript type definitions for inline response schemas.\n *\n * @param output - Array to which generated TypeScript code will be appended.\n * @param operations - Processed operations with metadata.\n * @param spec - The OpenAPI specification object.\n * @param nameMap - Mapping from original schema names to sanitized names.\n * @param schemaOptions - Options for schema generation.\n */\nfunction generateResponseTypes(\n output: string[],\n operations: Operation[],\n spec: OpenAPISpec,\n nameMap: Map<string, string>,\n schemaOptions: SchemaOptions\n) {\n const responseTypesToGenerate = collectInlineResponseTypes(operations, spec)\n\n // Generate the response type definitions\n if (responseTypesToGenerate.size > 0) {\n output.push(\"// Generated Response Types\")\n output.push(\"\")\n\n for (const [typeName, schema] of responseTypesToGenerate) {\n const generatedSchema = generateZodSchema(\n typeName,\n schema,\n new Set(),\n schemaOptions,\n nameMap\n )\n output.push(generatedSchema)\n output.push(\"\")\n output.push(`export type ${typeName} = z.infer<typeof ${typeName}>;`)\n output.push(\"\")\n }\n }\n}\n\n/**\n * Generates TypeScript client code from an OpenAPI specification.\n *\n * @param spec - The OpenAPI specification object.\n * @param options - Configuration options controlling code generation behavior.\n * @returns Generated TypeScript code as a string.\n */\nexport function generate(\n spec: OpenAPISpec,\n options: GenerateOptions = {}\n): string {\n return generateWithMetadata(spec, options).output\n}\n\nfunction appendOperationField(\n buffer: string[],\n key: string,\n value?: string\n): void {\n if (!value) return\n buffer.push(` ${key}: ${value},`)\n}\n\nfunction appendErrorGroup(\n buffer: string[],\n label: string,\n errors?: OperationErrorMap\n): void {\n if (!errors || Object.keys(errors).length === 0) return\n buffer.push(` ${label}: {`)\n for (const [name, typeName] of Object.entries(errors)) {\n buffer.push(` ${formatPropertyName(name)}: ${typeName},`)\n }\n buffer.push(\" },\")\n}\n\n/**\n * Determines whether any error bucket in an operation error group contains entries.\n *\n * @param group - The operation error group to inspect (client, server, default, other buckets)\n * @returns `true` if at least one bucket has one or more entries, `false` otherwise.\n */\nfunction hasAnyErrors(group: OperationErrorGroup): boolean {\n return Boolean(group && Object.keys(group).length > 0)\n}\n\n/**\n * Determines whether a given string is one of the supported HTTP request methods.\n *\n * @param method - The HTTP method name to check (expected in lowercase).\n * @returns `true` if `method` is one of `\"get\"`, `\"put\"`, `\"post\"`, `\"delete\"`, `\"options\"`, `\"head\"`, `\"patch\"`, or `\"trace\"`, `false` otherwise.\n */\nfunction isRequestMethod(method: string): method is RequestMethod {\n switch (method) {\n case \"get\":\n case \"put\":\n case \"post\":\n case \"delete\":\n case \"options\":\n case \"head\":\n case \"patch\":\n case \"trace\":\n return true\n default:\n return false\n }\n}\n\n/**\n * Content-type priority mapping for response type inference.\n */\nconst CONTENT_TYPE_MAP: Record<string, string> = {\n \"application/json\": \"unknown\", // Will use schema when available\n \"text/csv\": \"string\",\n \"text/plain\": \"string\",\n // Binary/ambiguous types default to unknown for cross-platform compatibility\n \"application/octet-stream\": \"unknown\",\n \"application/pdf\": \"unknown\",\n}\n\n/**\n * Finds the most appropriate content type from available options.\n * Prefers JSON first, then uses content-type mapping, otherwise takes first available.\n */\nfunction findContentType(content: Record<string, any>): string {\n const contentTypes = Object.keys(content)\n\n // Prefer JSON\n if (contentTypes.includes(\"application/json\")) {\n return \"application/json\"\n }\n\n // Use first content type that has a mapping\n for (const contentType of contentTypes) {\n if (contentType in CONTENT_TYPE_MAP) {\n return contentType\n }\n }\n\n // Default to first available\n return contentTypes[0] || \"\"\n}\n\n/**\n * Infers the TypeScript type for a response based on content type and status code.\n */\nfunction inferResponseType(\n contentType: string,\n statusCode: string\n): string | undefined {\n // Handle NoContent and redirects\n if (statusCode === \"204\" || /^3\\d\\d$/.test(statusCode)) {\n return \"undefined\"\n }\n\n // Use content-type mapping\n if (contentType in CONTENT_TYPE_MAP) {\n return CONTENT_TYPE_MAP[contentType]\n }\n\n // Default to unknown for unrecognized types\n return \"unknown\"\n}\n\n/**\n * Collects operation metadata from an OpenAPI spec for operations that declare an `operationId` and use a supported HTTP method.\n *\n * @param spec - The OpenAPI specification to parse.\n * @returns An array of Operation objects describing each discovered operation (operationId, path, lowercase `method`, path and query parameters, request/response type names, request headers, and categorized errors).\n */\nfunction parseOperations(\n spec: OpenAPISpec,\n nameMap?: Map<string, string>\n): Operation[] {\n const operations: Operation[] = []\n\n // Process regular paths\n if (spec.paths) {\n for (const [path, pathItem] of Object.entries(spec.paths)) {\n for (const [method, operation] of Object.entries(pathItem)) {\n const normalizedMethod = method.toLowerCase()\n if (!isRequestMethod(normalizedMethod)) continue\n if (!(operation as any).operationId) continue\n\n const pathParams = extractPathParams(path)\n const requestType = getRequestType(operation)\n const { successResponse, errors } = getResponseTypes(\n operation,\n (operation as any).operationId,\n nameMap\n )\n const resolvedParameters = collectParameters(pathItem, operation, spec)\n const requestHeaders = getRequestHeaders(resolvedParameters)\n const queryParams = getQueryParams(resolvedParameters)\n\n operations.push({\n operationId: (operation as any).operationId,\n path,\n method: normalizedMethod,\n pathParams,\n queryParams,\n requestType,\n responseType: successResponse,\n requestHeaders,\n errors,\n })\n }\n }\n }\n\n // Process webhooks\n if (spec.webhooks) {\n for (const [webhookName, webhookItem] of Object.entries(spec.webhooks)) {\n for (const [method, operation] of Object.entries(webhookItem)) {\n const normalizedMethod = method.toLowerCase()\n if (!isRequestMethod(normalizedMethod)) continue\n if (!(operation as any).operationId) continue\n\n // For webhooks, we use the webhook name as the path identifier\n const path = webhookName\n const pathParams = extractPathParams(path)\n const requestType = getRequestType(operation)\n const { successResponse, errors } = getResponseTypes(\n operation,\n (operation as any).operationId\n )\n const resolvedParameters = collectParameters(\n webhookItem,\n operation,\n spec\n )\n const requestHeaders = getRequestHeaders(resolvedParameters)\n const queryParams = getQueryParams(resolvedParameters)\n\n operations.push({\n operationId: (operation as any).operationId,\n path,\n method: normalizedMethod,\n pathParams,\n queryParams,\n requestType,\n responseType: successResponse,\n requestHeaders,\n errors,\n })\n }\n }\n }\n\n return operations\n}\n\nfunction normalizeTypesConfig(\n config: TypesConfig | undefined\n): NormalizedTypesConfig {\n return {\n emit: config?.emit ?? true,\n helpers: config?.helpers ?? \"package\",\n helpersOutput: config?.helpersOutput ?? \"./zenko-types\",\n treeShake: config?.treeShake ?? true,\n optionalType: config?.optionalType ?? \"optional\",\n }\n}\n\ntype NormalizedTypesConfig = {\n emit: boolean\n helpers: TypesHelperMode\n helpersOutput: string\n treeShake: boolean\n optionalType: \"optional\" | \"nullable\" | \"nullish\"\n}\n\n/**\n * Appends helper type import or inline type declarations to the output buffer according to the types configuration.\n *\n * @param buffer - The output string buffer to which import lines or inline type declarations will be appended.\n * @param config - Normalized types configuration that controls whether to emit helpers and which helper mode to use (`package`, `file`, or `inline`). When `config.emit` is false no content is appended.\n */\nfunction appendHelperTypesImport(\n buffer: string[],\n config: NormalizedTypesConfig,\n operations: Operation[]\n) {\n if (!config.emit) return\n\n switch (config.helpers) {\n case \"package\":\n if (config.treeShake) {\n const usage = analyzeZenkoUsage(operations)\n const importStatement = generateZenkoImport(usage, \"package\")\n if (importStatement) {\n buffer.push(importStatement)\n }\n } else {\n buffer.push(\n 'import type { PathFn, HeaderFn, OperationDefinition, OperationErrors } from \"zenko\";'\n )\n }\n return\n case \"file\":\n if (config.treeShake) {\n const usage = analyzeZenkoUsage(operations)\n const importStatement = generateZenkoImport(\n usage,\n \"file\",\n config.helpersOutput\n )\n if (importStatement) {\n buffer.push(importStatement)\n }\n } else {\n buffer.push(\n `import type { PathFn, HeaderFn, OperationDefinition, OperationErrors } from \"${config.helpersOutput}\";`\n )\n }\n return\n case \"inline\":\n buffer.push(\n \"type PathFn<TArgs extends unknown[] = []> = (...args: TArgs) => string;\"\n )\n buffer.push(\n 'type RequestMethod = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\";'\n )\n buffer.push(\n \"type HeaderFn<TArgs extends unknown[] = [], TResult = Record<string, unknown> | Record<string, never>> = (...args: TArgs) => TResult;\"\n )\n buffer.push(\n \"type AnyHeaderFn = HeaderFn<any, unknown> | (() => unknown);\"\n )\n buffer.push(\n \"type OperationErrors<TError = unknown> = TError extends Record<string, unknown> ? TError : Record<string, TError>;\"\n )\n buffer.push(\n \"type OperationDefinition<TMethod extends RequestMethod, TPath extends (...args: any[]) => string, TRequest = undefined, TResponse = undefined, THeaders extends AnyHeaderFn | undefined = undefined, TErrors extends OperationErrors | undefined = undefined> = {\"\n )\n buffer.push(\" method: TMethod\")\n buffer.push(\" path: TPath\")\n buffer.push(\" request?: TRequest\")\n buffer.push(\" response?: TResponse\")\n buffer.push(\" headers?: THeaders\")\n buffer.push(\" errors?: TErrors\")\n buffer.push(\"}\")\n buffer.push(\"\")\n }\n}\n\n/**\n * Appends TypeScript operation type definitions to the output buffer.\n *\n * For each operation, emits an `export type <OperationId>Operation = OperationDefinition<...>` declaration\n * (including the HTTP method literal, path fn, request/response types, headers type, and errors type)\n * into the provided `buffer` when `config.emit` is true.\n *\n * @param buffer - Mutable array of output lines to append the generated type declarations to\n * @param operations - Array of operations to generate operation-type exports for\n * @param config - Normalized types configuration; generation is skipped when `config.emit` is false\n */\nfunction generateOperationTypes(\n buffer: string[],\n operations: Operation[],\n config: NormalizedTypesConfig\n) {\n if (!config.emit) return\n\n buffer.push(\"// Operation Types\")\n\n for (const op of operations) {\n const camelCaseOperationId = toCamelCase(op.operationId)\n const headerType = op.requestHeaders?.length\n ? isValidJSIdentifier(camelCaseOperationId)\n ? `typeof headers.${camelCaseOperationId}`\n : `(typeof headers)[${formatPropertyName(camelCaseOperationId)}]`\n : \"undefined\"\n const requestType = wrapTypeReference(op.requestType)\n const responseType = wrapTypeReference(op.responseType)\n const errorsType = buildOperationErrorsType(op.errors)\n\n buffer.push(\n `export type ${capitalize(camelCaseOperationId)}Operation = OperationDefinition<`\n )\n buffer.push(` \"${op.method}\",`)\n buffer.push(\n ` ${isValidJSIdentifier(camelCaseOperationId) ? `typeof paths.${camelCaseOperationId}` : `(typeof paths)[${formatPropertyName(camelCaseOperationId)}]`},`\n )\n buffer.push(` ${requestType},`)\n buffer.push(` ${responseType},`)\n buffer.push(` ${headerType},`)\n buffer.push(` ${errorsType}`)\n buffer.push(`>;`)\n buffer.push(\"\")\n }\n}\n\nfunction buildOperationErrorsType(errors?: OperationErrorGroup): string {\n if (!errors || !hasAnyErrors(errors)) {\n return \"OperationErrors\"\n }\n\n const errorBucket = buildErrorBucket(errors)\n\n return `OperationErrors<${errorBucket}>`\n}\n\nfunction buildErrorBucket(bucket?: OperationErrorMap): string {\n if (!bucket || Object.keys(bucket).length === 0) {\n return \"unknown\"\n }\n\n const entries = Object.entries(bucket)\n const accessibleEntries = entries.map(([name, type]) => {\n const propertyKey = formatPropertyName(name)\n const valueType = wrapErrorValueType(type)\n return `${propertyKey}: ${valueType}`\n })\n\n return `{ ${accessibleEntries.join(\"; \")} }`\n}\n\nconst TYPE_KEYWORDS = new Set([\n \"any\",\n \"unknown\",\n \"never\",\n \"void\",\n \"null\",\n \"undefined\",\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n])\nconst IDENTIFIER_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\nfunction wrapTypeReference(typeName?: string): string {\n if (!typeName) return \"undefined\"\n const normalized = typeName.trim()\n if (normalized === \"undefined\") return \"undefined\"\n if (TYPE_KEYWORDS.has(normalized)) return normalized\n if (normalized.startsWith(\"typeof \")) return normalized\n\n const arrayMatch = normalized.match(/^z\\.array\\((.+)\\)$/)\n if (arrayMatch) {\n return `z.ZodArray<${wrapTypeReference(arrayMatch[1])}>`\n }\n\n if (IDENTIFIER_PATTERN.test(normalized)) {\n return `typeof ${normalized}`\n }\n\n return normalized\n}\n\nfunction wrapErrorValueType(typeName?: string): string {\n if (!typeName) return \"unknown\"\n const normalized = typeName.trim()\n if (TYPE_KEYWORDS.has(normalized)) return normalized\n if (normalized.startsWith(\"typeof \")) return normalized\n\n const arrayMatch = normalized.match(/^z\\.array\\((.+)\\)$/)\n if (arrayMatch) {\n return `z.ZodArray<${wrapErrorValueType(arrayMatch[1])}>`\n }\n\n if (IDENTIFIER_PATTERN.test(normalized)) {\n return `typeof ${normalized}`\n }\n return normalized\n}\n\nfunction collectParameters(\n pathItem: Record<string, unknown>,\n operation: unknown,\n spec: OpenAPISpec\n): any[] {\n const parametersMap = new Map<string, any>()\n\n const addParameters = (params: unknown) => {\n if (!Array.isArray(params)) return\n\n for (const param of params) {\n const resolved = resolveParameter(param, spec)\n if (!resolved) continue\n const key = `${resolved.in}:${resolved.name}`\n parametersMap.set(key, resolved)\n }\n }\n\n addParameters((pathItem as any).parameters)\n addParameters((operation as any).parameters)\n\n return Array.from(parametersMap.values())\n}\n\nfunction resolveParameter(parameter: any, spec: OpenAPISpec) {\n if (!parameter) return undefined\n\n if (parameter.$ref) {\n const refName = extractRefName(parameter.$ref)\n const resolved = spec.components?.parameters?.[refName]\n if (!resolved) return undefined\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { $ref, ...overrides } = parameter\n return {\n ...resolved,\n ...overrides,\n }\n }\n\n return parameter\n}\n\nfunction extractPathParams(path: string): PathParam[] {\n const params: PathParam[] = []\n const matches = path.match(/{([^}]+)}/g)\n\n if (matches) {\n for (const match of matches) {\n const paramName = match.slice(1, -1)\n params.push({\n name: paramName,\n type: \"string\", // OpenAPI path params are always strings\n })\n }\n }\n\n return params\n}\n\nfunction getRequestType(operation: any): string | undefined {\n const requestBody =\n operation.requestBody?.content?.[\"application/json\"]?.schema\n if (!requestBody) return undefined\n\n if (requestBody.$ref) {\n return extractRefName(requestBody.$ref)\n }\n\n // Generate inline type if needed\n const typeName = `${capitalize(toCamelCase(operation.operationId))}Request`\n return typeName\n}\n\n/**\n * Resolves success and error response typings for an operation.\n *\n * @param operation - The OpenAPI operation node to inspect.\n * @param operationId - The operation identifier used for synthesized names.\n * @returns The preferred success response type and categorized error groups.\n */\nfunction getResponseTypes(\n operation: any,\n operationId: string,\n nameMap?: Map<string, string>\n): {\n successResponse?: string\n errors?: OperationErrorGroup\n} {\n const responses = operation.responses ?? {}\n const successCodes = new Map<string, string>()\n const errorEntries: Array<{ code: string; schema: any }> = []\n\n for (const [statusCode, response] of Object.entries(responses)) {\n // Handle content types\n const content = (response as any)?.content\n if (!content || Object.keys(content).length === 0) {\n // No content - handle based on status code\n if (statusCode === \"204\" || /^3\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, \"undefined\")\n } else if (isErrorStatus(statusCode)) {\n // Include error responses even without content\n errorEntries.push({\n code: statusCode,\n schema: \"undefined\",\n })\n }\n continue\n }\n\n // Find the appropriate content type\n const contentType = findContentType(content)\n const resolvedSchema = content[contentType]?.schema\n\n if (!resolvedSchema) {\n // No schema - infer from content type\n const inferredType = inferResponseType(contentType, statusCode)\n if (inferredType) {\n if (isErrorStatus(statusCode)) {\n errorEntries.push({\n code: statusCode,\n schema: inferredType,\n })\n } else if (/^2\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, inferredType)\n }\n }\n continue\n }\n\n if (isErrorStatus(statusCode)) {\n errorEntries.push({ code: statusCode, schema: resolvedSchema })\n continue\n }\n\n if (/^2\\d\\d$/.test(statusCode)) {\n successCodes.set(statusCode, resolvedSchema)\n }\n }\n\n const successResponse = selectSuccessResponse(\n successCodes,\n operationId,\n nameMap\n )\n const errors = buildErrorGroups(errorEntries, operationId, nameMap)\n\n return { successResponse, errors }\n}\n\n/**\n * Picks the most representative success response type from available candidates.\n *\n * Prefers 200/201/204 responses, falling back to the first declared status code.\n * When a schema is provided as a literal type string the literal is returned\n * directly; otherwise a synthetic type name is generated via `resolveResponseType`.\n *\n * @param responses - Map of status codes to resolved schemas or inferred literals.\n * @param operationId - Operation identifier used to construct synthetic names.\n * @returns The chosen TypeScript type name, or `undefined` when no success response exists.\n */\nfunction selectSuccessResponse(\n responses: Map<string, any>,\n operationId: string,\n nameMap?: Map<string, string>\n): string | undefined {\n if (responses.size === 0) return undefined\n\n const preferredOrder = [\"200\", \"201\", \"204\"]\n for (const code of preferredOrder) {\n const schema = responses.get(code)\n if (schema) {\n if (typeof schema === \"string\") {\n // Direct type (e.g., \"undefined\", \"string\", \"unknown\")\n return schema\n }\n return resolveResponseType(\n schema,\n `${capitalize(toCamelCase(operationId))}Response`,\n nameMap\n )\n }\n }\n\n const [, firstSchema] = responses.entries().next().value ?? []\n if (!firstSchema) return undefined\n\n if (typeof firstSchema === \"string\") {\n return firstSchema\n }\n\n return resolveResponseType(\n firstSchema,\n `${capitalize(toCamelCase(operationId))}Response`,\n nameMap\n )\n}\n\n/**\n * Buckets error responses by status-class and maps them to concrete type names.\n *\n * @param errors - Collection of HTTP status codes paired with schemas or literals.\n * @param operationId - Operation identifier used when synthesizing fallback names.\n * @returns Structured error groups keyed by client/server/default/other categories.\n */\nfunction buildErrorGroups(\n errors: Array<{ code: string; schema: any }> = [],\n operationId: string,\n nameMap?: Map<string, string>\n): OperationErrorGroup | undefined {\n if (!errors.length) return undefined\n\n const group: OperationErrorGroup = {}\n\n for (const { code, schema } of errors) {\n const identifier = mapStatusToIdentifier(code)\n const typeName = resolveResponseType(\n schema,\n `${capitalize(toCamelCase(operationId))}${capitalize(identifier)}`,\n nameMap\n )\n\n group[identifier] = typeName\n }\n\n return group\n}\n\n/**\n * Resolves the emitted TypeScript identifier for a response schema.\n *\n * @param schema - Schema object or inferred literal type returned by inference.\n * @param fallbackName - Synthetic name to use when the schema lacks a `$ref`.\n * @returns Reference name, literal type, or the provided fallback.\n */\nfunction resolveResponseType(\n schema: any,\n fallbackName: string,\n nameMap?: Map<string, string>\n): string {\n if (typeof schema === \"string\") {\n return schema\n }\n if (schema.$ref) {\n const refName = extractRefName(schema.$ref)\n return nameMap?.get(refName) || refName\n }\n // Handle array schemas with $ref items\n if (schema.type === \"array\" && schema.items?.$ref) {\n const itemRef = extractRefName(schema.items.$ref)\n const sanitizedItemRef = nameMap?.get(itemRef) || itemRef\n return `z.array(${sanitizedItemRef})`\n }\n // Handle allOf schemas - create synthetic type\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return fallbackName\n }\n return fallbackName\n}\n\nfunction getRequestHeaders(parameters: any[]): RequestHeader[] {\n const headers: RequestHeader[] = []\n\n for (const param of parameters ?? []) {\n if ((param as any).in === \"header\") {\n headers.push({\n name: (param as any).name,\n description: (param as any).description,\n schema: (param as any).schema,\n required: (param as any).required,\n })\n }\n }\n\n return headers\n}\n\nfunction getQueryParams(parameters: any[]): QueryParam[] {\n const queryParams: QueryParam[] = []\n\n for (const param of parameters ?? []) {\n if ((param as any).in === \"query\") {\n queryParams.push({\n name: (param as any).name,\n description: (param as any).description,\n schema: (param as any).schema,\n required: (param as any).required,\n })\n }\n }\n\n return queryParams\n}\n\nfunction mapHeaderToZodType(header: RequestHeader): string {\n const schema = header.schema ?? {}\n const schemaType = schema.type\n switch (schemaType) {\n case \"integer\":\n case \"number\":\n // Accept numeric header values provided as strings\n return \"z.coerce.number()\"\n case \"boolean\":\n // Accept boolean header values provided as strings\n return \"z.coerce.boolean()\"\n case \"array\": {\n const items = schema.items ?? { type: \"string\" }\n const itemType =\n items.type === \"integer\" || items.type === \"number\"\n ? \"z.coerce.number()\"\n : items.type === \"boolean\"\n ? \"z.coerce.boolean()\"\n : \"z.string()\"\n return `z.array(${itemType})`\n }\n default:\n return \"z.string()\"\n }\n}\n\nfunction mapQueryType(param: QueryParam): string {\n return mapQuerySchemaType(param.schema)\n}\n\nfunction mapQuerySchemaType(schema: any): string {\n if (!schema) return \"string\"\n\n if (schema.type === \"array\") {\n const itemType = mapQuerySchemaType(schema.items)\n return `Array<${itemType}>`\n }\n\n switch (schema.type) {\n case \"integer\":\n case \"number\":\n return \"number\"\n case \"boolean\":\n return \"boolean\"\n default:\n return \"string\"\n }\n}\n\nfunction convertQueryParamValue(schema: any, accessor: string): string {\n if (!schema) {\n return `String(${accessor})`\n }\n\n switch (schema.type) {\n case \"integer\":\n case \"number\":\n return `String(${accessor})`\n case \"boolean\":\n return `${accessor} ? \"true\" : \"false\"`\n default:\n return `String(${accessor})`\n }\n}\n\ntype SchemaOptions = {\n strictDates: boolean\n strictNumeric: boolean\n optionalType: \"optional\" | \"nullable\" | \"nullish\"\n}\n\n/**\n * Applies the appropriate optional modifier to a Zod type based on the optionalType option.\n */\nfunction applyOptionalModifier(\n zodType: string,\n optionalType: \"optional\" | \"nullable\" | \"nullish\"\n): string {\n switch (optionalType) {\n case \"optional\":\n return `${zodType}.optional()`\n case \"nullable\":\n return `${zodType}.nullable()`\n case \"nullish\":\n return `${zodType}.nullish()`\n }\n}\n\nfunction generateZodSchema(\n name: string,\n schema: any,\n generatedTypes: Set<string>,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n if (generatedTypes.has(name)) return \"\"\n generatedTypes.add(name)\n\n if (schema.enum) {\n const enumValues = schema.enum.map((v: string) => `\"${v}\"`).join(\", \")\n return `export const ${name} = z.enum([${enumValues}]);`\n }\n\n // Handle allOf schemas\n if (schema.allOf && Array.isArray(schema.allOf)) {\n const allOfParts = schema.allOf.map((part: any) =>\n getZodTypeFromSchema(part, options, nameMap)\n )\n if (allOfParts.length === 0) return `export const ${name} = z.object({});`\n if (allOfParts.length === 1)\n return `export const ${name} = ${allOfParts[0]};`\n const first = allOfParts[0]\n const rest = allOfParts\n .slice(1)\n .map((part: string) => `.and(${part})`)\n .join(\"\")\n return `export const ${name} = ${first}${rest};`\n }\n\n if (schema.type === \"object\" || schema.properties) {\n return `export const ${name} = ${buildZodObject(schema, options, nameMap)};`\n }\n\n if (schema.type === \"array\") {\n const itemSchema = schema.items ?? { type: \"unknown\" }\n const itemType = getZodTypeFromSchema(itemSchema, options, nameMap)\n const builder = applyStrictArrayBounds(\n schema,\n `z.array(${itemType})`,\n itemSchema,\n options.strictNumeric\n )\n return `export const ${name} = ${builder};`\n }\n\n return `export const ${name} = ${getZodTypeFromSchema(schema, options, nameMap)};`\n}\n\nfunction getZodTypeFromSchema(\n schema: any,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n if (schema.$ref) {\n const refName = extractRefName(schema.$ref)\n return nameMap?.get(refName) || refName\n }\n\n if (schema.enum) {\n const enumValues = schema.enum.map((v: string) => `\"${v}\"`).join(\", \")\n return `z.enum([${enumValues}])`\n }\n\n // Handle allOf schemas\n if (schema.allOf && Array.isArray(schema.allOf)) {\n const allOfParts = schema.allOf.map((part: any) =>\n getZodTypeFromSchema(part, options, nameMap)\n )\n if (allOfParts.length === 0) return \"z.object({})\"\n if (allOfParts.length === 1) return allOfParts[0]\n const first = allOfParts[0]\n const rest = allOfParts\n .slice(1)\n .map((part: string) => `.and(${part})`)\n .join(\"\")\n return `${first}${rest}`\n }\n\n // Check for object with properties (including those without explicit type)\n if (\n schema.type === \"object\" ||\n schema.properties ||\n schema.allOf ||\n schema.oneOf ||\n schema.anyOf\n ) {\n return buildZodObject(schema, options, nameMap)\n }\n\n switch (schema.type) {\n case \"string\":\n return buildString(schema, options)\n case \"boolean\":\n return \"z.boolean()\"\n case \"array\":\n return `z.array(${getZodTypeFromSchema(\n schema.items ?? { type: \"unknown\" },\n options,\n nameMap\n )})`\n case \"null\":\n return \"z.null()\"\n case \"number\":\n return buildNumber(schema, options)\n case \"integer\":\n return buildInteger(schema, options)\n default:\n return \"z.unknown()\"\n }\n}\n\nfunction buildZodObject(\n schema: any,\n options: SchemaOptions,\n nameMap?: Map<string, string>\n): string {\n const properties: string[] = []\n\n for (const [propName, propSchema] of Object.entries(\n schema.properties || {}\n )) {\n const isRequired = schema.required?.includes(propName) ?? false\n const zodType = getZodTypeFromSchema(propSchema as any, options, nameMap)\n const finalType = isRequired\n ? zodType\n : applyOptionalModifier(zodType, options.optionalType)\n properties.push(` ${formatPropertyName(propName)}: ${finalType},`)\n }\n\n if (properties.length === 0) {\n return \"z.object({})\"\n }\n\n return `z.object({\\n${properties.join(\"\\n\")}\\n})`\n}\n\nfunction buildString(schema: any, options: SchemaOptions): string {\n if (options.strictDates) {\n switch (schema.format) {\n case \"date-time\":\n return \"z.string().datetime()\"\n case \"date\":\n return \"z.string().date()\"\n case \"time\":\n return \"z.string().time()\"\n case \"duration\":\n return \"z.string().duration()\"\n }\n }\n\n let builder = \"z.string()\"\n\n if (options.strictNumeric) {\n if (typeof schema.minLength === \"number\") {\n builder += `.min(${schema.minLength})`\n }\n\n if (typeof schema.maxLength === \"number\") {\n builder += `.max(${schema.maxLength})`\n }\n\n if (schema.pattern) {\n builder += `.regex(new RegExp(${JSON.stringify(schema.pattern)}))`\n }\n }\n\n switch (schema.format) {\n case \"uuid\":\n return `${builder}.uuid()`\n case \"email\":\n return `${builder}.email()`\n case \"uri\":\n case \"url\":\n return `${builder}.url()`\n case \"ipv4\":\n return `${builder}.ip({ version: \"v4\" })`\n case \"ipv6\":\n return `${builder}.ip({ version: \"v6\" })`\n default:\n return builder\n }\n}\n\nfunction buildNumber(schema: any, options: SchemaOptions): string {\n let builder = \"z.number()\"\n\n if (options.strictNumeric) {\n builder = applyNumericBounds(schema, builder)\n\n if (typeof schema.multipleOf === \"number\" && schema.multipleOf !== 0) {\n builder += `.refine((value) => Math.abs(value / ${schema.multipleOf} - Math.round(value / ${schema.multipleOf})) < Number.EPSILON, { message: \"Must be a multiple of ${schema.multipleOf}\" })`\n }\n }\n\n return builder\n}\n\nfunction buildInteger(schema: any, options: SchemaOptions): string {\n let builder = buildNumber(schema, options)\n builder += \".int()\"\n return builder\n}\n\nfunction applyStrictArrayBounds(\n schema: any,\n builder: string,\n itemSchema: any,\n enforceBounds: boolean\n): string {\n if (!enforceBounds) {\n return builder\n }\n\n if (typeof schema.minItems === \"number\") {\n builder += `.min(${schema.minItems})`\n }\n\n if (typeof schema.maxItems === \"number\") {\n builder += `.max(${schema.maxItems})`\n }\n\n if (schema.uniqueItems && isPrimitiveLike(itemSchema)) {\n builder +=\n '.refine((items) => new Set(items).size === items.length, { message: \"Items must be unique\" })'\n }\n\n return builder\n}\n\nfunction isPrimitiveLike(schema: any): boolean {\n if (schema?.$ref) return false\n\n const primitiveTypes = new Set([\"string\", \"number\", \"integer\", \"boolean\"])\n return primitiveTypes.has(schema?.type)\n}\n\nfunction applyNumericBounds(schema: any, builder: string): string {\n if (typeof schema.minimum === \"number\") {\n if (schema.exclusiveMinimum === true) {\n builder += `.gt(${schema.minimum})`\n } else {\n builder += `.min(${schema.minimum})`\n }\n } else if (typeof schema.exclusiveMinimum === \"number\") {\n builder += `.gt(${schema.exclusiveMinimum})`\n }\n\n if (typeof schema.maximum === \"number\") {\n if (schema.exclusiveMaximum === true) {\n builder += `.lt(${schema.maximum})`\n } else {\n builder += `.max(${schema.maximum})`\n }\n } else if (typeof schema.exclusiveMaximum === \"number\") {\n builder += `.lt(${schema.exclusiveMaximum})`\n }\n\n return builder\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAoB;AACpB,WAAsB;AACtB,iBAA8B;AAC9B,qBAAqB;;;ACLd,SAAS,gBAAgB,SAAwC;AACtE,QAAM,UAAU,oBAAI,IAAY;AAChC,QAAM,WAAW,oBAAI,IAAY;AACjC,QAAM,SAAmB,CAAC;AAE1B,QAAM,QAAQ,CAAC,SAAuB;AACpC,QAAI,QAAQ,IAAI,IAAI,EAAG;AACvB,QAAI,SAAS,IAAI,IAAI,GAAG;AAEtB;AAAA,IACF;AAEA,aAAS,IAAI,IAAI;AAGjB,UAAM,SAAS,QAAQ,IAAI;AAC3B,UAAM,eAAe,oBAAoB,MAAM;AAG/C,eAAW,OAAO,cAAc;AAC9B,UAAI,QAAQ,GAAG,GAAG;AAChB,cAAM,GAAG;AAAA,MACX;AAAA,IACF;AAEA,aAAS,OAAO,IAAI;AACpB,YAAQ,IAAI,IAAI;AAChB,WAAO,KAAK,IAAI;AAAA,EAClB;AAGA,aAAW,QAAQ,OAAO,KAAK,OAAO,GAAG;AACvC,UAAM,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