orval 8.3.0 → 8.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/orval.mjs +4 -3
- package/dist/bin/orval.mjs.map +1 -1
- package/dist/{config-B07NzN_N.mjs → config-glSQmAy7.mjs} +178 -45
- package/dist/config-glSQmAy7.mjs.map +1 -0
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -13
- package/dist/config-B07NzN_N.mjs.map +0 -1
package/dist/bin/orval.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as name, i as startWatcher, l as version, n as loadConfigFile, o as normalizeOptions, r as generateSpec, s as description, t as findConfigFile } from "../config-
|
|
2
|
+
import { c as name, i as startWatcher, l as version, n as loadConfigFile, o as normalizeOptions, r as generateSpec, s as description, t as findConfigFile } from "../config-glSQmAy7.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Option, program } from "@commander-js/extra-typings";
|
|
5
|
-
import { ErrorWithTag, OutputClient, OutputMode, isString, log, logError, startMessage } from "@orval/core";
|
|
5
|
+
import { ErrorWithTag, OutputClient, OutputMode, isString, log, logError, setVerbose, startMessage } from "@orval/core";
|
|
6
6
|
|
|
7
7
|
//#region src/bin/orval.ts
|
|
8
8
|
const orvalMessage = startMessage({
|
|
@@ -11,7 +11,8 @@ const orvalMessage = startMessage({
|
|
|
11
11
|
description
|
|
12
12
|
});
|
|
13
13
|
const cli = program.name("orval").description("Instantly generate TypeScript clients from your OpenAPI specification").version(version);
|
|
14
|
-
cli.addOption(new Option("-o, --output <path>", "output file destination").conflicts(["config", "project"])).addOption(new Option("-i, --input <path>", "input file (yaml or json openapi specs)").conflicts(["config", "project"])).addOption(new Option("-c, --config <path>", "override flags by a config file").conflicts(["input", "output"])).addOption(new Option("-p, --project <name...>", "focus one or more projects of the config").conflicts(["input", "output"])).addOption(new Option("-m, --mode <name>", "default mode that will be used").choices(Object.values(OutputMode))).option("-w, --watch [paths...]", "Watch mode, if path is not specified, it watches the input target").addOption(new Option("--client <name>", "default client that will be used").choices(Object.values(OutputClient))).option("--mock", "activate the mock").option("--clean [paths...]", "Clean output directory").option("--prettier", "Prettier generated files").option("--biome", "biome generated files").option("--tsconfig <path>", "path to your tsconfig file").action(async (options) => {
|
|
14
|
+
cli.addOption(new Option("-o, --output <path>", "output file destination").conflicts(["config", "project"])).addOption(new Option("-i, --input <path>", "input file (yaml or json openapi specs)").conflicts(["config", "project"])).addOption(new Option("-c, --config <path>", "override flags by a config file").conflicts(["input", "output"])).addOption(new Option("-p, --project <name...>", "focus one or more projects of the config").conflicts(["input", "output"])).addOption(new Option("-m, --mode <name>", "default mode that will be used").choices(Object.values(OutputMode))).option("-w, --watch [paths...]", "Watch mode, if path is not specified, it watches the input target").addOption(new Option("--client <name>", "default client that will be used").choices(Object.values(OutputClient))).option("--mock", "activate the mock").option("--clean [paths...]", "Clean output directory").option("--prettier", "Prettier generated files").option("--biome", "biome generated files").option("--tsconfig <path>", "path to your tsconfig file").option("--verbose", "Enable verbose logging").action(async (options) => {
|
|
15
|
+
if (options.verbose) setVerbose(true);
|
|
15
16
|
log(orvalMessage);
|
|
16
17
|
if (isString(options.input) && isString(options.output)) {
|
|
17
18
|
const normalizedOptions = await normalizeOptions({
|
package/dist/bin/orval.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orval.mjs","names":["pkg.name","pkg.version","pkg.description"],"sources":["../../src/bin/orval.ts"],"sourcesContent":["#!/usr/bin/env node\nimport path from 'node:path';\n\nimport { Option, program } from '@commander-js/extra-typings';\nimport {\n ErrorWithTag,\n isString,\n log,\n logError,\n OutputClient,\n OutputMode,\n startMessage,\n} from '@orval/core';\n\nimport pkg from '../../package.json';\nimport { generateSpec } from '../generate-spec';\nimport { findConfigFile, loadConfigFile } from '../utils/config';\nimport { normalizeOptions } from '../utils/options';\nimport { startWatcher } from '../utils/watcher';\n\nconst orvalMessage = startMessage({\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n});\nconst cli = program\n .name('orval')\n .description(\n 'Instantly generate TypeScript clients from your OpenAPI specification',\n )\n .version(pkg.version);\n\ncli\n .addOption(\n new Option('-o, --output <path>', 'output file destination').conflicts([\n 'config',\n 'project',\n ]),\n )\n .addOption(\n new Option(\n '-i, --input <path>',\n 'input file (yaml or json openapi specs)',\n ).conflicts(['config', 'project']),\n )\n .addOption(\n new Option(\n '-c, --config <path>',\n 'override flags by a config file',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option(\n '-p, --project <name...>',\n 'focus one or more projects of the config',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option('-m, --mode <name>', 'default mode that will be used').choices(\n Object.values(OutputMode),\n ),\n )\n .option(\n '-w, --watch [paths...]',\n 'Watch mode, if path is not specified, it watches the input target',\n )\n .addOption(\n new Option('--client <name>', 'default client that will be used').choices(\n Object.values(OutputClient),\n ),\n )\n .option('--mock', 'activate the mock')\n .option('--clean [paths...]', 'Clean output directory')\n .option('--prettier', 'Prettier generated files')\n .option('--biome', 'biome generated files')\n .option('--tsconfig <path>', 'path to your tsconfig file')\n .action(async (options) => {\n log(orvalMessage);\n\n if (isString(options.input) && isString(options.output)) {\n const normalizedOptions = await normalizeOptions({\n input: options.input,\n output: {\n target: options.output,\n clean: options.clean,\n prettier: options.prettier,\n biome: options.biome,\n mock: options.mock,\n client: options.client,\n mode: options.mode,\n tsconfig: options.tsconfig,\n },\n });\n\n if (options.watch) {\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n logError(error);\n process.exit(1);\n }\n },\n normalizedOptions.input.target as string,\n );\n } else {\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n if (error instanceof ErrorWithTag) {\n logError(error.cause, error.tag);\n } else {\n logError(error);\n }\n process.exit(1);\n }\n }\n } else {\n const configFilePath = findConfigFile(options.config);\n const workspace = path.dirname(configFilePath);\n const configFile = await loadConfigFile(configFilePath);\n\n const missingProjects = options.project?.filter(\n (p) => !Object.hasOwn(configFile, p),\n );\n\n if (missingProjects?.length) {\n logError(`Project not found in config: ${missingProjects.join(', ')}`);\n process.exit(1);\n }\n\n const configs = Object.entries(configFile).filter(\n ([projectName]) =>\n // only filter by project if specified\n !Array.isArray(options.project) ||\n options.project.includes(projectName),\n );\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n if (options.watch === undefined) {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n } else {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors) {\n logError('One or more project failed, see above for details');\n process.exit(1);\n }\n }\n });\n\nawait cli.parseAsync(process.argv);\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"orval.mjs","names":["pkg.name","pkg.version","pkg.description"],"sources":["../../src/bin/orval.ts"],"sourcesContent":["#!/usr/bin/env node\nimport path from 'node:path';\n\nimport { Option, program } from '@commander-js/extra-typings';\nimport {\n ErrorWithTag,\n isString,\n log,\n logError,\n OutputClient,\n OutputMode,\n setVerbose,\n startMessage,\n} from '@orval/core';\n\nimport pkg from '../../package.json';\nimport { generateSpec } from '../generate-spec';\nimport { findConfigFile, loadConfigFile } from '../utils/config';\nimport { normalizeOptions } from '../utils/options';\nimport { startWatcher } from '../utils/watcher';\n\nconst orvalMessage = startMessage({\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n});\nconst cli = program\n .name('orval')\n .description(\n 'Instantly generate TypeScript clients from your OpenAPI specification',\n )\n .version(pkg.version);\n\ncli\n .addOption(\n new Option('-o, --output <path>', 'output file destination').conflicts([\n 'config',\n 'project',\n ]),\n )\n .addOption(\n new Option(\n '-i, --input <path>',\n 'input file (yaml or json openapi specs)',\n ).conflicts(['config', 'project']),\n )\n .addOption(\n new Option(\n '-c, --config <path>',\n 'override flags by a config file',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option(\n '-p, --project <name...>',\n 'focus one or more projects of the config',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option('-m, --mode <name>', 'default mode that will be used').choices(\n Object.values(OutputMode),\n ),\n )\n .option(\n '-w, --watch [paths...]',\n 'Watch mode, if path is not specified, it watches the input target',\n )\n .addOption(\n new Option('--client <name>', 'default client that will be used').choices(\n Object.values(OutputClient),\n ),\n )\n .option('--mock', 'activate the mock')\n .option('--clean [paths...]', 'Clean output directory')\n .option('--prettier', 'Prettier generated files')\n .option('--biome', 'biome generated files')\n .option('--tsconfig <path>', 'path to your tsconfig file')\n .option('--verbose', 'Enable verbose logging')\n .action(async (options) => {\n if (options.verbose) {\n setVerbose(true);\n }\n\n log(orvalMessage);\n\n if (isString(options.input) && isString(options.output)) {\n const normalizedOptions = await normalizeOptions({\n input: options.input,\n output: {\n target: options.output,\n clean: options.clean,\n prettier: options.prettier,\n biome: options.biome,\n mock: options.mock,\n client: options.client,\n mode: options.mode,\n tsconfig: options.tsconfig,\n },\n });\n\n if (options.watch) {\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n logError(error);\n process.exit(1);\n }\n },\n normalizedOptions.input.target as string,\n );\n } else {\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n if (error instanceof ErrorWithTag) {\n logError(error.cause, error.tag);\n } else {\n logError(error);\n }\n process.exit(1);\n }\n }\n } else {\n const configFilePath = findConfigFile(options.config);\n const workspace = path.dirname(configFilePath);\n const configFile = await loadConfigFile(configFilePath);\n\n const missingProjects = options.project?.filter(\n (p) => !Object.hasOwn(configFile, p),\n );\n\n if (missingProjects?.length) {\n logError(`Project not found in config: ${missingProjects.join(', ')}`);\n process.exit(1);\n }\n\n const configs = Object.entries(configFile).filter(\n ([projectName]) =>\n // only filter by project if specified\n !Array.isArray(options.project) ||\n options.project.includes(projectName),\n );\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n if (options.watch === undefined) {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n } else {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors) {\n logError('One or more project failed, see above for details');\n process.exit(1);\n }\n }\n });\n\nawait cli.parseAsync(process.argv);\n"],"mappings":";;;;;;;AAqBA,MAAM,eAAe,aAAa;CAC1BA;CACGC;CACIC;CACd,CAAC;AACF,MAAM,MAAM,QACT,KAAK,QAAQ,CACb,YACC,wEACD,CACA,QAAQD,QAAY;AAEvB,IACG,UACC,IAAI,OAAO,uBAAuB,0BAA0B,CAAC,UAAU,CACrE,UACA,UACD,CAAC,CACH,CACA,UACC,IAAI,OACF,sBACA,0CACD,CAAC,UAAU,CAAC,UAAU,UAAU,CAAC,CACnC,CACA,UACC,IAAI,OACF,uBACA,kCACD,CAAC,UAAU,CAAC,SAAS,SAAS,CAAC,CACjC,CACA,UACC,IAAI,OACF,2BACA,2CACD,CAAC,UAAU,CAAC,SAAS,SAAS,CAAC,CACjC,CACA,UACC,IAAI,OAAO,qBAAqB,iCAAiC,CAAC,QAChE,OAAO,OAAO,WAAW,CAC1B,CACF,CACA,OACC,0BACA,oEACD,CACA,UACC,IAAI,OAAO,mBAAmB,mCAAmC,CAAC,QAChE,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EAAE;;EAGjB,MAAM,UAAU,OAAO,QAAQ,WAAW,CAAC,QACxC,CAAC,iBAEA,CAAC,MAAM,QAAQ,QAAQ,QAAQ,IAC/B,QAAQ,QAAQ,SAAS,YAAY,CACxC;EAED,IAAI,YAAY;AAChB,OAAK,MAAM,CAAC,aAAa,WAAW,SAAS;GAC3C,MAAM,oBAAoB,MAAM,iBAC9B,QACA,WACA,QACD;AAED,OAAI,QAAQ,UAAU,OACpB,KAAI;AACF,UAAM,aAAa,WAAW,mBAAmB,YAAY;YACtD,OAAO;AACd,gBAAY;AACZ,aAAS,OAAO,YAAY;;QAEzB;IACL,MAAM,cAAc,SAAS,kBAAkB,MAAM,OAAO,GACxD,kBAAkB,MAAM,SACxB;AAEJ,UAAM,aACJ,QAAQ,OACR,YAAY;AACV,SAAI;AACF,YAAM,aAAa,WAAW,mBAAmB,YAAY;cACtD,OAAO;AACd,eAAS,OAAO,YAAY;;OAGhC,YACD;;;AAIL,MAAI,WAAW;AACb,YAAS,oDAAoD;AAC7D,WAAQ,KAAK,EAAE;;;EAGnB;AAEJ,MAAM,IAAI,WAAW,QAAQ,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { FormDataArrayHandling, GetterPropType, NamingConvention, OutputClient, OutputHttpClient, OutputMode, PropertySortOrder, RefComponentSuffix, asyncReduce, conventionName, createLogger, createSuccessMessage, dynamicImport, fixCrossDirectoryImports, fixRegularSchemaImports, generateComponentDefinition, generateDependencyImports, generateParameterDefinition, generateSchemasDefinition, generateVerbsOptions, getFileInfo, getFullRoute, getMockFileExtensionByTypeName, getRoute, isBoolean, isFunction, isNullish, isObject, isReference, isString, isUrl, jsDoc, log, logError, pascal, removeFilesAndEmptyFolders, resolveRef, splitSchemasByType, upath, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode } from "@orval/core";
|
|
2
|
+
import { FormDataArrayHandling, GetterPropType, NamingConvention, OutputClient, OutputHttpClient, OutputMode, PropertySortOrder, RefComponentSuffix, asyncReduce, conventionName, createLogger, createSuccessMessage, dynamicImport, fixCrossDirectoryImports, fixRegularSchemaImports, generateComponentDefinition, generateDependencyImports, generateParameterDefinition, generateSchemasDefinition, generateVerbsOptions, getFileInfo, getFullRoute, getMockFileExtensionByTypeName, getRoute, isBoolean, isFunction, isNullish, isObject, isReference, isString, isUrl, jsDoc, log, logError, logVerbose, pascal, removeFilesAndEmptyFolders, resolveInstalledVersions, resolveRef, splitSchemasByType, upath, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode } from "@orval/core";
|
|
3
3
|
import { bundle } from "@scalar/json-magic/bundle";
|
|
4
4
|
import { fetchUrls, parseJson, parseYaml, readFiles } from "@scalar/json-magic/bundle/plugins/node";
|
|
5
5
|
import { upgrade, validate } from "@scalar/openapi-parser";
|
|
@@ -18,17 +18,18 @@ import chalk from "chalk";
|
|
|
18
18
|
import { ExecaError, execa } from "execa";
|
|
19
19
|
import fs from "fs-extra";
|
|
20
20
|
import { unique } from "remeda";
|
|
21
|
+
import fs$1 from "node:fs/promises";
|
|
21
22
|
import { parseArgsStringToArgv } from "string-argv";
|
|
22
23
|
import { findUp, findUpMultiple } from "find-up";
|
|
23
24
|
import yaml from "js-yaml";
|
|
24
25
|
import { parse } from "tsconfck";
|
|
25
|
-
import fs$
|
|
26
|
+
import fs$2 from "node:fs";
|
|
26
27
|
import { createJiti } from "jiti";
|
|
27
28
|
|
|
28
29
|
//#region package.json
|
|
29
30
|
var name = "orval";
|
|
30
31
|
var description = "A swagger client generator for typescript";
|
|
31
|
-
var version = "8.
|
|
32
|
+
var version = "8.4.1";
|
|
32
33
|
|
|
33
34
|
//#endregion
|
|
34
35
|
//#region src/client.ts
|
|
@@ -155,7 +156,7 @@ const generateOperations = (outputClient = DEFAULT_CLIENT, verbsOptions, options
|
|
|
155
156
|
const client = await generatorClient(verbOption, options, outputClient, output);
|
|
156
157
|
if (!client.implementation) return acc;
|
|
157
158
|
const generatedMock = generateMock(verbOption, options);
|
|
158
|
-
acc[verbOption.
|
|
159
|
+
acc[verbOption.operationId] = {
|
|
159
160
|
implementation: verbOption.doc + client.implementation,
|
|
160
161
|
imports: client.imports,
|
|
161
162
|
implementationMock: generatedMock.implementation,
|
|
@@ -383,6 +384,69 @@ function dereferenceExternalRef(data) {
|
|
|
383
384
|
return result;
|
|
384
385
|
}
|
|
385
386
|
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/formatters/prettier.ts
|
|
389
|
+
/**
|
|
390
|
+
* Format files with prettier.
|
|
391
|
+
* Tries the programmatic API first (project dependency),
|
|
392
|
+
* then falls back to the globally installed CLI.
|
|
393
|
+
*/
|
|
394
|
+
async function formatWithPrettier(paths, projectTitle) {
|
|
395
|
+
const prettier = await tryImportPrettier();
|
|
396
|
+
if (prettier) {
|
|
397
|
+
const filePaths = await collectFilePaths(paths);
|
|
398
|
+
const config = await prettier.resolveConfig(filePaths[0]);
|
|
399
|
+
await Promise.all(filePaths.map(async (filePath) => {
|
|
400
|
+
const content = await fs$1.readFile(filePath, "utf8");
|
|
401
|
+
try {
|
|
402
|
+
const formatted = await prettier.format(content, {
|
|
403
|
+
...config,
|
|
404
|
+
filepath: filePath
|
|
405
|
+
});
|
|
406
|
+
await fs$1.writeFile(filePath, formatted);
|
|
407
|
+
} catch (error) {
|
|
408
|
+
if (error instanceof Error) if (error.name === "UndefinedParserError") {} else log(chalk.yellow(`⚠️ ${projectTitle ? `${projectTitle} - ` : ""}Failed to format file ${filePath}: ${error.toString()}`));
|
|
409
|
+
else log(chalk.yellow(`⚠️ ${projectTitle ? `${projectTitle} - ` : ""}Failed to format file ${filePath}: unknown error}`));
|
|
410
|
+
}
|
|
411
|
+
}));
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
try {
|
|
415
|
+
await execa("prettier", ["--write", ...paths]);
|
|
416
|
+
} catch {
|
|
417
|
+
log(chalk.yellow(`⚠️ ${projectTitle ? `${projectTitle} - ` : ""}prettier not found. Install it as a project dependency or globally.`));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Try to import prettier from the project's dependencies.
|
|
422
|
+
* Returns undefined if prettier is not installed.
|
|
423
|
+
*/
|
|
424
|
+
async function tryImportPrettier() {
|
|
425
|
+
try {
|
|
426
|
+
return await import("prettier");
|
|
427
|
+
} catch {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Recursively collect absolute file paths from a mix of files and directories.
|
|
433
|
+
*/
|
|
434
|
+
async function collectFilePaths(paths) {
|
|
435
|
+
const results = [];
|
|
436
|
+
for (const p of paths) {
|
|
437
|
+
const absolute = path.resolve(p);
|
|
438
|
+
try {
|
|
439
|
+
const stat = await fs$1.stat(absolute);
|
|
440
|
+
if (stat.isFile()) results.push(absolute);
|
|
441
|
+
else if (stat.isDirectory()) {
|
|
442
|
+
const subFiles = await collectFilePaths((await fs$1.readdir(absolute)).map((entry) => path.join(absolute, entry)));
|
|
443
|
+
results.push(...subFiles);
|
|
444
|
+
}
|
|
445
|
+
} catch {}
|
|
446
|
+
}
|
|
447
|
+
return results;
|
|
448
|
+
}
|
|
449
|
+
|
|
386
450
|
//#endregion
|
|
387
451
|
//#region src/utils/execute-hook.ts
|
|
388
452
|
const executeHook = async (name$1, commands = [], args = []) => {
|
|
@@ -412,7 +476,7 @@ const loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
|
412
476
|
const pkgPath = await findUp(["package.json"], { cwd: workspace });
|
|
413
477
|
if (pkgPath) {
|
|
414
478
|
const pkg = await dynamicImport(pkgPath, workspace);
|
|
415
|
-
if (isPackageJson(pkg)) return await maybeReplaceCatalog(pkg, workspace);
|
|
479
|
+
if (isPackageJson(pkg)) return resolveAndAttachVersions(await maybeReplaceCatalog(pkg, workspace), workspace, pkgPath);
|
|
416
480
|
else throw new Error("Invalid package.json file");
|
|
417
481
|
}
|
|
418
482
|
return;
|
|
@@ -420,11 +484,26 @@ const loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
|
420
484
|
const normalizedPath = normalizePath(packageJson, workspace);
|
|
421
485
|
if (fs.existsSync(normalizedPath)) {
|
|
422
486
|
const pkg = await dynamicImport(normalizedPath);
|
|
423
|
-
if (isPackageJson(pkg)) return await maybeReplaceCatalog(pkg, workspace);
|
|
487
|
+
if (isPackageJson(pkg)) return resolveAndAttachVersions(await maybeReplaceCatalog(pkg, workspace), workspace, normalizedPath);
|
|
424
488
|
else throw new Error(`Invalid package.json file: ${normalizedPath}`);
|
|
425
489
|
}
|
|
426
490
|
};
|
|
427
491
|
const isPackageJson = (obj) => isObject(obj);
|
|
492
|
+
const resolvedCache = /* @__PURE__ */ new Map();
|
|
493
|
+
const resolveAndAttachVersions = (pkg, workspace, cacheKey) => {
|
|
494
|
+
const cached = resolvedCache.get(cacheKey);
|
|
495
|
+
if (cached) {
|
|
496
|
+
pkg.resolvedVersions = cached;
|
|
497
|
+
return pkg;
|
|
498
|
+
}
|
|
499
|
+
const resolved = resolveInstalledVersions(pkg, workspace);
|
|
500
|
+
if (Object.keys(resolved).length > 0) {
|
|
501
|
+
pkg.resolvedVersions = resolved;
|
|
502
|
+
resolvedCache.set(cacheKey, resolved);
|
|
503
|
+
for (const [name$1, version$1] of Object.entries(resolved)) logVerbose(chalk.dim(`Detected ${chalk.white(name$1)} v${chalk.white(version$1)}`));
|
|
504
|
+
}
|
|
505
|
+
return pkg;
|
|
506
|
+
};
|
|
428
507
|
const hasCatalogReferences = (pkg) => {
|
|
429
508
|
return [
|
|
430
509
|
...Object.entries(pkg.dependencies ?? {}),
|
|
@@ -711,7 +790,10 @@ async function normalizeOptions(optionsExport, workspace = process.cwd(), global
|
|
|
711
790
|
generateErrorTypes: false,
|
|
712
791
|
...outputOptions.override?.swr
|
|
713
792
|
},
|
|
714
|
-
angular: {
|
|
793
|
+
angular: {
|
|
794
|
+
provideIn: outputOptions.override?.angular?.provideIn ?? "root",
|
|
795
|
+
runtimeValidation: outputOptions.override?.angular?.runtimeValidation ?? false
|
|
796
|
+
},
|
|
715
797
|
fetch: {
|
|
716
798
|
includeHttpResponseReturnType: outputOptions.override?.fetch?.includeHttpResponseReturnType ?? true,
|
|
717
799
|
forceSuccessResponse: outputOptions.override?.fetch?.forceSuccessResponse ?? false,
|
|
@@ -917,14 +999,40 @@ async function startWatcher(watchOptions, watchFn, defaultTarget = ".") {
|
|
|
917
999
|
|
|
918
1000
|
//#endregion
|
|
919
1001
|
//#region src/write-zod-specs.ts
|
|
920
|
-
function generateZodSchemaFileContent(header,
|
|
1002
|
+
function generateZodSchemaFileContent(header, schemas) {
|
|
921
1003
|
return `${header}import { z as zod } from 'zod';
|
|
922
1004
|
|
|
923
|
-
|
|
1005
|
+
${schemas.map(({ schemaName, consts, zodExpression }) => {
|
|
1006
|
+
return `${consts ? `${consts}\n` : ""}export const ${schemaName} = ${zodExpression}
|
|
924
1007
|
|
|
925
|
-
export type ${schemaName} = zod.
|
|
1008
|
+
export type ${schemaName} = zod.input<typeof ${schemaName}>;`;
|
|
1009
|
+
}).join("\n\n")}
|
|
926
1010
|
`;
|
|
927
1011
|
}
|
|
1012
|
+
const isValidSchemaIdentifier = (name$1) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(name$1);
|
|
1013
|
+
const isPrimitiveSchemaName = (name$1) => [
|
|
1014
|
+
"string",
|
|
1015
|
+
"number",
|
|
1016
|
+
"boolean",
|
|
1017
|
+
"void",
|
|
1018
|
+
"unknown",
|
|
1019
|
+
"Blob"
|
|
1020
|
+
].includes(name$1);
|
|
1021
|
+
const dedupeSchemasByName = (schemas) => {
|
|
1022
|
+
const uniqueSchemas = /* @__PURE__ */ new Map();
|
|
1023
|
+
for (const schema of schemas) if (!uniqueSchemas.has(schema.name)) uniqueSchemas.set(schema.name, schema);
|
|
1024
|
+
return [...uniqueSchemas.values()];
|
|
1025
|
+
};
|
|
1026
|
+
const groupSchemasByFilePath = (schemas) => {
|
|
1027
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
1028
|
+
for (const schema of schemas) {
|
|
1029
|
+
const key = schema.filePath.toLowerCase();
|
|
1030
|
+
const existingGroup = grouped.get(key);
|
|
1031
|
+
if (existingGroup) existingGroup.push(schema);
|
|
1032
|
+
else grouped.set(key, [schema]);
|
|
1033
|
+
}
|
|
1034
|
+
return [...grouped.values()].map((group) => [...group].toSorted((a, b) => a.filePath.localeCompare(b.filePath))).toSorted((a, b) => a[0].filePath.localeCompare(b[0].filePath));
|
|
1035
|
+
};
|
|
928
1036
|
async function writeZodSchemaIndex(schemasPath, fileExtension, header, schemaNames, namingConvention, shouldMergeExisting = false) {
|
|
929
1037
|
const importFileExtension = fileExtension.replace(/\.ts$/, "");
|
|
930
1038
|
const indexPath = upath.join(schemasPath, `index${fileExtension}`);
|
|
@@ -944,9 +1052,13 @@ async function writeZodSchemaIndex(schemasPath, fileExtension, header, schemaNam
|
|
|
944
1052
|
}
|
|
945
1053
|
async function writeZodSchemas(builder, schemasPath, fileExtension, header, output) {
|
|
946
1054
|
const schemasWithOpenApiDef = builder.schemas.filter((s) => s.schema);
|
|
947
|
-
|
|
1055
|
+
const schemasToWrite = [];
|
|
1056
|
+
const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);
|
|
1057
|
+
const strict = output.override.zod.strict.body;
|
|
1058
|
+
const coerce = output.override.zod.coerce.body;
|
|
1059
|
+
for (const generatorSchema of schemasWithOpenApiDef) {
|
|
948
1060
|
const { name: name$1, schema: schemaObject } = generatorSchema;
|
|
949
|
-
if (!schemaObject)
|
|
1061
|
+
if (!schemaObject) continue;
|
|
950
1062
|
const fileName = conventionName(name$1, output.namingConvention);
|
|
951
1063
|
const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);
|
|
952
1064
|
const context = {
|
|
@@ -955,28 +1067,35 @@ async function writeZodSchemas(builder, schemasPath, fileExtension, header, outp
|
|
|
955
1067
|
workspace: "",
|
|
956
1068
|
output
|
|
957
1069
|
};
|
|
958
|
-
const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);
|
|
959
|
-
const strict = output.override.zod.strict.body;
|
|
960
|
-
const coerce = output.override.zod.coerce.body;
|
|
961
1070
|
const parsedZodDefinition = parseZodValidationSchemaDefinition(generateZodValidationSchemaDefinition(dereference(schemaObject, context), context, name$1, strict, isZodV4, { required: true }), context, coerce, strict, isZodV4);
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1071
|
+
schemasToWrite.push({
|
|
1072
|
+
schemaName: name$1,
|
|
1073
|
+
filePath,
|
|
1074
|
+
consts: parsedZodDefinition.consts,
|
|
1075
|
+
zodExpression: parsedZodDefinition.zod
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
const groupedSchemasToWrite = groupSchemasByFilePath(schemasToWrite);
|
|
1079
|
+
for (const schemaGroup of groupedSchemasToWrite) {
|
|
1080
|
+
const fileContent = generateZodSchemaFileContent(header, schemaGroup);
|
|
1081
|
+
await fs.outputFile(schemaGroup[0].filePath, fileContent);
|
|
1082
|
+
}
|
|
1083
|
+
if (output.indexFiles) await writeZodSchemaIndex(schemasPath, fileExtension, header, groupedSchemasToWrite.map((schemaGroup) => schemaGroup[0].schemaName), output.namingConvention, false);
|
|
966
1084
|
}
|
|
967
1085
|
async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension, header, output, context) {
|
|
1086
|
+
const zodContext = context;
|
|
968
1087
|
const verbOptionsArray = Object.values(verbOptions);
|
|
969
1088
|
if (verbOptionsArray.length === 0) return;
|
|
970
1089
|
const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);
|
|
971
1090
|
const strict = output.override.zod.strict.body;
|
|
972
1091
|
const coerce = output.override.zod.coerce.body;
|
|
973
|
-
const
|
|
1092
|
+
const uniqueVerbsSchemas = dedupeSchemasByName(verbOptionsArray.flatMap((verbOption) => {
|
|
974
1093
|
const operation = verbOption.originalOperation;
|
|
975
1094
|
const requestBody = operation.requestBody;
|
|
976
1095
|
const bodySchema = (requestBody && "content" in requestBody ? requestBody.content : void 0)?.["application/json"]?.schema;
|
|
977
1096
|
const bodySchemas = bodySchema ? [{
|
|
978
1097
|
name: `${pascal(verbOption.operationName)}Body`,
|
|
979
|
-
schema: dereference(bodySchema,
|
|
1098
|
+
schema: dereference(bodySchema, zodContext)
|
|
980
1099
|
}] : [];
|
|
981
1100
|
const parameters = operation.parameters;
|
|
982
1101
|
const queryParams = parameters?.filter((p) => "in" in p && p.in === "query");
|
|
@@ -984,8 +1103,8 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
|
|
|
984
1103
|
name: `${pascal(verbOption.operationName)}Params`,
|
|
985
1104
|
schema: {
|
|
986
1105
|
type: "object",
|
|
987
|
-
properties: Object.fromEntries(queryParams.filter((p) => "schema" in p && p.schema).map((p) => [p.name, dereference(p.schema,
|
|
988
|
-
required: queryParams.filter((p) => p.required).map((p) => p.name)
|
|
1106
|
+
properties: Object.fromEntries(queryParams.filter((p) => "schema" in p && p.schema).map((p) => [p.name, dereference(p.schema, zodContext)])),
|
|
1107
|
+
required: queryParams.filter((p) => p.required).map((p) => p.name).filter((name$1) => name$1 !== void 0)
|
|
989
1108
|
}
|
|
990
1109
|
}] : [];
|
|
991
1110
|
const headerParams = parameters?.filter((p) => "in" in p && p.in === "header");
|
|
@@ -993,24 +1112,39 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
|
|
|
993
1112
|
name: `${pascal(verbOption.operationName)}Headers`,
|
|
994
1113
|
schema: {
|
|
995
1114
|
type: "object",
|
|
996
|
-
properties: Object.fromEntries(headerParams.filter((p) => "schema" in p && p.schema).map((p) => [p.name, dereference(p.schema,
|
|
997
|
-
required: headerParams.filter((p) => p.required).map((p) => p.name)
|
|
1115
|
+
properties: Object.fromEntries(headerParams.filter((p) => "schema" in p && p.schema).map((p) => [p.name, dereference(p.schema, zodContext)])),
|
|
1116
|
+
required: headerParams.filter((p) => p.required).map((p) => p.name).filter((name$1) => name$1 !== void 0)
|
|
998
1117
|
}
|
|
999
1118
|
}] : [];
|
|
1000
|
-
|
|
1119
|
+
const responseSchemas = [...verbOption.response.types.success, ...verbOption.response.types.errors].filter((responseType) => !!responseType.originalSchema && !responseType.isRef && isValidSchemaIdentifier(responseType.value) && !isPrimitiveSchemaName(responseType.value)).map((responseType) => ({
|
|
1120
|
+
name: responseType.value,
|
|
1121
|
+
schema: dereference(responseType.originalSchema, zodContext)
|
|
1122
|
+
}));
|
|
1123
|
+
return dedupeSchemasByName([
|
|
1001
1124
|
...bodySchemas,
|
|
1002
1125
|
...queryParamsSchemas,
|
|
1003
|
-
...headerParamsSchemas
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1126
|
+
...headerParamsSchemas,
|
|
1127
|
+
...responseSchemas
|
|
1128
|
+
]);
|
|
1129
|
+
}));
|
|
1130
|
+
const schemasToWrite = [];
|
|
1131
|
+
for (const { name: name$1, schema } of uniqueVerbsSchemas) {
|
|
1007
1132
|
const fileName = conventionName(name$1, output.namingConvention);
|
|
1008
1133
|
const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);
|
|
1009
|
-
const parsedZodDefinition = parseZodValidationSchemaDefinition(generateZodValidationSchemaDefinition(schema,
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1134
|
+
const parsedZodDefinition = parseZodValidationSchemaDefinition(generateZodValidationSchemaDefinition(schema, zodContext, name$1, strict, isZodV4, { required: true }), zodContext, coerce, strict, isZodV4);
|
|
1135
|
+
schemasToWrite.push({
|
|
1136
|
+
schemaName: name$1,
|
|
1137
|
+
filePath,
|
|
1138
|
+
consts: parsedZodDefinition.consts,
|
|
1139
|
+
zodExpression: parsedZodDefinition.zod
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
const groupedSchemasToWrite = groupSchemasByFilePath(schemasToWrite);
|
|
1143
|
+
for (const schemaGroup of groupedSchemasToWrite) {
|
|
1144
|
+
const fileContent = generateZodSchemaFileContent(header, schemaGroup);
|
|
1145
|
+
await fs.outputFile(schemaGroup[0].filePath, fileContent);
|
|
1146
|
+
}
|
|
1147
|
+
if (output.indexFiles && uniqueVerbsSchemas.length > 0) await writeZodSchemaIndex(schemasPath, fileExtension, header, groupedSchemasToWrite.map((schemaGroup) => schemaGroup[0].schemaName), output.namingConvention, true);
|
|
1014
1148
|
}
|
|
1015
1149
|
|
|
1016
1150
|
//#endregion
|
|
@@ -1165,11 +1299,7 @@ async function writeSpecs(builder, workspace, options, projectName) {
|
|
|
1165
1299
|
...implementationPaths
|
|
1166
1300
|
];
|
|
1167
1301
|
if (options.hooks.afterAllFilesWrite) await executeHook("afterAllFilesWrite", options.hooks.afterAllFilesWrite, paths);
|
|
1168
|
-
if (output.prettier)
|
|
1169
|
-
await execa("prettier", ["--write", ...paths]);
|
|
1170
|
-
} catch {
|
|
1171
|
-
log(chalk.yellow(`⚠️ ${projectTitle ? `${projectTitle} - ` : ""}Globally installed prettier not found`));
|
|
1172
|
-
}
|
|
1302
|
+
if (output.prettier) await formatWithPrettier(paths, projectTitle);
|
|
1173
1303
|
if (output.biome) try {
|
|
1174
1304
|
await execa("biome", [
|
|
1175
1305
|
"check",
|
|
@@ -1201,8 +1331,11 @@ async function writeSpecs(builder, workspace, options, projectName) {
|
|
|
1201
1331
|
if (!app.options.isSet("readme")) app.options.setValue("readme", "none");
|
|
1202
1332
|
if (!app.options.isSet("logLevel")) app.options.setValue("logLevel", "None");
|
|
1203
1333
|
const project = await app.convert();
|
|
1204
|
-
if (project)
|
|
1205
|
-
|
|
1334
|
+
if (project) {
|
|
1335
|
+
const outputPath = app.options.getValue("out");
|
|
1336
|
+
await app.generateDocs(project, outputPath);
|
|
1337
|
+
if (output.prettier) await formatWithPrettier([outputPath], projectTitle);
|
|
1338
|
+
} else throw new Error("TypeDoc not initialized");
|
|
1206
1339
|
} catch (error) {
|
|
1207
1340
|
const message = error instanceof Error ? error.message : `⚠️ ${projectTitle ? `${projectTitle} - ` : ""}Unable to generate docs`;
|
|
1208
1341
|
log(chalk.yellow(message));
|
|
@@ -1272,7 +1405,7 @@ async function generateSpec(workspace, options, projectName) {
|
|
|
1272
1405
|
function findConfigFile(configFilePath) {
|
|
1273
1406
|
if (configFilePath) {
|
|
1274
1407
|
const absolutePath = path.isAbsolute(configFilePath) ? configFilePath : path.resolve(process.cwd(), configFilePath);
|
|
1275
|
-
if (!fs$
|
|
1408
|
+
if (!fs$2.existsSync(absolutePath)) throw new Error(`Config file ${configFilePath} does not exist`);
|
|
1276
1409
|
return absolutePath;
|
|
1277
1410
|
}
|
|
1278
1411
|
const root = process.cwd();
|
|
@@ -1283,7 +1416,7 @@ function findConfigFile(configFilePath) {
|
|
|
1283
1416
|
".mts"
|
|
1284
1417
|
]) {
|
|
1285
1418
|
const fullPath = path.resolve(root, `orval.config${ext}`);
|
|
1286
|
-
if (fs$
|
|
1419
|
+
if (fs$2.existsSync(fullPath)) return fullPath;
|
|
1287
1420
|
}
|
|
1288
1421
|
throw new Error(`No config file found in ${root}`);
|
|
1289
1422
|
}
|
|
@@ -1305,4 +1438,4 @@ async function loadConfigFile(configFilePath) {
|
|
|
1305
1438
|
|
|
1306
1439
|
//#endregion
|
|
1307
1440
|
export { defineConfig as a, name as c, startWatcher as i, version as l, loadConfigFile as n, normalizeOptions as o, generateSpec as r, description as s, findConfigFile as t };
|
|
1308
|
-
//# sourceMappingURL=config-
|
|
1441
|
+
//# sourceMappingURL=config-glSQmAy7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-glSQmAy7.mjs","names":["GENERATOR_CLIENT: GeneratorClients","generateClientImports: GeneratorClientImports","generateClientHeader: GeneratorClientHeader","generateClientFooter: GeneratorClientFooter","implementation: string","generateClientTitle: GeneratorClientTitle","generateExtraFiles","schemas: GeneratorSchema[]","context: ContextSpec","validateSpec","out: Record<string, unknown>","refObj: unknown","result: Record<string, unknown>","result","fs","results: string[]","name","name","version","mock: GlobalMockOptions | ClientMockBuilder | undefined","globalQueryOptions: NormalizedQueryOptions","normalizedOptions: NormalizedOptions","path","query","zod","result: NormalizedHookOptions","hono","pkg.name","pkg.version","description","version","name","schemasToWrite: ZodSchemaFileToWrite[]","context: ContextSpec","implementationPaths: string[]","path","config: Partial<TypeDocOptions>","configPath: string | undefined","fs"],"sources":["../package.json","../src/client.ts","../src/api.ts","../src/import-open-api.ts","../src/import-specs.ts","../src/formatters/prettier.ts","../src/utils/execute-hook.ts","../src/utils/package-json.ts","../src/utils/tsconfig.ts","../src/utils/options.ts","../src/utils/watcher.ts","../src/write-zod-specs.ts","../src/write-specs.ts","../src/generate-spec.ts","../src/utils/config.ts"],"sourcesContent":["","import angular from '@orval/angular';\nimport axios from '@orval/axios';\nimport {\n asyncReduce,\n type ClientFileBuilder,\n type ClientMockBuilder,\n type ClientMockGeneratorBuilder,\n type ContextSpec,\n generateDependencyImports,\n type GeneratorClientFooter,\n type GeneratorClientHeader,\n type GeneratorClientImports,\n type GeneratorClients,\n type GeneratorClientTitle,\n type GeneratorOperations,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GeneratorVerbsOptions,\n isFunction,\n type NormalizedOutputOptions,\n OutputClient,\n type OutputClientFunc,\n pascal,\n} from '@orval/core';\nimport fetchClient from '@orval/fetch';\nimport hono from '@orval/hono';\nimport mcp from '@orval/mcp';\nimport * as mock from '@orval/mock';\nimport query from '@orval/query';\nimport solidStart from '@orval/solid-start';\nimport swr from '@orval/swr';\nimport zod from '@orval/zod';\n\nconst DEFAULT_CLIENT = OutputClient.AXIOS;\n\nconst getGeneratorClient = (\n outputClient: OutputClient | OutputClientFunc,\n output: NormalizedOutputOptions,\n) => {\n const GENERATOR_CLIENT: GeneratorClients = {\n axios: axios({ type: 'axios' })(),\n 'axios-functions': axios({ type: 'axios-functions' })(),\n angular: angular()(),\n 'angular-query': query({ output, type: 'angular-query' })(),\n 'react-query': query({ output, type: 'react-query' })(),\n 'solid-start': solidStart()(),\n 'solid-query': query({ output, type: 'solid-query' })(),\n 'svelte-query': query({ output, type: 'svelte-query' })(),\n 'vue-query': query({ output, type: 'vue-query' })(),\n swr: swr()(),\n zod: zod()(),\n hono: hono()(),\n fetch: fetchClient()(),\n mcp: mcp()(),\n };\n\n const generator = isFunction(outputClient)\n ? outputClient(GENERATOR_CLIENT)\n : GENERATOR_CLIENT[outputClient];\n\n return generator;\n};\n\nexport const generateClientImports: GeneratorClientImports = ({\n client,\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator,\n hasTagsMutator,\n hasParamsSerializerOptions,\n packageJson,\n output,\n}) => {\n const { dependencies } = getGeneratorClient(client, output);\n return generateDependencyImports(\n implementation,\n dependencies\n ? [\n ...dependencies(\n hasGlobalMutator,\n hasParamsSerializerOptions,\n packageJson,\n output.httpClient,\n hasTagsMutator,\n output.override,\n ),\n ...imports,\n ]\n : imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nexport const generateClientHeader: GeneratorClientHeader = ({\n outputClient = DEFAULT_CLIENT,\n isRequestOptions,\n isGlobalMutator,\n isMutator,\n provideIn,\n hasAwaitedType,\n titles,\n output,\n verbOptions,\n tag,\n clientImplementation,\n}) => {\n const { header } = getGeneratorClient(outputClient, output);\n return {\n implementation: header\n ? header({\n title: titles.implementation,\n isRequestOptions,\n isGlobalMutator,\n isMutator,\n provideIn,\n hasAwaitedType,\n output,\n verbOptions,\n tag,\n clientImplementation,\n })\n : '',\n implementationMock: `export const ${titles.implementationMock} = () => [\\n`,\n };\n};\n\nexport const generateClientFooter: GeneratorClientFooter = ({\n outputClient,\n operationNames,\n hasMutator,\n hasAwaitedType,\n titles,\n output,\n}) => {\n const { footer } = getGeneratorClient(outputClient, output);\n\n if (!footer) {\n return {\n implementation: '',\n implementationMock: `\\n]\\n`,\n };\n }\n\n let implementation: string;\n try {\n if (isFunction(outputClient)) {\n implementation = (footer as (operationNames: string[]) => string)(\n operationNames,\n );\n // being here means that the previous call worked\n console.warn(\n '[WARN] Passing an array of strings for operations names to the footer function is deprecated and will be removed in a future major release. Please pass them in an object instead: { operationNames: string[] }.',\n );\n } else {\n implementation = footer({\n operationNames,\n title: titles.implementation,\n hasMutator,\n hasAwaitedType,\n });\n }\n } catch {\n implementation = footer({\n operationNames,\n title: titles.implementation,\n hasMutator,\n hasAwaitedType,\n });\n }\n\n return {\n implementation,\n implementationMock: `]\\n`,\n };\n};\n\nexport const generateClientTitle: GeneratorClientTitle = ({\n outputClient = DEFAULT_CLIENT,\n title,\n customTitleFunc,\n output,\n}) => {\n const { title: generatorTitle } = getGeneratorClient(outputClient, output);\n\n if (!generatorTitle) {\n return {\n implementation: '',\n implementationMock: `get${pascal(title)}Mock`,\n };\n }\n\n if (customTitleFunc) {\n const customTitle = customTitleFunc(title);\n return {\n implementation: generatorTitle(customTitle),\n implementationMock: `get${pascal(customTitle)}Mock`,\n };\n }\n return {\n implementation: generatorTitle(title),\n implementationMock: `get${pascal(title)}Mock`,\n };\n};\n\nconst generateMock = (\n verbOption: GeneratorVerbOptions,\n options: GeneratorOptions,\n): ClientMockGeneratorBuilder => {\n if (!options.mock) {\n return {\n implementation: {\n function: '',\n handler: '',\n handlerName: '',\n },\n imports: [],\n };\n }\n\n if (isFunction(options.mock)) {\n return options.mock(verbOption, options);\n }\n\n return mock.generateMock(\n verbOption,\n options as typeof options & {\n mock: Exclude<(typeof options)['mock'], ClientMockBuilder | undefined>;\n },\n );\n};\n\nexport const generateOperations = (\n outputClient: OutputClient | OutputClientFunc = DEFAULT_CLIENT,\n verbsOptions: GeneratorVerbsOptions,\n options: GeneratorOptions,\n output: NormalizedOutputOptions,\n): Promise<GeneratorOperations> => {\n return asyncReduce(\n verbsOptions,\n async (acc, verbOption) => {\n const { client: generatorClient } = getGeneratorClient(\n outputClient,\n output,\n );\n const client = await generatorClient(\n verbOption,\n options,\n outputClient,\n output,\n );\n\n if (!client.implementation) {\n return acc;\n }\n\n const generatedMock = generateMock(verbOption, options);\n\n acc[verbOption.operationId] = {\n implementation: verbOption.doc + client.implementation,\n imports: client.imports,\n implementationMock: generatedMock.implementation,\n importsMock: generatedMock.imports,\n tags: verbOption.tags,\n mutator: verbOption.mutator,\n clientMutators: client.mutators,\n formData: verbOption.formData,\n formUrlEncoded: verbOption.formUrlEncoded,\n paramsSerializer: verbOption.paramsSerializer,\n operationName: verbOption.operationName,\n fetchReviver: verbOption.fetchReviver,\n };\n\n return acc;\n },\n {} as GeneratorOperations,\n );\n};\n\nexport const generateExtraFiles = (\n outputClient: OutputClient | OutputClientFunc = DEFAULT_CLIENT,\n verbsOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n): Promise<ClientFileBuilder[]> => {\n const { extraFiles: generateExtraFiles } = getGeneratorClient(\n outputClient,\n output,\n );\n\n if (!generateExtraFiles) {\n return Promise.resolve([]);\n }\n\n return generateExtraFiles(verbsOptions, output, context);\n};\n","import {\n asyncReduce,\n type ContextSpec,\n generateVerbsOptions,\n type GeneratorApiBuilder,\n type GeneratorApiOperations,\n type GeneratorSchema,\n getFullRoute,\n getRoute,\n GetterPropType,\n isReference,\n type NormalizedInputOptions,\n type NormalizedOutputOptions,\n type OpenApiPathItemObject,\n resolveRef,\n} from '@orval/core';\nimport { generateMockImports } from '@orval/mock';\n\nimport {\n generateClientFooter,\n generateClientHeader,\n generateClientImports,\n generateClientTitle,\n generateExtraFiles,\n generateOperations,\n} from './client';\n\nexport async function getApiBuilder({\n input,\n output,\n context,\n}: {\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n context: ContextSpec;\n}): Promise<GeneratorApiBuilder> {\n const api = await asyncReduce(\n Object.entries(context.spec.paths ?? {}),\n async (acc, [pathRoute, verbs]) => {\n const route = getRoute(pathRoute);\n\n let resolvedVerbs = verbs;\n\n if (isReference(verbs)) {\n const { schema } = resolveRef<OpenApiPathItemObject>(verbs, context);\n\n resolvedVerbs = schema;\n }\n\n let verbsOptions = await generateVerbsOptions({\n verbs: resolvedVerbs,\n input,\n output,\n route,\n pathRoute,\n context,\n });\n\n // GitHub #564 check if we want to exclude deprecated operations\n if (output.override.useDeprecatedOperations === false) {\n verbsOptions = verbsOptions.filter((verb) => {\n return !verb.deprecated;\n });\n }\n\n const schemas: GeneratorSchema[] = [];\n for (const {\n queryParams,\n headers,\n body,\n response,\n props,\n } of verbsOptions) {\n schemas.push(\n ...props.flatMap((param) =>\n param.type === GetterPropType.NAMED_PATH_PARAMS ? param.schema : [],\n ),\n );\n if (queryParams) {\n schemas.push(queryParams.schema, ...queryParams.deps);\n }\n if (headers) {\n schemas.push(headers.schema, ...headers.deps);\n }\n\n schemas.push(...body.schemas, ...response.schemas);\n }\n\n const fullRoute = getFullRoute(\n route,\n verbs.servers ?? context.spec.servers,\n output.baseUrl,\n );\n if (!output.target) {\n throw new Error('Output does not have a target');\n }\n const pathOperations = await generateOperations(\n output.client,\n verbsOptions,\n {\n route: fullRoute,\n pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n },\n output,\n );\n\n for (const verbOption of verbsOptions) {\n acc.verbOptions[verbOption.operationId] = verbOption;\n }\n acc.schemas.push(...schemas);\n acc.operations = { ...acc.operations, ...pathOperations };\n\n return acc;\n },\n {\n operations: {},\n verbOptions: {},\n schemas: [],\n } as GeneratorApiOperations,\n );\n\n const extraFiles = await generateExtraFiles(\n output.client,\n api.verbOptions,\n output,\n context,\n );\n\n return {\n operations: api.operations,\n schemas: api.schemas,\n verbOptions: api.verbOptions,\n title: generateClientTitle,\n header: generateClientHeader,\n footer: generateClientFooter,\n imports: generateClientImports,\n importsMock: generateMockImports,\n extraFiles,\n };\n}\n","import {\n type ContextSpec,\n dynamicImport,\n generateComponentDefinition,\n generateParameterDefinition,\n generateSchemasDefinition,\n type ImportOpenApi,\n type InputOptions,\n type NormalizedOutputOptions,\n type OpenApiComponentsObject,\n type OpenApiDocument,\n type OverrideInput,\n type WriteSpecBuilder,\n} from '@orval/core';\nimport { validate } from '@scalar/openapi-parser';\n\nimport { getApiBuilder } from './api';\n\nexport async function importOpenApi({\n spec,\n input,\n output,\n target,\n workspace,\n projectName,\n}: ImportOpenApi): Promise<WriteSpecBuilder> {\n const transformedOpenApi = await applyTransformer(\n spec,\n input.override.transformer,\n workspace,\n );\n\n const schemas = getApiSchemas({\n input,\n output,\n target,\n workspace,\n spec: transformedOpenApi,\n });\n\n const api = await getApiBuilder({\n input,\n output,\n context: {\n projectName,\n target,\n workspace,\n spec: transformedOpenApi,\n output,\n } satisfies ContextSpec,\n });\n\n return {\n ...api,\n schemas: [...schemas, ...api.schemas],\n target,\n // a valid spec will have info\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n info: transformedOpenApi.info!,\n spec: transformedOpenApi,\n };\n}\n\nasync function applyTransformer(\n openApi: OpenApiDocument,\n transformer: OverrideInput['transformer'],\n workspace: string,\n): Promise<OpenApiDocument> {\n const transformerFn = transformer\n ? await dynamicImport(transformer, workspace)\n : undefined;\n\n if (!transformerFn) {\n return openApi;\n }\n\n const transformedOpenApi = transformerFn(openApi);\n\n const { valid, errors } = await validate(transformedOpenApi);\n if (!valid) {\n throw new Error(`Validation failed`, { cause: errors });\n }\n\n return transformedOpenApi;\n}\n\ninterface GetApiSchemasOptions {\n input: InputOptions;\n output: NormalizedOutputOptions;\n workspace: string;\n target: string;\n spec: OpenApiDocument;\n}\n\nfunction getApiSchemas({\n input,\n output,\n target,\n workspace,\n spec,\n}: GetApiSchemasOptions) {\n const context: ContextSpec = {\n target,\n workspace,\n spec,\n output,\n };\n\n const schemaDefinition = generateSchemasDefinition(\n spec.components?.schemas,\n context,\n output.override.components.schemas.suffix,\n input.filters,\n );\n\n const responseDefinition = generateComponentDefinition(\n spec.components?.responses,\n context,\n output.override.components.responses.suffix,\n );\n\n const swaggerResponseDefinition = generateComponentDefinition(\n 'responses' in spec\n ? (spec as { responses?: OpenApiComponentsObject['responses'] }).responses\n : undefined,\n context,\n '',\n );\n\n const bodyDefinition = generateComponentDefinition(\n spec.components?.requestBodies,\n context,\n output.override.components.requestBodies.suffix,\n );\n\n const parameters = generateParameterDefinition(\n spec.components?.parameters,\n context,\n output.override.components.parameters.suffix,\n );\n\n const schemas = [\n ...schemaDefinition,\n ...responseDefinition,\n ...swaggerResponseDefinition,\n ...bodyDefinition,\n ...parameters,\n ];\n\n return schemas;\n}\n","import {\n isObject,\n isString,\n type NormalizedOptions,\n type OpenApiDocument,\n type WriteSpecBuilder,\n} from '@orval/core';\nimport { bundle } from '@scalar/json-magic/bundle';\nimport {\n fetchUrls,\n parseJson,\n parseYaml,\n readFiles,\n} from '@scalar/json-magic/bundle/plugins/node';\nimport { upgrade, validate as validateSpec } from '@scalar/openapi-parser';\n\nimport { importOpenApi } from './import-open-api';\n\nasync function resolveSpec(\n input: string | Record<string, unknown>,\n parserOptions?: {\n headers?: {\n domains: string[];\n headers: Record<string, string>;\n }[];\n },\n): Promise<OpenApiDocument> {\n const data = await bundle(input, {\n plugins: [\n readFiles(),\n fetchUrls({\n headers: parserOptions?.headers,\n }),\n parseJson(),\n parseYaml(),\n ],\n treeShake: true,\n });\n const dereferencedData = dereferenceExternalRef(data);\n const { valid, errors } = await validateSpec(dereferencedData);\n if (!valid) {\n throw new Error('Validation failed', { cause: errors });\n }\n\n const { specification } = upgrade(dereferencedData);\n\n return specification;\n}\n\nexport async function importSpecs(\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n): Promise<WriteSpecBuilder> {\n const { input, output } = options;\n\n const spec = await resolveSpec(input.target, input.parserOptions);\n\n return importOpenApi({\n spec,\n input,\n output,\n target: input.target,\n workspace,\n projectName,\n });\n}\n\n/**\n * The plugins from `@scalar/json-magic` does not dereference $ref.\n * Instead it fetches them and puts them under x-ext, and changes the $ref to point to #x-ext/<name>.\n * This function dereferences those x-ext $ref's.\n */\nexport function dereferenceExternalRef(\n data: Record<string, unknown>,\n): Record<string, unknown> {\n const extensions = (data['x-ext'] ?? {}) as Record<string, unknown>;\n\n const UNWANTED_KEYS = new Set(['$schema', '$id']);\n\n function scrub(obj: unknown): unknown {\n if (obj === null || obj === undefined) return obj;\n if (Array.isArray(obj)) return obj.map((x) => scrub(x));\n if (isObject(obj)) {\n const rec = obj as Record<string, unknown>;\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(rec)) {\n if (UNWANTED_KEYS.has(k)) continue;\n out[k] = scrub(v);\n }\n return out;\n }\n return obj;\n }\n\n function replaceRefs(obj: unknown): unknown {\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((element) => replaceRefs(element));\n }\n\n if (isObject(obj)) {\n const record = obj as Record<string, unknown>;\n\n // Check if this object is a $ref to x-ext\n if ('$ref' in record && isString(record.$ref)) {\n const refValue = record.$ref;\n if (refValue.startsWith('#/x-ext/')) {\n const pathStr = refValue.replace('#/x-ext/', '');\n const parts = pathStr.split('/');\n const extKey = parts.shift();\n if (extKey) {\n let refObj: unknown = extensions[extKey];\n // Traverse remaining path parts inside the extension object\n for (const p of parts) {\n if (\n refObj &&\n (isObject(refObj) || Array.isArray(refObj)) &&\n p in (refObj as Record<string, unknown>)\n ) {\n refObj = (refObj as Record<string, unknown>)[p];\n } else {\n refObj = undefined;\n break;\n }\n }\n\n if (refObj) {\n // Scrub unwanted keys from the extension before inlining\n const cleaned = scrub(refObj);\n // Replace the $ref with the dereferenced (and scrubbed) object\n return replaceRefs(cleaned);\n }\n }\n }\n }\n\n // Recursively process all properties\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(record)) {\n result[key] = replaceRefs(value);\n }\n return result;\n }\n\n return obj;\n }\n\n // Create a new object with dereferenced properties (excluding x-ext)\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n if (key !== 'x-ext') {\n result[key] = replaceRefs(value);\n }\n }\n\n return result;\n}\n","import fs from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { log } from '@orval/core';\nimport chalk from 'chalk';\nimport { execa } from 'execa';\n\n/**\n * Format files with prettier.\n * Tries the programmatic API first (project dependency),\n * then falls back to the globally installed CLI.\n */\nexport async function formatWithPrettier(\n paths: string[],\n projectTitle?: string,\n): Promise<void> {\n const prettier = await tryImportPrettier();\n\n if (prettier) {\n const filePaths = await collectFilePaths(paths);\n const config = await prettier.resolveConfig(filePaths[0]);\n await Promise.all(\n filePaths.map(async (filePath) => {\n const content = await fs.readFile(filePath, 'utf8');\n try {\n const formatted = await prettier.format(content, {\n ...config,\n // options.filepath can be specified for Prettier to infer the parser from the file extension\n filepath: filePath,\n });\n await fs.writeFile(filePath, formatted);\n } catch (error) {\n if (error instanceof Error) {\n // prettier currently doesn't export UndefinedParserError, so having to do it the crude way\n if (error.name === 'UndefinedParserError') {\n // skip files with unsupported parsers\n // https://prettier.io/docs/options#parser\n } else {\n log(\n chalk.yellow(\n `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}Failed to format file ${filePath}: ${error.toString()}`,\n ),\n );\n }\n } else {\n log(\n chalk.yellow(\n `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}Failed to format file ${filePath}: unknown error}`,\n ),\n );\n }\n }\n }),\n );\n\n return;\n }\n\n // fallback to globally installed prettier\n try {\n await execa('prettier', ['--write', ...paths]);\n } catch {\n log(\n chalk.yellow(\n `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}prettier not found. Install it as a project dependency or globally.`,\n ),\n );\n }\n}\n\n/**\n * Try to import prettier from the project's dependencies.\n * Returns undefined if prettier is not installed.\n */\nasync function tryImportPrettier() {\n try {\n return await import('prettier');\n } catch {\n return;\n }\n}\n\n/**\n * Recursively collect absolute file paths from a mix of files and directories.\n */\nasync function collectFilePaths(paths: string[]): Promise<string[]> {\n const results: string[] = [];\n\n for (const p of paths) {\n const absolute = path.resolve(p);\n try {\n const stat = await fs.stat(absolute);\n if (stat.isFile()) {\n results.push(absolute);\n } else if (stat.isDirectory()) {\n const entries = await fs.readdir(absolute);\n const subPaths = entries.map((entry) => path.join(absolute, entry));\n const subFiles = await collectFilePaths(subPaths);\n results.push(...subFiles);\n }\n } catch {\n // Skip paths that don't exist or can't be accessed\n }\n }\n\n return results;\n}\n","import {\n type Hook,\n type HookOption,\n isFunction,\n isObject,\n isString,\n log,\n logError,\n type NormalizedHookCommand,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { execa } from 'execa';\nimport { parseArgsStringToArgv } from 'string-argv';\n\nexport const executeHook = async (\n name: Hook,\n commands: NormalizedHookCommand = [],\n args: string[] = [],\n) => {\n log(chalk.white(`Running ${name} hook...`));\n\n for (const command of commands) {\n try {\n if (isString(command)) {\n await executeCommand(command, args);\n } else if (isFunction(command)) {\n await command(args);\n } else if (isObject(command)) {\n await executeObjectCommand(command as HookOption, args);\n }\n } catch (error) {\n logError(error, `Failed to run ${name} hook`);\n }\n }\n};\n\nasync function executeCommand(command: string, args: string[]) {\n const [cmd, ..._args] = [...parseArgsStringToArgv(command), ...args];\n\n await execa(cmd, _args);\n}\n\nasync function executeObjectCommand(command: HookOption, args: string[]) {\n if (command.injectGeneratedDirsAndFiles === false) {\n args = [];\n }\n\n if (isString(command.command)) {\n await executeCommand(command.command, args);\n } else if (isFunction(command.command)) {\n await command.command();\n }\n}\n","import {\n dynamicImport,\n isObject,\n isString,\n log,\n logVerbose,\n type PackageJson,\n resolveInstalledVersions,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { findUp, findUpMultiple } from 'find-up';\nimport fs from 'fs-extra';\nimport yaml from 'js-yaml';\n\nimport { normalizePath } from './options';\n\ntype CatalogData = Pick<PackageJson, 'catalog' | 'catalogs'>;\n\nexport const loadPackageJson = async (\n packageJson?: string,\n workspace = process.cwd(),\n): Promise<PackageJson | undefined> => {\n if (!packageJson) {\n const pkgPath = await findUp(['package.json'], { cwd: workspace });\n if (pkgPath) {\n const pkg = await dynamicImport<unknown>(pkgPath, workspace);\n\n if (isPackageJson(pkg)) {\n return resolveAndAttachVersions(\n await maybeReplaceCatalog(pkg, workspace),\n workspace,\n pkgPath,\n );\n } else {\n throw new Error('Invalid package.json file');\n }\n }\n return;\n }\n\n const normalizedPath = normalizePath(packageJson, workspace);\n if (fs.existsSync(normalizedPath)) {\n const pkg = await dynamicImport<unknown>(normalizedPath);\n\n if (isPackageJson(pkg)) {\n return resolveAndAttachVersions(\n await maybeReplaceCatalog(pkg, workspace),\n workspace,\n normalizedPath,\n );\n } else {\n throw new Error(`Invalid package.json file: ${normalizedPath}`);\n }\n }\n return;\n};\n\nconst isPackageJson = (obj: unknown): obj is PackageJson => isObject(obj);\n\nconst resolvedCache = new Map<string, Record<string, string>>();\n\n/** @internal visible for testing */\nexport const _resetResolvedCache = () => {\n resolvedCache.clear();\n};\n\nconst resolveAndAttachVersions = (\n pkg: PackageJson,\n workspace: string,\n cacheKey: string,\n): PackageJson => {\n const cached = resolvedCache.get(cacheKey);\n if (cached) {\n pkg.resolvedVersions = cached;\n return pkg;\n }\n\n const resolved = resolveInstalledVersions(pkg, workspace);\n if (Object.keys(resolved).length > 0) {\n pkg.resolvedVersions = resolved;\n resolvedCache.set(cacheKey, resolved);\n for (const [name, version] of Object.entries(resolved)) {\n logVerbose(\n chalk.dim(`Detected ${chalk.white(name)} v${chalk.white(version)}`),\n );\n }\n }\n return pkg;\n};\n\nconst hasCatalogReferences = (pkg: PackageJson): boolean => {\n return [\n ...Object.entries(pkg.dependencies ?? {}),\n ...Object.entries(pkg.devDependencies ?? {}),\n ...Object.entries(pkg.peerDependencies ?? {}),\n ].some(([, value]) => isString(value) && value.startsWith('catalog:'));\n};\n\nconst loadPnpmWorkspaceCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePath = await findUp('pnpm-workspace.yaml', { cwd: workspace });\n if (!filePath) return undefined;\n try {\n const file = await fs.readFile(filePath, 'utf8');\n const data = yaml.load(file) as Record<string, unknown> | undefined;\n if (!data?.catalog && !data?.catalogs) return undefined;\n return {\n catalog: data.catalog as CatalogData['catalog'],\n catalogs: data.catalogs as CatalogData['catalogs'],\n };\n } catch {\n return undefined;\n }\n};\n\nconst loadPackageJsonCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePaths = await findUpMultiple('package.json', { cwd: workspace });\n\n for (const filePath of filePaths) {\n try {\n const pkg = (await fs.readJson(filePath)) as Record<string, unknown>;\n if (pkg.catalog || pkg.catalogs) {\n return {\n catalog: pkg.catalog as CatalogData['catalog'],\n catalogs: pkg.catalogs as CatalogData['catalogs'],\n };\n }\n } catch {\n // Continue to next file\n }\n }\n return undefined;\n};\n\nconst loadYarnrcCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePath = await findUp('.yarnrc.yml', { cwd: workspace });\n if (!filePath) return undefined;\n try {\n const file = await fs.readFile(filePath, 'utf8');\n const data = yaml.load(file) as Record<string, unknown> | undefined;\n if (!data?.catalog && !data?.catalogs) return undefined;\n return {\n catalog: data.catalog as CatalogData['catalog'],\n catalogs: data.catalogs as CatalogData['catalogs'],\n };\n } catch {\n return undefined;\n }\n};\n\nconst maybeReplaceCatalog = async (\n pkg: PackageJson,\n workspace: string,\n): Promise<PackageJson> => {\n if (!hasCatalogReferences(pkg)) {\n return pkg;\n }\n\n const catalogData =\n (await loadPnpmWorkspaceCatalog(workspace)) ??\n (await loadPackageJsonCatalog(workspace)) ??\n (await loadYarnrcCatalog(workspace));\n\n if (!catalogData) {\n log(\n `⚠️ ${chalk.yellow('package.json contains catalog: references, but no catalog source was found (checked: pnpm-workspace.yaml, package.json, .yarnrc.yml).')}`,\n );\n return pkg;\n }\n\n performSubstitution(pkg.dependencies, catalogData);\n performSubstitution(pkg.devDependencies, catalogData);\n performSubstitution(pkg.peerDependencies, catalogData);\n\n return pkg;\n};\n\nconst performSubstitution = (\n dependencies: Record<string, string> | undefined,\n catalogData: CatalogData,\n) => {\n if (!dependencies) return;\n for (const [packageName, version] of Object.entries(dependencies)) {\n if (version === 'catalog:' || version === 'catalog:default') {\n if (!catalogData.catalog) {\n log(\n `⚠️ ${chalk.yellow(`catalog: substitution for the package '${packageName}' failed as there is no default catalog.`)}`,\n );\n continue;\n }\n const sub = catalogData.catalog[packageName];\n if (!sub) {\n log(\n `⚠️ ${chalk.yellow(`catalog: substitution for the package '${packageName}' failed as there is no matching package in the default catalog.`)}`,\n );\n continue;\n }\n dependencies[packageName] = sub;\n } else if (version.startsWith('catalog:')) {\n const catalogName = version.slice('catalog:'.length);\n const catalog = catalogData.catalogs?.[catalogName];\n if (!catalog) {\n log(\n `⚠️ ${chalk.yellow(`'${version}' substitution for the package '${packageName}' failed as there is no matching catalog named '${catalogName}'. (available named catalogs are: ${Object.keys(catalogData.catalogs ?? {}).join(', ')})`)}`,\n );\n continue;\n }\n const sub = catalog[packageName];\n if (!sub) {\n log(\n `⚠️ ${chalk.yellow(`'${version}' substitution for the package '${packageName}' failed as there is no package in the catalog named '${catalogName}'. (packages in the catalog are: ${Object.keys(catalog).join(', ')})`)}`,\n );\n continue;\n }\n dependencies[packageName] = sub;\n }\n }\n};\n","import { isNullish, isObject, isString, type Tsconfig } from '@orval/core';\nimport { findUp } from 'find-up';\nimport fs from 'fs-extra';\nimport { parse } from 'tsconfck';\n\nimport { normalizePath } from './options';\n\nexport const loadTsconfig = async (\n tsconfig?: Tsconfig | string,\n workspace = process.cwd(),\n): Promise<Tsconfig | undefined> => {\n if (isNullish(tsconfig)) {\n const configPath = await findUp(['tsconfig.json', 'jsconfig.json'], {\n cwd: workspace,\n });\n if (configPath) {\n const config = await parse(configPath);\n return config.tsconfig as Tsconfig;\n }\n return;\n }\n\n if (isString(tsconfig)) {\n const normalizedPath = normalizePath(tsconfig, workspace);\n if (fs.existsSync(normalizedPath)) {\n const config = await parse(normalizedPath);\n\n const tsconfig = (config.referenced?.find(\n ({ tsconfigFile }) => tsconfigFile === normalizedPath,\n )?.tsconfig ?? config.tsconfig) as Tsconfig;\n\n return tsconfig;\n }\n return;\n }\n\n if (isObject(tsconfig)) {\n return tsconfig;\n }\n return;\n};\n","import {\n type ClientMockBuilder,\n type ConfigExternal,\n createLogger,\n FormDataArrayHandling,\n type GlobalMockOptions,\n type GlobalOptions,\n type HonoOptions,\n type Hook,\n type HookFunction,\n type HookOption,\n type HooksOptions,\n isBoolean,\n isFunction,\n isNullish,\n isObject,\n isString,\n isUrl,\n type JsDocOptions,\n type Mutator,\n NamingConvention,\n type NormalizedHonoOptions,\n type NormalizedHookOptions,\n type NormalizedJsDocOptions,\n type NormalizedMutator,\n type NormalizedOperationOptions,\n type NormalizedOptions,\n type NormalizedOverrideOutput,\n type NormalizedQueryOptions,\n type NormalizedSchemaOptions,\n type OperationOptions,\n type OptionsExport,\n OutputClient,\n OutputHttpClient,\n OutputMode,\n type OverrideOutput,\n PropertySortOrder,\n type QueryOptions,\n RefComponentSuffix,\n type SchemaOptions,\n upath,\n} from '@orval/core';\nimport { DEFAULT_MOCK_OPTIONS } from '@orval/mock';\nimport chalk from 'chalk';\n\nimport pkg from '../../package.json';\nimport { loadPackageJson } from './package-json';\nimport { loadTsconfig } from './tsconfig';\n\n/**\n * Type helper to make it easier to use orval.config.ts\n * accepts a direct {@link ConfigExternal} object.\n */\nexport function defineConfig(options: ConfigExternal): ConfigExternal {\n return options;\n}\n\nfunction createFormData(\n workspace: string,\n formData: OverrideOutput['formData'],\n): NormalizedOverrideOutput['formData'] {\n const defaultArrayHandling = FormDataArrayHandling.SERIALIZE;\n if (formData === undefined)\n return { disabled: false, arrayHandling: defaultArrayHandling };\n if (isBoolean(formData))\n return { disabled: !formData, arrayHandling: defaultArrayHandling };\n if (isString(formData))\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData),\n arrayHandling: defaultArrayHandling,\n };\n if ('mutator' in formData || 'arrayHandling' in formData)\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData.mutator),\n arrayHandling: formData.arrayHandling ?? defaultArrayHandling,\n };\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData),\n arrayHandling: defaultArrayHandling,\n };\n}\n\nfunction normalizeSchemasOption(\n schemas: string | SchemaOptions | undefined,\n workspace: string,\n): string | NormalizedSchemaOptions | undefined {\n if (!schemas) {\n return undefined;\n }\n\n if (isString(schemas)) {\n return normalizePath(schemas, workspace);\n }\n\n return {\n path: normalizePath(schemas.path, workspace),\n type: schemas.type,\n };\n}\n\nexport async function normalizeOptions(\n optionsExport: OptionsExport,\n workspace = process.cwd(),\n globalOptions: GlobalOptions = {},\n): Promise<NormalizedOptions> {\n const options = await (isFunction(optionsExport)\n ? optionsExport()\n : optionsExport);\n\n if (!options.input) {\n throw new Error(chalk.red(`Config require an input`));\n }\n\n if (!options.output) {\n throw new Error(chalk.red(`Config require an output`));\n }\n\n const inputOptions = isString(options.input)\n ? { target: options.input }\n : options.input;\n\n const outputOptions = isString(options.output)\n ? { target: options.output }\n : options.output;\n\n const outputWorkspace = normalizePath(\n outputOptions.workspace ?? '',\n workspace,\n );\n\n const { clean, prettier, client, httpClient, mode, biome } = globalOptions;\n\n const tsconfig = await loadTsconfig(\n outputOptions.tsconfig ?? globalOptions.tsconfig,\n workspace,\n );\n\n const packageJson = await loadPackageJson(\n outputOptions.packageJson ?? globalOptions.packageJson,\n workspace,\n );\n\n const mockOption = outputOptions.mock ?? globalOptions.mock;\n let mock: GlobalMockOptions | ClientMockBuilder | undefined;\n if (isBoolean(mockOption) && mockOption) {\n mock = DEFAULT_MOCK_OPTIONS;\n } else if (isFunction(mockOption)) {\n mock = mockOption;\n } else if (mockOption) {\n mock = {\n ...DEFAULT_MOCK_OPTIONS,\n ...mockOption,\n };\n } else {\n mock = undefined;\n }\n\n const defaultFileExtension = '.ts';\n\n const globalQueryOptions: NormalizedQueryOptions = {\n useQuery: true,\n useMutation: true,\n signal: true,\n shouldExportMutatorHooks: true,\n shouldExportHttpClient: true,\n shouldExportQueryKey: true,\n shouldSplitQueryKey: false,\n ...normalizeQueryOptions(outputOptions.override?.query, workspace),\n };\n\n const normalizedOptions: NormalizedOptions = {\n input: {\n target: globalOptions.input\n ? normalizePathOrUrl(globalOptions.input, process.cwd())\n : normalizePathOrUrl(inputOptions.target, workspace),\n override: {\n transformer: normalizePath(\n inputOptions.override?.transformer,\n workspace,\n ),\n },\n filters: inputOptions.filters,\n parserOptions: inputOptions.parserOptions,\n },\n output: {\n target: globalOptions.output\n ? normalizePath(globalOptions.output, process.cwd())\n : normalizePath(outputOptions.target, outputWorkspace),\n schemas: normalizeSchemasOption(outputOptions.schemas, outputWorkspace),\n operationSchemas: outputOptions.operationSchemas\n ? normalizePath(outputOptions.operationSchemas, outputWorkspace)\n : undefined,\n namingConvention:\n outputOptions.namingConvention ?? NamingConvention.CAMEL_CASE,\n fileExtension: outputOptions.fileExtension ?? defaultFileExtension,\n workspace: outputOptions.workspace ? outputWorkspace : undefined,\n client: outputOptions.client ?? client ?? OutputClient.AXIOS_FUNCTIONS,\n httpClient:\n outputOptions.httpClient ??\n httpClient ??\n // Auto-detect: use Angular HttpClient for angular-query by default\n ((outputOptions.client ?? client) === OutputClient.ANGULAR_QUERY\n ? OutputHttpClient.ANGULAR\n : OutputHttpClient.FETCH),\n mode: normalizeOutputMode(outputOptions.mode ?? mode),\n mock,\n clean: outputOptions.clean ?? clean ?? false,\n docs: outputOptions.docs ?? false,\n prettier: outputOptions.prettier ?? prettier ?? false,\n biome: outputOptions.biome ?? biome ?? false,\n tsconfig,\n packageJson,\n headers: outputOptions.headers ?? false,\n indexFiles: outputOptions.indexFiles ?? true,\n baseUrl: outputOptions.baseUrl,\n unionAddMissingProperties:\n outputOptions.unionAddMissingProperties ?? false,\n override: {\n ...outputOptions.override,\n mock: {\n arrayMin: outputOptions.override?.mock?.arrayMin ?? 1,\n arrayMax: outputOptions.override?.mock?.arrayMax ?? 10,\n stringMin: outputOptions.override?.mock?.stringMin ?? 10,\n stringMax: outputOptions.override?.mock?.stringMax ?? 20,\n fractionDigits: outputOptions.override?.mock?.fractionDigits ?? 2,\n ...outputOptions.override?.mock,\n },\n operations: normalizeOperationsAndTags(\n outputOptions.override?.operations ?? {},\n outputWorkspace,\n {\n query: globalQueryOptions,\n },\n ),\n tags: normalizeOperationsAndTags(\n outputOptions.override?.tags ?? {},\n outputWorkspace,\n {\n query: globalQueryOptions,\n },\n ),\n mutator: normalizeMutator(\n outputWorkspace,\n outputOptions.override?.mutator,\n ),\n formData: createFormData(\n outputWorkspace,\n outputOptions.override?.formData,\n ),\n formUrlEncoded:\n (isBoolean(outputOptions.override?.formUrlEncoded)\n ? outputOptions.override.formUrlEncoded\n : normalizeMutator(\n outputWorkspace,\n outputOptions.override?.formUrlEncoded,\n )) ?? true,\n paramsSerializer: normalizeMutator(\n outputWorkspace,\n outputOptions.override?.paramsSerializer,\n ),\n header:\n outputOptions.override?.header === false\n ? false\n : isFunction(outputOptions.override?.header)\n ? outputOptions.override.header\n : getDefaultFilesHeader,\n requestOptions: outputOptions.override?.requestOptions ?? true,\n namingConvention: outputOptions.override?.namingConvention ?? {},\n components: {\n schemas: {\n suffix: RefComponentSuffix.schemas,\n itemSuffix:\n outputOptions.override?.components?.schemas?.itemSuffix ?? 'Item',\n ...outputOptions.override?.components?.schemas,\n },\n responses: {\n suffix: RefComponentSuffix.responses,\n ...outputOptions.override?.components?.responses,\n },\n parameters: {\n suffix: RefComponentSuffix.parameters,\n ...outputOptions.override?.components?.parameters,\n },\n requestBodies: {\n suffix: RefComponentSuffix.requestBodies,\n ...outputOptions.override?.components?.requestBodies,\n },\n },\n hono: normalizeHonoOptions(outputOptions.override?.hono, workspace),\n jsDoc: normalizeJSDocOptions(outputOptions.override?.jsDoc),\n query: globalQueryOptions,\n zod: {\n strict: {\n param: outputOptions.override?.zod?.strict?.param ?? false,\n query: outputOptions.override?.zod?.strict?.query ?? false,\n header: outputOptions.override?.zod?.strict?.header ?? false,\n body: outputOptions.override?.zod?.strict?.body ?? false,\n response: outputOptions.override?.zod?.strict?.response ?? false,\n },\n generate: {\n param: outputOptions.override?.zod?.generate?.param ?? true,\n query: outputOptions.override?.zod?.generate?.query ?? true,\n header: outputOptions.override?.zod?.generate?.header ?? true,\n body: outputOptions.override?.zod?.generate?.body ?? true,\n response: outputOptions.override?.zod?.generate?.response ?? true,\n },\n coerce: {\n param: outputOptions.override?.zod?.coerce?.param ?? false,\n query: outputOptions.override?.zod?.coerce?.query ?? false,\n header: outputOptions.override?.zod?.coerce?.header ?? false,\n body: outputOptions.override?.zod?.coerce?.body ?? false,\n response: outputOptions.override?.zod?.coerce?.response ?? false,\n },\n preprocess: {\n ...(outputOptions.override?.zod?.preprocess?.param\n ? {\n param: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.param,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.query\n ? {\n query: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.query,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.header\n ? {\n header: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.header,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.body\n ? {\n body: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.body,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.response\n ? {\n response: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.response,\n ),\n }\n : {}),\n },\n generateEachHttpStatus:\n outputOptions.override?.zod?.generateEachHttpStatus ?? false,\n dateTimeOptions: outputOptions.override?.zod?.dateTimeOptions ?? {},\n timeOptions: outputOptions.override?.zod?.timeOptions ?? {},\n },\n swr: {\n generateErrorTypes: false,\n ...outputOptions.override?.swr,\n },\n angular: {\n provideIn: outputOptions.override?.angular?.provideIn ?? 'root',\n runtimeValidation:\n outputOptions.override?.angular?.runtimeValidation ?? false,\n },\n fetch: {\n includeHttpResponseReturnType:\n outputOptions.override?.fetch?.includeHttpResponseReturnType ??\n true,\n forceSuccessResponse:\n outputOptions.override?.fetch?.forceSuccessResponse ?? false,\n runtimeValidation:\n outputOptions.override?.fetch?.runtimeValidation ?? false,\n ...outputOptions.override?.fetch,\n },\n useDates: outputOptions.override?.useDates ?? false,\n useDeprecatedOperations:\n outputOptions.override?.useDeprecatedOperations ?? true,\n enumGenerationType:\n outputOptions.override?.enumGenerationType ?? 'const',\n suppressReadonlyModifier:\n outputOptions.override?.suppressReadonlyModifier ?? false,\n aliasCombinedTypes: outputOptions.override?.aliasCombinedTypes ?? false,\n },\n allParamsOptional: outputOptions.allParamsOptional ?? false,\n urlEncodeParameters: outputOptions.urlEncodeParameters ?? false,\n optionsParamRequired: outputOptions.optionsParamRequired ?? false,\n propertySortOrder:\n outputOptions.propertySortOrder ?? PropertySortOrder.SPECIFICATION,\n },\n hooks: options.hooks ? normalizeHooks(options.hooks) : {},\n };\n\n if (!normalizedOptions.input.target) {\n throw new Error(chalk.red(`Config require an input target`));\n }\n\n if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) {\n throw new Error(chalk.red(`Config require an output target or schemas`));\n }\n\n return normalizedOptions;\n}\n\nfunction normalizeMutator(\n workspace: string,\n mutator?: Mutator,\n): NormalizedMutator | undefined {\n if (isObject(mutator)) {\n if (!mutator.path) {\n throw new Error(chalk.red(`Mutator need a path`));\n }\n\n return {\n ...mutator,\n path: upath.resolve(workspace, mutator.path),\n default: mutator.default ?? !mutator.name,\n };\n }\n\n if (isString(mutator)) {\n return {\n path: upath.resolve(workspace, mutator),\n default: true,\n };\n }\n\n return mutator;\n}\n\nfunction normalizePathOrUrl<T>(path: T, workspace: string) {\n if (isString(path) && !isUrl(path)) {\n return normalizePath(path, workspace);\n }\n\n return path;\n}\n\nexport function normalizePath<T>(path: T, workspace: string) {\n if (!isString(path)) {\n return path;\n }\n return upath.resolve(workspace, path);\n}\n\nfunction normalizeOperationsAndTags(\n operationsOrTags: Record<string, OperationOptions>,\n workspace: string,\n global: {\n query: NormalizedQueryOptions;\n },\n): Record<string, NormalizedOperationOptions> {\n return Object.fromEntries(\n Object.entries(operationsOrTags).map(\n ([\n key,\n {\n transformer,\n mutator,\n formData,\n formUrlEncoded,\n paramsSerializer,\n query,\n zod,\n ...rest\n },\n ]) => {\n return [\n key,\n {\n ...rest,\n ...(query\n ? {\n query: normalizeQueryOptions(query, workspace, global.query),\n }\n : {}),\n ...(zod\n ? {\n zod: {\n strict: {\n param: zod.strict?.param ?? false,\n query: zod.strict?.query ?? false,\n header: zod.strict?.header ?? false,\n body: zod.strict?.body ?? false,\n response: zod.strict?.response ?? false,\n },\n generate: {\n param: zod.generate?.param ?? true,\n query: zod.generate?.query ?? true,\n header: zod.generate?.header ?? true,\n body: zod.generate?.body ?? true,\n response: zod.generate?.response ?? true,\n },\n coerce: {\n param: zod.coerce?.param ?? false,\n query: zod.coerce?.query ?? false,\n header: zod.coerce?.header ?? false,\n body: zod.coerce?.body ?? false,\n response: zod.coerce?.response ?? false,\n },\n preprocess: {\n ...(zod.preprocess?.param\n ? {\n param: normalizeMutator(\n workspace,\n zod.preprocess.param,\n ),\n }\n : {}),\n ...(zod.preprocess?.query\n ? {\n query: normalizeMutator(\n workspace,\n zod.preprocess.query,\n ),\n }\n : {}),\n ...(zod.preprocess?.header\n ? {\n header: normalizeMutator(\n workspace,\n zod.preprocess.header,\n ),\n }\n : {}),\n ...(zod.preprocess?.body\n ? {\n body: normalizeMutator(\n workspace,\n zod.preprocess.body,\n ),\n }\n : {}),\n ...(zod.preprocess?.response\n ? {\n response: normalizeMutator(\n workspace,\n zod.preprocess.response,\n ),\n }\n : {}),\n },\n generateEachHttpStatus: zod.generateEachHttpStatus ?? false,\n dateTimeOptions: zod.dateTimeOptions ?? {},\n timeOptions: zod.timeOptions ?? {},\n },\n }\n : {}),\n ...(transformer\n ? { transformer: normalizePath(transformer, workspace) }\n : {}),\n ...(mutator\n ? { mutator: normalizeMutator(workspace, mutator) }\n : {}),\n ...createFormData(workspace, formData),\n ...(formUrlEncoded\n ? {\n formUrlEncoded: isBoolean(formUrlEncoded)\n ? formUrlEncoded\n : normalizeMutator(workspace, formUrlEncoded),\n }\n : {}),\n ...(paramsSerializer\n ? {\n paramsSerializer: normalizeMutator(\n workspace,\n paramsSerializer,\n ),\n }\n : {}),\n },\n ];\n },\n ),\n );\n}\n\nfunction normalizeOutputMode(mode?: OutputMode): OutputMode {\n if (!mode) {\n return OutputMode.SINGLE;\n }\n\n if (!Object.values(OutputMode).includes(mode)) {\n createLogger().warn(chalk.yellow(`Unknown the provided mode => ${mode}`));\n return OutputMode.SINGLE;\n }\n\n return mode;\n}\n\nfunction normalizeHooks(hooks: HooksOptions): NormalizedHookOptions {\n const keys = Object.keys(hooks) as unknown as Hook[];\n\n const result: NormalizedHookOptions = {};\n for (const key of keys) {\n if (isString(hooks[key])) {\n result[key] = [hooks[key]] as string[];\n } else if (Array.isArray(hooks[key])) {\n result[key] = hooks[key] as string[];\n } else if (isFunction(hooks[key])) {\n result[key] = [hooks[key]] as HookFunction[];\n } else if (isObject(hooks[key])) {\n result[key] = [hooks[key]] as HookOption[];\n }\n }\n return result;\n}\n\nfunction normalizeHonoOptions(\n hono: HonoOptions = {},\n workspace: string,\n): NormalizedHonoOptions {\n return {\n ...(hono.handlers\n ? { handlers: upath.resolve(workspace, hono.handlers) }\n : {}),\n compositeRoute: hono.compositeRoute ?? '',\n validator: hono.validator ?? true,\n validatorOutputPath: hono.validatorOutputPath\n ? upath.resolve(workspace, hono.validatorOutputPath)\n : '',\n };\n}\n\nfunction normalizeJSDocOptions(\n jsdoc: JsDocOptions = {},\n): NormalizedJsDocOptions {\n return {\n ...jsdoc,\n };\n}\n\nfunction normalizeQueryOptions(\n queryOptions: QueryOptions = {},\n outputWorkspace: string,\n globalOptions: NormalizedQueryOptions = {},\n): NormalizedQueryOptions {\n if (queryOptions.options) {\n console.warn(\n '[WARN] Using query options is deprecated and will be removed in a future major release. Please use queryOptions or mutationOptions instead.',\n );\n }\n\n return {\n ...(isNullish(queryOptions.usePrefetch)\n ? {}\n : { usePrefetch: queryOptions.usePrefetch }),\n ...(isNullish(queryOptions.useInvalidate)\n ? {}\n : { useInvalidate: queryOptions.useInvalidate }),\n ...(isNullish(queryOptions.useQuery)\n ? {}\n : { useQuery: queryOptions.useQuery }),\n ...(isNullish(queryOptions.useSuspenseQuery)\n ? {}\n : { useSuspenseQuery: queryOptions.useSuspenseQuery }),\n ...(isNullish(queryOptions.useMutation)\n ? {}\n : { useMutation: queryOptions.useMutation }),\n ...(isNullish(queryOptions.useInfinite)\n ? {}\n : { useInfinite: queryOptions.useInfinite }),\n ...(isNullish(queryOptions.useSuspenseInfiniteQuery)\n ? {}\n : { useSuspenseInfiniteQuery: queryOptions.useSuspenseInfiniteQuery }),\n ...(queryOptions.useInfiniteQueryParam\n ? { useInfiniteQueryParam: queryOptions.useInfiniteQueryParam }\n : {}),\n ...(queryOptions.options ? { options: queryOptions.options } : {}),\n ...(globalOptions.queryKey\n ? {\n queryKey: globalOptions.queryKey,\n }\n : {}),\n ...(queryOptions.queryKey\n ? {\n queryKey: normalizeMutator(outputWorkspace, queryOptions.queryKey),\n }\n : {}),\n ...(globalOptions.queryOptions\n ? {\n queryOptions: globalOptions.queryOptions,\n }\n : {}),\n ...(queryOptions.queryOptions\n ? {\n queryOptions: normalizeMutator(\n outputWorkspace,\n queryOptions.queryOptions,\n ),\n }\n : {}),\n ...(globalOptions.mutationOptions\n ? {\n mutationOptions: globalOptions.mutationOptions,\n }\n : {}),\n ...(queryOptions.mutationOptions\n ? {\n mutationOptions: normalizeMutator(\n outputWorkspace,\n queryOptions.mutationOptions,\n ),\n }\n : {}),\n ...(isNullish(globalOptions.shouldExportQueryKey)\n ? {}\n : {\n shouldExportQueryKey: globalOptions.shouldExportQueryKey,\n }),\n ...(isNullish(queryOptions.shouldExportQueryKey)\n ? {}\n : { shouldExportQueryKey: queryOptions.shouldExportQueryKey }),\n ...(isNullish(globalOptions.shouldExportHttpClient)\n ? {}\n : {\n shouldExportHttpClient: globalOptions.shouldExportHttpClient,\n }),\n ...(isNullish(queryOptions.shouldExportHttpClient)\n ? {}\n : { shouldExportHttpClient: queryOptions.shouldExportHttpClient }),\n ...(isNullish(globalOptions.shouldExportMutatorHooks)\n ? {}\n : {\n shouldExportMutatorHooks: globalOptions.shouldExportMutatorHooks,\n }),\n ...(isNullish(queryOptions.shouldExportMutatorHooks)\n ? {}\n : { shouldExportMutatorHooks: queryOptions.shouldExportMutatorHooks }),\n ...(isNullish(globalOptions.shouldSplitQueryKey)\n ? {}\n : {\n shouldSplitQueryKey: globalOptions.shouldSplitQueryKey,\n }),\n ...(isNullish(queryOptions.shouldSplitQueryKey)\n ? {}\n : { shouldSplitQueryKey: queryOptions.shouldSplitQueryKey }),\n ...(isNullish(globalOptions.signal)\n ? {}\n : {\n signal: globalOptions.signal,\n }),\n ...(isNullish(globalOptions.useOperationIdAsQueryKey)\n ? {}\n : {\n useOperationIdAsQueryKey: globalOptions.useOperationIdAsQueryKey,\n }),\n ...(isNullish(queryOptions.useOperationIdAsQueryKey)\n ? {}\n : { useOperationIdAsQueryKey: queryOptions.useOperationIdAsQueryKey }),\n ...(isNullish(globalOptions.signal)\n ? {}\n : {\n signal: globalOptions.signal,\n }),\n ...(isNullish(queryOptions.signal) ? {} : { signal: queryOptions.signal }),\n ...(isNullish(globalOptions.version)\n ? {}\n : {\n version: globalOptions.version,\n }),\n ...(isNullish(queryOptions.version)\n ? {}\n : { version: queryOptions.version }),\n ...(queryOptions.mutationInvalidates\n ? { mutationInvalidates: queryOptions.mutationInvalidates }\n : {}),\n ...(isNullish(globalOptions.runtimeValidation)\n ? {}\n : {\n runtimeValidation: globalOptions.runtimeValidation,\n }),\n ...(isNullish(queryOptions.runtimeValidation)\n ? {}\n : { runtimeValidation: queryOptions.runtimeValidation }),\n };\n}\n\nexport function getDefaultFilesHeader({\n title,\n description,\n version,\n}: {\n title?: string;\n description?: string;\n version?: string;\n} = {}) {\n return [\n `Generated by ${pkg.name} v${pkg.version} 🍺`,\n `Do not edit manually.`,\n ...(title ? [title] : []),\n ...(description ? [description] : []),\n ...(version ? [`OpenAPI spec version: ${version}`] : []),\n ];\n}\n","import { isBoolean, log, logError } from '@orval/core';\n\n/**\n * Start a file watcher and invoke an async callback on file changes.\n *\n * If `watchOptions` is falsy the watcher is not started. Supported shapes:\n * - boolean: when true the `defaultTarget` is watched\n * - string: a single path to watch\n * - string[]: an array of paths to watch\n *\n * @param watchOptions - false to disable watching, or a path/paths to watch\n * @param watchFn - async callback executed on change events\n * @param defaultTarget - path(s) to watch when `watchOptions` is `true` (default: '.')\n * @returns Resolves once the watcher has been started (or immediately if disabled)\n *\n * @example\n * await startWatcher(true, async () => { await buildProject(); }, 'src');\n */\nexport async function startWatcher(\n watchOptions: boolean | string | string[],\n watchFn: () => Promise<void>,\n defaultTarget: string | string[] = '.',\n) {\n if (!watchOptions) return;\n const { watch } = await import('chokidar');\n\n const ignored = ['**/{.git,node_modules}/**'];\n\n const watchPaths = isBoolean(watchOptions) ? defaultTarget : watchOptions;\n\n log(\n `Watching for changes in ${\n Array.isArray(watchPaths)\n ? watchPaths.map((v) => '\"' + v + '\"').join(' | ')\n : '\"' + watchPaths + '\"'\n }`,\n );\n\n const watcher = watch(watchPaths, {\n ignorePermissionErrors: true,\n ignored,\n });\n watcher.on('all', (type, file) => {\n log(`Change detected: ${type} ${file}`);\n\n watchFn().catch((error: unknown) => {\n logError(error);\n });\n });\n}\n","import {\n type ContextSpec,\n conventionName,\n type NamingConvention,\n type NormalizedOutputOptions,\n type OpenApiParameterObject,\n type OpenApiReferenceObject,\n type OpenApiRequestBodyObject,\n type OpenApiSchemaObject,\n pascal,\n upath,\n type ZodCoerceType,\n} from '@orval/core';\nimport {\n dereference,\n generateZodValidationSchemaDefinition,\n isZodVersionV4,\n parseZodValidationSchemaDefinition,\n} from '@orval/zod';\nimport fs from 'fs-extra';\n\ntype ZodSchemaFileEntry = {\n schemaName: string;\n consts: string;\n zodExpression: string;\n};\n\ntype ZodSchemaFileToWrite = ZodSchemaFileEntry & {\n filePath: string;\n};\n\ntype WriteZodOutputOptions = {\n namingConvention: NamingConvention;\n indexFiles: boolean;\n packageJson?: NormalizedOutputOptions['packageJson'];\n override: {\n zod: {\n strict: {\n body: boolean;\n };\n coerce: {\n body: boolean | ZodCoerceType[];\n };\n };\n };\n};\n\ntype WriteZodSchemasInput = {\n spec: ContextSpec['spec'];\n target: string;\n schemas: {\n name: string;\n schema?: OpenApiSchemaObject | OpenApiReferenceObject;\n }[];\n};\n\ntype WriteZodVerbResponseType = {\n value: string;\n isRef?: boolean;\n originalSchema?: OpenApiSchemaObject;\n};\n\ntype WriteZodSchemasFromVerbsInput = Record<\n string,\n {\n operationName: string;\n originalOperation: {\n requestBody?: OpenApiRequestBodyObject | OpenApiReferenceObject;\n parameters?: (OpenApiParameterObject | OpenApiReferenceObject)[];\n };\n response: {\n types: {\n success: WriteZodVerbResponseType[];\n errors: WriteZodVerbResponseType[];\n };\n };\n }\n>;\n\ntype WriteZodSchemasFromVerbsContext = {\n output: {\n override: {\n useDates?: boolean;\n zod: {\n dateTimeOptions?: Record<string, unknown>;\n timeOptions?: Record<string, unknown>;\n };\n };\n };\n spec: ContextSpec['spec'];\n target: string;\n workspace: string;\n};\n\nfunction generateZodSchemaFileContent(\n header: string,\n schemas: ZodSchemaFileEntry[],\n): string {\n const schemaContent = schemas\n .map(({ schemaName, consts, zodExpression }) => {\n const schemaConsts = consts ? `${consts}\\n` : '';\n\n return `${schemaConsts}export const ${schemaName} = ${zodExpression}\n\nexport type ${schemaName} = zod.input<typeof ${schemaName}>;`;\n })\n .join('\\n\\n');\n\n return `${header}import { z as zod } from 'zod';\n\n${schemaContent}\n`;\n}\n\nconst isValidSchemaIdentifier = (name: string) =>\n /^[A-Za-z_][A-Za-z0-9_]*$/.test(name);\n\nconst isPrimitiveSchemaName = (name: string) =>\n ['string', 'number', 'boolean', 'void', 'unknown', 'Blob'].includes(name);\n\nconst dedupeSchemasByName = <T extends { name: string }>(schemas: T[]) => {\n const uniqueSchemas = new Map<string, T>();\n\n for (const schema of schemas) {\n if (!uniqueSchemas.has(schema.name)) {\n uniqueSchemas.set(schema.name, schema);\n }\n }\n\n return [...uniqueSchemas.values()];\n};\n\nconst groupSchemasByFilePath = <T extends { filePath: string }>(\n schemas: T[],\n) => {\n const grouped = new Map<string, T[]>();\n\n for (const schema of schemas) {\n const key = schema.filePath.toLowerCase();\n const existingGroup = grouped.get(key);\n\n if (existingGroup) {\n existingGroup.push(schema);\n } else {\n grouped.set(key, [schema]);\n }\n }\n\n const sortedGroups = [...grouped.values()].map((group) =>\n [...group].toSorted((a, b) => a.filePath.localeCompare(b.filePath)),\n );\n\n return sortedGroups.toSorted((a, b) =>\n a[0].filePath.localeCompare(b[0].filePath),\n );\n};\n\nasync function writeZodSchemaIndex(\n schemasPath: string,\n fileExtension: string,\n header: string,\n schemaNames: string[],\n namingConvention: NamingConvention,\n shouldMergeExisting = false,\n) {\n const importFileExtension = fileExtension.replace(/\\.ts$/, '');\n const indexPath = upath.join(schemasPath, `index${fileExtension}`);\n\n let existingExports = '';\n if (shouldMergeExisting && (await fs.pathExists(indexPath))) {\n const existingContent = await fs.readFile(indexPath, 'utf8');\n const headerMatch = /^(\\/\\*\\*[\\s\\S]*?\\*\\/\\n)?/.exec(existingContent);\n const headerPart = headerMatch ? headerMatch[0] : '';\n existingExports = existingContent.slice(headerPart.length).trim();\n }\n\n const newExports = schemaNames\n .map((schemaName) => {\n const fileName = conventionName(schemaName, namingConvention);\n return `export * from './${fileName}${importFileExtension}';`;\n })\n .toSorted()\n .join('\\n');\n\n const allExports = existingExports\n ? `${existingExports}\\n${newExports}`\n : newExports;\n\n const uniqueExports = [...new Set(allExports.split('\\n'))]\n .filter((line) => line.trim())\n .toSorted()\n .join('\\n');\n\n await fs.outputFile(indexPath, `${header}\\n${uniqueExports}\\n`);\n}\n\nexport async function writeZodSchemas(\n builder: WriteZodSchemasInput,\n schemasPath: string,\n fileExtension: string,\n header: string,\n output: WriteZodOutputOptions,\n) {\n const schemasWithOpenApiDef = builder.schemas.filter((s) => s.schema);\n const schemasToWrite: ZodSchemaFileToWrite[] = [];\n const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);\n const strict = output.override.zod.strict.body;\n const coerce = output.override.zod.coerce.body;\n\n for (const generatorSchema of schemasWithOpenApiDef) {\n const { name, schema: schemaObject } = generatorSchema;\n\n if (!schemaObject) {\n continue;\n }\n\n const fileName = conventionName(name, output.namingConvention);\n const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);\n const context: ContextSpec = {\n spec: builder.spec,\n target: builder.target,\n workspace: '',\n output: output as ContextSpec['output'],\n };\n\n // Dereference the schema to resolve $ref\n const dereferencedSchema = dereference(schemaObject, context);\n\n const zodDefinition = generateZodValidationSchemaDefinition(\n dereferencedSchema,\n context,\n name,\n strict,\n isZodV4,\n {\n required: true,\n },\n );\n\n const parsedZodDefinition = parseZodValidationSchemaDefinition(\n zodDefinition,\n context,\n coerce,\n strict,\n isZodV4,\n );\n\n schemasToWrite.push({\n schemaName: name,\n filePath,\n consts: parsedZodDefinition.consts,\n zodExpression: parsedZodDefinition.zod,\n });\n }\n\n const groupedSchemasToWrite = groupSchemasByFilePath(schemasToWrite);\n\n for (const schemaGroup of groupedSchemasToWrite) {\n const fileContent = generateZodSchemaFileContent(header, schemaGroup);\n\n await fs.outputFile(schemaGroup[0].filePath, fileContent);\n }\n\n if (output.indexFiles) {\n const schemaNames = groupedSchemasToWrite.map(\n (schemaGroup) => schemaGroup[0].schemaName,\n );\n await writeZodSchemaIndex(\n schemasPath,\n fileExtension,\n header,\n schemaNames,\n output.namingConvention,\n false,\n );\n }\n}\n\nexport async function writeZodSchemasFromVerbs(\n verbOptions: WriteZodSchemasFromVerbsInput,\n schemasPath: string,\n fileExtension: string,\n header: string,\n output: WriteZodOutputOptions,\n context: WriteZodSchemasFromVerbsContext,\n) {\n const zodContext = context as ContextSpec;\n const verbOptionsArray = Object.values(verbOptions);\n\n if (verbOptionsArray.length === 0) {\n return;\n }\n\n const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);\n const strict = output.override.zod.strict.body;\n const coerce = output.override.zod.coerce.body;\n\n const generateVerbsSchemas = verbOptionsArray.flatMap((verbOption) => {\n const operation = verbOption.originalOperation;\n\n const requestBody = operation.requestBody as\n | OpenApiRequestBodyObject\n | OpenApiReferenceObject\n | undefined;\n const requestBodyContent =\n requestBody && 'content' in requestBody\n ? (requestBody as OpenApiRequestBodyObject).content\n : undefined;\n const bodySchema = requestBodyContent?.['application/json']?.schema as\n | OpenApiSchemaObject\n | undefined;\n\n const bodySchemas = bodySchema\n ? [\n {\n name: `${pascal(verbOption.operationName)}Body`,\n schema: dereference(bodySchema, zodContext),\n },\n ]\n : [];\n\n const parameters = operation.parameters;\n\n const queryParams = parameters?.filter(\n (p): p is OpenApiParameterObject => 'in' in p && p.in === 'query',\n );\n\n const queryParamsSchemas =\n queryParams && queryParams.length > 0\n ? [\n {\n name: `${pascal(verbOption.operationName)}Params`,\n schema: {\n type: 'object' as const,\n properties: Object.fromEntries(\n queryParams\n .filter((p) => 'schema' in p && p.schema)\n .map((p) => [\n p.name,\n dereference(p.schema as OpenApiSchemaObject, zodContext),\n ]),\n ) as Record<string, OpenApiSchemaObject>,\n required: queryParams\n .filter((p) => p.required)\n .map((p) => p.name)\n .filter((name): name is string => name !== undefined),\n },\n },\n ]\n : [];\n\n const headerParams = parameters?.filter(\n (p): p is OpenApiParameterObject => 'in' in p && p.in === 'header',\n );\n\n const headerParamsSchemas =\n headerParams && headerParams.length > 0\n ? [\n {\n name: `${pascal(verbOption.operationName)}Headers`,\n schema: {\n type: 'object' as const,\n properties: Object.fromEntries(\n headerParams\n .filter((p) => 'schema' in p && p.schema)\n .map((p) => [\n p.name,\n dereference(p.schema as OpenApiSchemaObject, zodContext),\n ]),\n ) as Record<string, OpenApiSchemaObject>,\n required: headerParams\n .filter((p) => p.required)\n .map((p) => p.name)\n .filter((name): name is string => name !== undefined),\n },\n },\n ]\n : [];\n\n const responseSchemas = [\n ...verbOption.response.types.success,\n ...verbOption.response.types.errors,\n ]\n .filter(\n (\n responseType,\n ): responseType is typeof responseType & {\n originalSchema: OpenApiSchemaObject;\n } =>\n !!responseType.originalSchema &&\n !responseType.isRef &&\n isValidSchemaIdentifier(responseType.value) &&\n !isPrimitiveSchemaName(responseType.value),\n )\n .map((responseType) => ({\n name: responseType.value,\n schema: dereference(responseType.originalSchema, zodContext),\n }));\n\n return dedupeSchemasByName([\n ...bodySchemas,\n ...queryParamsSchemas,\n ...headerParamsSchemas,\n ...responseSchemas,\n ]);\n });\n\n const uniqueVerbsSchemas = dedupeSchemasByName(generateVerbsSchemas);\n const schemasToWrite: ZodSchemaFileToWrite[] = [];\n\n for (const { name, schema } of uniqueVerbsSchemas) {\n const fileName = conventionName(name, output.namingConvention);\n const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);\n\n const zodDefinition = generateZodValidationSchemaDefinition(\n schema,\n zodContext,\n name,\n strict,\n isZodV4,\n {\n required: true,\n },\n );\n\n const parsedZodDefinition = parseZodValidationSchemaDefinition(\n zodDefinition,\n zodContext,\n coerce,\n strict,\n isZodV4,\n );\n\n schemasToWrite.push({\n schemaName: name,\n filePath,\n consts: parsedZodDefinition.consts,\n zodExpression: parsedZodDefinition.zod,\n });\n }\n\n const groupedSchemasToWrite = groupSchemasByFilePath(schemasToWrite);\n\n for (const schemaGroup of groupedSchemasToWrite) {\n const fileContent = generateZodSchemaFileContent(header, schemaGroup);\n\n await fs.outputFile(schemaGroup[0].filePath, fileContent);\n }\n\n if (output.indexFiles && uniqueVerbsSchemas.length > 0) {\n const schemaNames = groupedSchemasToWrite.map(\n (schemaGroup) => schemaGroup[0].schemaName,\n );\n await writeZodSchemaIndex(\n schemasPath,\n fileExtension,\n header,\n schemaNames,\n output.namingConvention,\n true,\n );\n }\n}\n","import {\n createSuccessMessage,\n fixCrossDirectoryImports,\n fixRegularSchemaImports,\n getFileInfo,\n getMockFileExtensionByTypeName,\n isObject,\n isString,\n jsDoc,\n log,\n type NormalizedOptions,\n type OpenApiInfoObject,\n OutputMode,\n splitSchemasByType,\n upath,\n writeSchemas,\n writeSingleMode,\n type WriteSpecBuilder,\n writeSplitMode,\n writeSplitTagsMode,\n writeTagsMode,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { execa, ExecaError } from 'execa';\nimport fs from 'fs-extra';\nimport { unique } from 'remeda';\nimport type { TypeDocOptions } from 'typedoc';\n\nimport { formatWithPrettier } from './formatters/prettier';\nimport { executeHook } from './utils';\nimport { writeZodSchemas, writeZodSchemasFromVerbs } from './write-zod-specs';\n\nfunction getHeader(\n option: false | ((info: OpenApiInfoObject) => string | string[]),\n info: OpenApiInfoObject,\n): string {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n}\n\n/**\n * Add re-export of operation schemas from the main schemas index file.\n * Handles the case where the index file doesn't exist (no regular schemas).\n */\nasync function addOperationSchemasReExport(\n schemaPath: string,\n operationSchemasPath: string,\n fileExtension: string,\n header: string,\n): Promise<void> {\n const relativePath = upath.relativeSafe(schemaPath, operationSchemasPath);\n const schemaIndexPath = upath.join(schemaPath, `index${fileExtension}`);\n const exportLine = `export * from '${relativePath}';\\n`;\n\n const indexExists = await fs.pathExists(schemaIndexPath);\n if (indexExists) {\n // Check if export already exists to prevent duplicates on re-runs\n // Use regex to handle both single and double quotes\n const existingContent = await fs.readFile(schemaIndexPath, 'utf8');\n const exportPattern = new RegExp(\n String.raw`export\\s*\\*\\s*from\\s*['\"]${relativePath.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`)}['\"]`,\n );\n if (!exportPattern.test(existingContent)) {\n await fs.appendFile(schemaIndexPath, exportLine);\n }\n } else {\n // Create index with header if file doesn't exist (no regular schemas case)\n const content =\n header && header.trim().length > 0\n ? `${header}\\n${exportLine}`\n : exportLine;\n await fs.outputFile(schemaIndexPath, content);\n }\n}\n\nexport async function writeSpecs(\n builder: WriteSpecBuilder,\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n) {\n const { info, schemas, target } = builder;\n const { output } = options;\n const projectTitle = projectName ?? info.title;\n\n const header = getHeader(output.override.header, info);\n\n if (output.schemas) {\n if (isString(output.schemas)) {\n const fileExtension = output.fileExtension || '.ts';\n const schemaPath = output.schemas;\n\n // Split schemas if operationSchemas path is configured\n if (output.operationSchemas) {\n const { regularSchemas, operationSchemas: opSchemas } =\n splitSchemasByType(schemas);\n\n // Fix cross-directory imports before writing (both directions)\n const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));\n const operationSchemaNames = new Set(opSchemas.map((s) => s.name));\n fixCrossDirectoryImports(\n opSchemas,\n regularSchemaNames,\n schemaPath,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n fixRegularSchemaImports(\n regularSchemas,\n operationSchemaNames,\n schemaPath,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n\n // Write regular schemas to schemas path\n if (regularSchemas.length > 0) {\n await writeSchemas({\n schemaPath,\n schemas: regularSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n\n // Write operation schemas to operationSchemas path\n if (opSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.operationSchemas,\n schemas: opSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n\n // Add re-export from operations in the main schemas index\n if (output.indexFiles) {\n await addOperationSchemasReExport(\n schemaPath,\n output.operationSchemas,\n fileExtension,\n header,\n );\n }\n }\n } else {\n await writeSchemas({\n schemaPath,\n schemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n } else {\n const schemaType = output.schemas.type;\n\n if (schemaType === 'typescript') {\n const fileExtension = output.fileExtension || '.ts';\n\n // Split schemas if operationSchemas path is configured\n if (output.operationSchemas) {\n const { regularSchemas, operationSchemas: opSchemas } =\n splitSchemasByType(schemas);\n\n // Fix cross-directory imports before writing (both directions)\n const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));\n const operationSchemaNames = new Set(opSchemas.map((s) => s.name));\n fixCrossDirectoryImports(\n opSchemas,\n regularSchemaNames,\n output.schemas.path,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n fixRegularSchemaImports(\n regularSchemas,\n operationSchemaNames,\n output.schemas.path,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n\n if (regularSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.schemas.path,\n schemas: regularSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n\n if (opSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.operationSchemas,\n schemas: opSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n\n // Add re-export from operations in the main schemas index\n if (output.indexFiles) {\n await addOperationSchemasReExport(\n output.schemas.path,\n output.operationSchemas,\n fileExtension,\n header,\n );\n }\n }\n } else {\n await writeSchemas({\n schemaPath: output.schemas.path,\n schemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n } else {\n // schemaType === 'zod'\n const fileExtension = '.zod.ts';\n\n await writeZodSchemas(\n builder,\n output.schemas.path,\n fileExtension,\n header,\n output,\n );\n\n await writeZodSchemasFromVerbs(\n builder.verbOptions,\n output.schemas.path,\n fileExtension,\n header,\n output,\n {\n spec: builder.spec,\n target: builder.target,\n workspace,\n output,\n },\n );\n }\n }\n }\n\n let implementationPaths: string[] = [];\n\n if (output.target) {\n const writeMode = getWriteMode(output.mode);\n implementationPaths = await writeMode({\n builder,\n workspace,\n output,\n projectName,\n header,\n needSchema: !output.schemas && output.client !== 'zod',\n });\n }\n\n if (output.workspace) {\n const workspacePath = output.workspace;\n const imports = implementationPaths\n .filter(\n (path) =>\n !output.mock ||\n !path.endsWith(`.${getMockFileExtensionByTypeName(output.mock)}.ts`),\n )\n .map((path) =>\n upath.relativeSafe(\n workspacePath,\n getFileInfo(path).pathWithoutExtension,\n ),\n );\n\n if (output.schemas) {\n const schemasPath = isString(output.schemas)\n ? output.schemas\n : output.schemas.path;\n imports.push(\n upath.relativeSafe(workspacePath, getFileInfo(schemasPath).dirname),\n );\n }\n\n if (output.operationSchemas) {\n imports.push(\n upath.relativeSafe(\n workspacePath,\n getFileInfo(output.operationSchemas).dirname,\n ),\n );\n }\n\n if (output.indexFiles) {\n const indexFile = upath.join(workspacePath, '/index.ts');\n\n if (await fs.pathExists(indexFile)) {\n const data = await fs.readFile(indexFile, 'utf8');\n const importsNotDeclared = imports.filter((imp) => !data.includes(imp));\n await fs.appendFile(\n indexFile,\n unique(importsNotDeclared)\n .map((imp) => `export * from '${imp}';\\n`)\n .join(''),\n );\n } else {\n await fs.outputFile(\n indexFile,\n unique(imports)\n .map((imp) => `export * from '${imp}';`)\n .join('\\n') + '\\n',\n );\n }\n\n implementationPaths = [indexFile, ...implementationPaths];\n }\n }\n\n if (builder.extraFiles.length > 0) {\n await Promise.all(\n builder.extraFiles.map(async (file) =>\n fs.outputFile(file.path, file.content),\n ),\n );\n\n implementationPaths = [\n ...implementationPaths,\n ...builder.extraFiles.map((file) => file.path),\n ];\n }\n\n const paths = [\n ...(output.schemas\n ? [\n getFileInfo(\n isString(output.schemas) ? output.schemas : output.schemas.path,\n ).dirname,\n ]\n : []),\n ...(output.operationSchemas\n ? [getFileInfo(output.operationSchemas).dirname]\n : []),\n ...implementationPaths,\n ];\n\n if (options.hooks.afterAllFilesWrite) {\n await executeHook(\n 'afterAllFilesWrite',\n options.hooks.afterAllFilesWrite,\n paths,\n );\n }\n\n if (output.prettier) {\n await formatWithPrettier(paths, projectTitle);\n }\n\n if (output.biome) {\n try {\n await execa('biome', ['check', '--write', ...paths]);\n } catch (error) {\n let message = `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}biome not found`;\n if (error instanceof ExecaError && error.exitCode === 1)\n message = error.message;\n\n log(chalk.yellow(message));\n }\n }\n\n if (output.docs) {\n try {\n let config: Partial<TypeDocOptions> = {};\n let configPath: string | undefined;\n if (isObject(output.docs)) {\n ({ configPath, ...config } = output.docs);\n if (configPath) {\n config.options = configPath;\n }\n }\n\n const getTypedocApplication = async () => {\n const { Application } = await import('typedoc');\n return Application;\n };\n\n const Application = await getTypedocApplication();\n const app = await Application.bootstrapWithPlugins({\n entryPoints: paths,\n theme: 'markdown',\n // Set the custom config location if it has been provided.\n ...config,\n plugin: ['typedoc-plugin-markdown', ...(config.plugin ?? [])],\n });\n // Set defaults if the have not been provided by the external config.\n if (!app.options.isSet('readme')) {\n app.options.setValue('readme', 'none');\n }\n if (!app.options.isSet('logLevel')) {\n app.options.setValue('logLevel', 'None');\n }\n const project = await app.convert();\n if (project) {\n const outputPath = app.options.getValue('out');\n await app.generateDocs(project, outputPath);\n\n if (output.prettier) {\n await formatWithPrettier([outputPath], projectTitle);\n }\n } else {\n throw new Error('TypeDoc not initialized');\n }\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}Unable to generate docs`;\n\n log(chalk.yellow(message));\n }\n }\n\n createSuccessMessage(projectTitle);\n}\n\nfunction getWriteMode(mode: OutputMode) {\n switch (mode) {\n case OutputMode.SPLIT: {\n return writeSplitMode;\n }\n case OutputMode.TAGS: {\n return writeTagsMode;\n }\n case OutputMode.TAGS_SPLIT: {\n return writeSplitTagsMode;\n }\n default: {\n return writeSingleMode;\n }\n }\n}\n","import {\n getFileInfo,\n isString,\n log,\n type NormalizedOptions,\n removeFilesAndEmptyFolders,\n} from '@orval/core';\n\nimport { importSpecs } from './import-specs';\nimport { writeSpecs } from './write-specs';\n\n/**\n * Generate client/spec files for a single Orval project.\n *\n * @param workspace - Absolute or relative workspace path used to resolve imports.\n * @param options - Normalized generation options for this project.\n * @param projectName - Optional project name used in logging output.\n * @returns A promise that resolves once generation (and optional cleaning) completes.\n *\n * @example\n * await generateSpec(process.cwd(), normalizedOptions, 'my-project');\n */\nexport async function generateSpec(\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n) {\n if (options.output.clean) {\n const extraPatterns = Array.isArray(options.output.clean)\n ? options.output.clean\n : [];\n\n if (options.output.target) {\n await removeFilesAndEmptyFolders(\n ['**/*', '!**/*.d.ts', ...extraPatterns],\n getFileInfo(options.output.target).dirname,\n );\n }\n if (options.output.schemas) {\n const schemasPath = isString(options.output.schemas)\n ? options.output.schemas\n : options.output.schemas.path;\n await removeFilesAndEmptyFolders(\n ['**/*', '!**/*.d.ts', ...extraPatterns],\n getFileInfo(schemasPath).dirname,\n );\n }\n log(`${projectName} Cleaning output folder`);\n }\n\n const writeSpecBuilder = await importSpecs(workspace, options, projectName);\n await writeSpecs(writeSpecBuilder, workspace, options, projectName);\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { type Config, type ConfigExternal, isFunction } from '@orval/core';\nimport { createJiti } from 'jiti';\n\n/**\n * Resolve the Orval config file path.\n *\n * @param configFilePath - Optional path to the config file (absolute or relative).\n * @returns The absolute path to the resolved config file.\n * @throws If a provided path does not exist or if no config file is found.\n *\n * @example\n * // explicit path\n * const p = findConfigFile('./orval.config.ts');\n *\n * @example\n * // automatic discovery (searches process.cwd())\n * const p = findConfigFile();\n */\nexport function findConfigFile(configFilePath?: string) {\n if (configFilePath) {\n const absolutePath = path.isAbsolute(configFilePath)\n ? configFilePath\n : path.resolve(process.cwd(), configFilePath);\n\n if (!fs.existsSync(absolutePath))\n throw new Error(`Config file ${configFilePath} does not exist`);\n\n return absolutePath;\n }\n\n const root = process.cwd();\n const exts = ['.ts', '.js', '.mjs', '.mts'];\n for (const ext of exts) {\n const fullPath = path.resolve(root, `orval.config${ext}`);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n throw new Error(`No config file found in ${root}`);\n}\n\n/**\n * Load an Orval config file\n * @param configFilePath - Path to the config file (absolute or relative).\n * @returns The resolved Orval `Config` object.\n * @throws If the module does not provide a default export or the default export resolves to `undefined`.\n *\n * @example\n * // load a config object\n * const cfg = await loadConfigFile('./orval.config.ts');\n */\nexport async function loadConfigFile(configFilePath: string): Promise<Config> {\n const jiti = createJiti(process.cwd(), {\n interopDefault: true,\n });\n\n const configExternal = await jiti.import<ConfigExternal | undefined>(\n configFilePath,\n {\n default: true,\n },\n );\n\n if (configExternal === undefined) {\n throw new Error(`${configFilePath} doesn't have a default export`);\n }\n\n const config = await (isFunction(configExternal)\n ? configExternal()\n : configExternal);\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiCA,MAAM,iBAAiB,aAAa;AAEpC,MAAM,sBACJ,cACA,WACG;CACH,MAAMA,mBAAqC;EACzC,OAAO,MAAM,EAAE,MAAM,SAAS,CAAC,EAAE;EACjC,mBAAmB,MAAM,EAAE,MAAM,mBAAmB,CAAC,EAAE;EACvD,SAAS,SAAS,EAAE;EACpB,iBAAiB,MAAM;GAAE;GAAQ,MAAM;GAAiB,CAAC,EAAE;EAC3D,eAAe,MAAM;GAAE;GAAQ,MAAM;GAAe,CAAC,EAAE;EACvD,eAAe,YAAY,EAAE;EAC7B,eAAe,MAAM;GAAE;GAAQ,MAAM;GAAe,CAAC,EAAE;EACvD,gBAAgB,MAAM;GAAE;GAAQ,MAAM;GAAgB,CAAC,EAAE;EACzD,aAAa,MAAM;GAAE;GAAQ,MAAM;GAAa,CAAC,EAAE;EACnD,KAAK,KAAK,EAAE;EACZ,KAAK,KAAK,EAAE;EACZ,MAAM,MAAM,EAAE;EACd,OAAO,aAAa,EAAE;EACtB,KAAK,KAAK,EAAE;EACb;AAMD,QAJkB,WAAW,aAAa,GACtC,aAAa,iBAAiB,GAC9B,iBAAiB;;AAKvB,MAAaC,yBAAiD,EAC5D,QACA,gBACA,SACA,aACA,cACA,gCACA,kBACA,gBACA,4BACA,aACA,aACI;CACJ,MAAM,EAAE,iBAAiB,mBAAmB,QAAQ,OAAO;AAC3D,QAAO,0BACL,gBACA,eACI,CACE,GAAG,aACD,kBACA,4BACA,aACA,OAAO,YACP,g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,iBAAiB;AAEjE,SAAO;;CAGT,MAAM,OAAO,QAAQ,KAAK;AAE1B,MAAK,MAAM,OADE;EAAC;EAAO;EAAO;EAAQ;EAAO,EACnB;EACtB,MAAM,WAAW,KAAK,QAAQ,MAAM,eAAe,MAAM;AACzD,MAAIA,KAAG,WAAW,SAAS,CACzB,QAAO;;AAIX,OAAM,IAAI,MAAM,2BAA2B,OAAO;;;;;;;;;;;;AAapD,eAAsB,eAAe,gBAAyC;CAK5E,MAAM,iBAAiB,MAJV,WAAW,QAAQ,KAAK,EAAE,EACrC,gBAAgB,MACjB,CAAC,CAEgC,OAChC,gBACA,EACE,SAAS,MACV,CACF;AAED,KAAI,mBAAmB,OACrB,OAAM,IAAI,MAAM,GAAG,eAAe,gCAAgC;AAOpE,QAJe,OAAO,WAAW,eAAe,GAC5C,gBAAgB,GAChB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a as defineConfig, i as startWatcher, n as loadConfigFile, o as normalizeOptions, r as generateSpec, t as findConfigFile } from "./config-
|
|
2
|
-
import { isString, logError } from "@orval/core";
|
|
1
|
+
import { a as defineConfig, i as startWatcher, n as loadConfigFile, o as normalizeOptions, r as generateSpec, t as findConfigFile } from "./config-glSQmAy7.mjs";
|
|
2
|
+
import { isString, logError, setVerbose } from "@orval/core";
|
|
3
3
|
|
|
4
4
|
export * from "@orval/core"
|
|
5
5
|
|
|
6
6
|
//#region src/generate.ts
|
|
7
7
|
async function generate(optionsExport, workspace = process.cwd(), options) {
|
|
8
|
+
setVerbose(!!options?.verbose);
|
|
8
9
|
if (!optionsExport || isString(optionsExport)) {
|
|
9
10
|
const configFile = await loadConfigFile(findConfigFile(optionsExport));
|
|
10
11
|
const configs = Object.entries(configFile);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["normalizedOptions"],"sources":["../src/generate.ts"],"sourcesContent":["import {\n type GlobalOptions,\n isString,\n logError,\n type OptionsExport,\n} from '@orval/core';\n\nimport { generateSpec } from './generate-spec';\nimport { findConfigFile, loadConfigFile } from './utils/config';\nimport { normalizeOptions } from './utils/options';\nimport { startWatcher } from './utils/watcher';\n\nexport async function generate(\n optionsExport?: string | OptionsExport,\n workspace = process.cwd(),\n options?: GlobalOptions,\n) {\n if (!optionsExport || isString(optionsExport)) {\n const configFilePath = findConfigFile(optionsExport);\n const configFile = await loadConfigFile(configFilePath);\n\n const configs = Object.entries(configFile);\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n if (options?.watch === undefined) {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n } else {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors)\n logError('One or more project failed, see above for details');\n\n return;\n }\n\n const normalizedOptions = await normalizeOptions(\n optionsExport,\n workspace,\n options,\n );\n\n if (options?.watch) {\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions);\n } catch (error) {\n logError(error);\n }\n },\n normalizedOptions.input.target as string,\n );\n } else {\n try {\n await generateSpec(workspace, normalizedOptions);\n } catch (error) {\n logError(error);\n }\n }\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["normalizedOptions"],"sources":["../src/generate.ts"],"sourcesContent":["import {\n type GlobalOptions,\n isString,\n logError,\n type OptionsExport,\n setVerbose,\n} from '@orval/core';\n\nimport { generateSpec } from './generate-spec';\nimport { findConfigFile, loadConfigFile } from './utils/config';\nimport { normalizeOptions } from './utils/options';\nimport { startWatcher } from './utils/watcher';\n\nexport async function generate(\n optionsExport?: string | OptionsExport,\n workspace = process.cwd(),\n options?: GlobalOptions,\n) {\n setVerbose(!!options?.verbose);\n\n if (!optionsExport || isString(optionsExport)) {\n const configFilePath = findConfigFile(optionsExport);\n const configFile = await loadConfigFile(configFilePath);\n\n const configs = Object.entries(configFile);\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n if (options?.watch === undefined) {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n } else {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors)\n logError('One or more project failed, see above for details');\n\n return;\n }\n\n const normalizedOptions = await normalizeOptions(\n optionsExport,\n workspace,\n options,\n );\n\n if (options?.watch) {\n await startWatcher(\n options.watch,\n async () => {\n try {\n await generateSpec(workspace, normalizedOptions);\n } catch (error) {\n logError(error);\n }\n },\n normalizedOptions.input.target as string,\n );\n } else {\n try {\n await generateSpec(workspace, normalizedOptions);\n } catch (error) {\n logError(error);\n }\n }\n}\n"],"mappings":";;;;;;AAaA,eAAsB,SACpB,eACA,YAAY,QAAQ,KAAK,EACzB,SACA;AACA,YAAW,CAAC,CAAC,SAAS,QAAQ;AAE9B,KAAI,CAAC,iBAAiB,SAAS,cAAc,EAAE;EAE7C,MAAM,aAAa,MAAM,eADF,eAAe,cAAc,CACG;EAEvD,MAAM,UAAU,OAAO,QAAQ,WAAW;EAE1C,IAAI,YAAY;AAChB,OAAK,MAAM,CAAC,aAAa,WAAW,SAAS;GAC3C,MAAMA,sBAAoB,MAAM,iBAC9B,QACA,WACA,QACD;AAED,OAAI,SAAS,UAAU,OACrB,KAAI;AACF,UAAM,aAAa,WAAWA,qBAAmB,YAAY;YACtD,OAAO;AACd,gBAAY;AACZ,aAAS,OAAO,YAAY;;QAEzB;IACL,MAAM,cAAc,SAASA,oBAAkB,MAAM,OAAO,GACxDA,oBAAkB,MAAM,SACxB;AAEJ,UAAM,aACJ,QAAQ,OACR,YAAY;AACV,SAAI;AACF,YAAM,aAAa,WAAWA,qBAAmB,YAAY;cACtD,OAAO;AACd,eAAS,OAAO,YAAY;;OAGhC,YACD;;;AAIL,MAAI,UACF,UAAS,oDAAoD;AAE/D;;CAGF,MAAM,oBAAoB,MAAM,iBAC9B,eACA,WACA,QACD;AAED,KAAI,SAAS,MACX,OAAM,aACJ,QAAQ,OACR,YAAY;AACV,MAAI;AACF,SAAM,aAAa,WAAW,kBAAkB;WACzC,OAAO;AACd,YAAS,MAAM;;IAGnB,kBAAkB,MAAM,OACzB;KAED,KAAI;AACF,QAAM,aAAa,WAAW,kBAAkB;UACzC,OAAO;AACd,WAAS,MAAM"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orval",
|
|
3
3
|
"description": "A swagger client generator for typescript",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"build": "tsdown --config-loader unrun",
|
|
55
55
|
"dev": "tsdown --config-loader unrun --watch src --onSuccess 'yarn generate-api'",
|
|
56
56
|
"lint": "eslint .",
|
|
57
|
-
"generate-api": "orval --config ../../samples/react-query/
|
|
57
|
+
"generate-api": "orval --config ../../samples/react-query/hook-mutator-fetch/orval.config.ts",
|
|
58
58
|
"test": "vitest",
|
|
59
59
|
"clean": "rimraf .turbo dist",
|
|
60
60
|
"nuke": "rimraf .turbo dist node_modules"
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@commander-js/extra-typings": "^14.0.0",
|
|
73
|
-
"@orval/angular": "8.
|
|
74
|
-
"@orval/axios": "8.
|
|
75
|
-
"@orval/core": "8.
|
|
76
|
-
"@orval/fetch": "8.
|
|
77
|
-
"@orval/hono": "8.
|
|
78
|
-
"@orval/mcp": "8.
|
|
79
|
-
"@orval/mock": "8.
|
|
80
|
-
"@orval/query": "8.
|
|
81
|
-
"@orval/solid-start": "8.
|
|
82
|
-
"@orval/swr": "8.
|
|
83
|
-
"@orval/zod": "8.
|
|
73
|
+
"@orval/angular": "8.4.1",
|
|
74
|
+
"@orval/axios": "8.4.1",
|
|
75
|
+
"@orval/core": "8.4.1",
|
|
76
|
+
"@orval/fetch": "8.4.1",
|
|
77
|
+
"@orval/hono": "8.4.1",
|
|
78
|
+
"@orval/mcp": "8.4.1",
|
|
79
|
+
"@orval/mock": "8.4.1",
|
|
80
|
+
"@orval/query": "8.4.1",
|
|
81
|
+
"@orval/solid-start": "8.4.1",
|
|
82
|
+
"@orval/swr": "8.4.1",
|
|
83
|
+
"@orval/zod": "8.4.1",
|
|
84
84
|
"@scalar/json-magic": "^0.8.8",
|
|
85
85
|
"@scalar/openapi-parser": "^0.23.9",
|
|
86
86
|
"@scalar/openapi-types": "0.5.3",
|
|
@@ -100,6 +100,14 @@
|
|
|
100
100
|
"typedoc-plugin-coverage": "^4.0.2",
|
|
101
101
|
"typedoc-plugin-markdown": "^4.9.0"
|
|
102
102
|
},
|
|
103
|
+
"peerDependencies": {
|
|
104
|
+
"prettier": ">=3.0.0"
|
|
105
|
+
},
|
|
106
|
+
"peerDependenciesMeta": {
|
|
107
|
+
"prettier": {
|
|
108
|
+
"optional": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
103
111
|
"main": "./dist/index.mjs",
|
|
104
112
|
"module": "./dist/index.mjs",
|
|
105
113
|
"types": "./dist/index.d.mts"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-B07NzN_N.mjs","names":["GENERATOR_CLIENT: GeneratorClients","generateClientImports: GeneratorClientImports","generateClientHeader: GeneratorClientHeader","generateClientFooter: GeneratorClientFooter","implementation: string","generateClientTitle: GeneratorClientTitle","generateExtraFiles","schemas: GeneratorSchema[]","context: ContextSpec","validateSpec","out: Record<string, unknown>","refObj: unknown","result: Record<string, unknown>","result","name","version","mock: GlobalMockOptions | ClientMockBuilder | undefined","globalQueryOptions: NormalizedQueryOptions","normalizedOptions: NormalizedOptions","path","query","zod","result: NormalizedHookOptions","hono","pkg.name","pkg.version","description","version","name","context: ContextSpec","implementationPaths: string[]","path","config: Partial<TypeDocOptions>","configPath: string | undefined","fs"],"sources":["../package.json","../src/client.ts","../src/api.ts","../src/import-open-api.ts","../src/import-specs.ts","../src/utils/execute-hook.ts","../src/utils/package-json.ts","../src/utils/tsconfig.ts","../src/utils/options.ts","../src/utils/watcher.ts","../src/write-zod-specs.ts","../src/write-specs.ts","../src/generate-spec.ts","../src/utils/config.ts"],"sourcesContent":["","import angular from '@orval/angular';\nimport axios from '@orval/axios';\nimport {\n asyncReduce,\n type ClientFileBuilder,\n type ClientMockBuilder,\n type ClientMockGeneratorBuilder,\n type ContextSpec,\n generateDependencyImports,\n type GeneratorClientFooter,\n type GeneratorClientHeader,\n type GeneratorClientImports,\n type GeneratorClients,\n type GeneratorClientTitle,\n type GeneratorOperations,\n type GeneratorOptions,\n type GeneratorVerbOptions,\n type GeneratorVerbsOptions,\n isFunction,\n type NormalizedOutputOptions,\n OutputClient,\n type OutputClientFunc,\n pascal,\n} from '@orval/core';\nimport fetchClient from '@orval/fetch';\nimport hono from '@orval/hono';\nimport mcp from '@orval/mcp';\nimport * as mock from '@orval/mock';\nimport query from '@orval/query';\nimport solidStart from '@orval/solid-start';\nimport swr from '@orval/swr';\nimport zod from '@orval/zod';\n\nconst DEFAULT_CLIENT = OutputClient.AXIOS;\n\nconst getGeneratorClient = (\n outputClient: OutputClient | OutputClientFunc,\n output: NormalizedOutputOptions,\n) => {\n const GENERATOR_CLIENT: GeneratorClients = {\n axios: axios({ type: 'axios' })(),\n 'axios-functions': axios({ type: 'axios-functions' })(),\n angular: angular()(),\n 'angular-query': query({ output, type: 'angular-query' })(),\n 'react-query': query({ output, type: 'react-query' })(),\n 'solid-start': solidStart()(),\n 'solid-query': query({ output, type: 'solid-query' })(),\n 'svelte-query': query({ output, type: 'svelte-query' })(),\n 'vue-query': query({ output, type: 'vue-query' })(),\n swr: swr()(),\n zod: zod()(),\n hono: hono()(),\n fetch: fetchClient()(),\n mcp: mcp()(),\n };\n\n const generator = isFunction(outputClient)\n ? outputClient(GENERATOR_CLIENT)\n : GENERATOR_CLIENT[outputClient];\n\n return generator;\n};\n\nexport const generateClientImports: GeneratorClientImports = ({\n client,\n implementation,\n imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n hasGlobalMutator,\n hasTagsMutator,\n hasParamsSerializerOptions,\n packageJson,\n output,\n}) => {\n const { dependencies } = getGeneratorClient(client, output);\n return generateDependencyImports(\n implementation,\n dependencies\n ? [\n ...dependencies(\n hasGlobalMutator,\n hasParamsSerializerOptions,\n packageJson,\n output.httpClient,\n hasTagsMutator,\n output.override,\n ),\n ...imports,\n ]\n : imports,\n projectName,\n hasSchemaDir,\n isAllowSyntheticDefaultImports,\n );\n};\n\nexport const generateClientHeader: GeneratorClientHeader = ({\n outputClient = DEFAULT_CLIENT,\n isRequestOptions,\n isGlobalMutator,\n isMutator,\n provideIn,\n hasAwaitedType,\n titles,\n output,\n verbOptions,\n tag,\n clientImplementation,\n}) => {\n const { header } = getGeneratorClient(outputClient, output);\n return {\n implementation: header\n ? header({\n title: titles.implementation,\n isRequestOptions,\n isGlobalMutator,\n isMutator,\n provideIn,\n hasAwaitedType,\n output,\n verbOptions,\n tag,\n clientImplementation,\n })\n : '',\n implementationMock: `export const ${titles.implementationMock} = () => [\\n`,\n };\n};\n\nexport const generateClientFooter: GeneratorClientFooter = ({\n outputClient,\n operationNames,\n hasMutator,\n hasAwaitedType,\n titles,\n output,\n}) => {\n const { footer } = getGeneratorClient(outputClient, output);\n\n if (!footer) {\n return {\n implementation: '',\n implementationMock: `\\n]\\n`,\n };\n }\n\n let implementation: string;\n try {\n if (isFunction(outputClient)) {\n implementation = (footer as (operationNames: string[]) => string)(\n operationNames,\n );\n // being here means that the previous call worked\n console.warn(\n '[WARN] Passing an array of strings for operations names to the footer function is deprecated and will be removed in a future major release. Please pass them in an object instead: { operationNames: string[] }.',\n );\n } else {\n implementation = footer({\n operationNames,\n title: titles.implementation,\n hasMutator,\n hasAwaitedType,\n });\n }\n } catch {\n implementation = footer({\n operationNames,\n title: titles.implementation,\n hasMutator,\n hasAwaitedType,\n });\n }\n\n return {\n implementation,\n implementationMock: `]\\n`,\n };\n};\n\nexport const generateClientTitle: GeneratorClientTitle = ({\n outputClient = DEFAULT_CLIENT,\n title,\n customTitleFunc,\n output,\n}) => {\n const { title: generatorTitle } = getGeneratorClient(outputClient, output);\n\n if (!generatorTitle) {\n return {\n implementation: '',\n implementationMock: `get${pascal(title)}Mock`,\n };\n }\n\n if (customTitleFunc) {\n const customTitle = customTitleFunc(title);\n return {\n implementation: generatorTitle(customTitle),\n implementationMock: `get${pascal(customTitle)}Mock`,\n };\n }\n return {\n implementation: generatorTitle(title),\n implementationMock: `get${pascal(title)}Mock`,\n };\n};\n\nconst generateMock = (\n verbOption: GeneratorVerbOptions,\n options: GeneratorOptions,\n): ClientMockGeneratorBuilder => {\n if (!options.mock) {\n return {\n implementation: {\n function: '',\n handler: '',\n handlerName: '',\n },\n imports: [],\n };\n }\n\n if (isFunction(options.mock)) {\n return options.mock(verbOption, options);\n }\n\n return mock.generateMock(\n verbOption,\n options as typeof options & {\n mock: Exclude<(typeof options)['mock'], ClientMockBuilder | undefined>;\n },\n );\n};\n\nexport const generateOperations = (\n outputClient: OutputClient | OutputClientFunc = DEFAULT_CLIENT,\n verbsOptions: GeneratorVerbsOptions,\n options: GeneratorOptions,\n output: NormalizedOutputOptions,\n): Promise<GeneratorOperations> => {\n return asyncReduce(\n verbsOptions,\n async (acc, verbOption) => {\n const { client: generatorClient } = getGeneratorClient(\n outputClient,\n output,\n );\n const client = await generatorClient(\n verbOption,\n options,\n outputClient,\n output,\n );\n\n if (!client.implementation) {\n return acc;\n }\n\n const generatedMock = generateMock(verbOption, options);\n\n // Use operationName as key instead of operationId to support multiple\n // content-type variants of the same operation (e.g., WithJson, WithFormData) #2812\n acc[verbOption.operationName] = {\n implementation: verbOption.doc + client.implementation,\n imports: client.imports,\n implementationMock: generatedMock.implementation,\n importsMock: generatedMock.imports,\n tags: verbOption.tags,\n mutator: verbOption.mutator,\n clientMutators: client.mutators,\n formData: verbOption.formData,\n formUrlEncoded: verbOption.formUrlEncoded,\n paramsSerializer: verbOption.paramsSerializer,\n operationName: verbOption.operationName,\n fetchReviver: verbOption.fetchReviver,\n };\n\n return acc;\n },\n {} as GeneratorOperations,\n );\n};\n\nexport const generateExtraFiles = (\n outputClient: OutputClient | OutputClientFunc = DEFAULT_CLIENT,\n verbsOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n): Promise<ClientFileBuilder[]> => {\n const { extraFiles: generateExtraFiles } = getGeneratorClient(\n outputClient,\n output,\n );\n\n if (!generateExtraFiles) {\n return Promise.resolve([]);\n }\n\n return generateExtraFiles(verbsOptions, output, context);\n};\n","import {\n asyncReduce,\n type ContextSpec,\n generateVerbsOptions,\n type GeneratorApiBuilder,\n type GeneratorApiOperations,\n type GeneratorSchema,\n getFullRoute,\n getRoute,\n GetterPropType,\n isReference,\n type NormalizedInputOptions,\n type NormalizedOutputOptions,\n type OpenApiPathItemObject,\n resolveRef,\n} from '@orval/core';\nimport { generateMockImports } from '@orval/mock';\n\nimport {\n generateClientFooter,\n generateClientHeader,\n generateClientImports,\n generateClientTitle,\n generateExtraFiles,\n generateOperations,\n} from './client';\n\nexport async function getApiBuilder({\n input,\n output,\n context,\n}: {\n input: NormalizedInputOptions;\n output: NormalizedOutputOptions;\n context: ContextSpec;\n}): Promise<GeneratorApiBuilder> {\n const api = await asyncReduce(\n Object.entries(context.spec.paths ?? {}),\n async (acc, [pathRoute, verbs]) => {\n const route = getRoute(pathRoute);\n\n let resolvedVerbs = verbs;\n\n if (isReference(verbs)) {\n const { schema } = resolveRef<OpenApiPathItemObject>(verbs, context);\n\n resolvedVerbs = schema;\n }\n\n let verbsOptions = await generateVerbsOptions({\n verbs: resolvedVerbs,\n input,\n output,\n route,\n pathRoute,\n context,\n });\n\n // GitHub #564 check if we want to exclude deprecated operations\n if (output.override.useDeprecatedOperations === false) {\n verbsOptions = verbsOptions.filter((verb) => {\n return !verb.deprecated;\n });\n }\n\n const schemas: GeneratorSchema[] = [];\n for (const {\n queryParams,\n headers,\n body,\n response,\n props,\n } of verbsOptions) {\n schemas.push(\n ...props.flatMap((param) =>\n param.type === GetterPropType.NAMED_PATH_PARAMS ? param.schema : [],\n ),\n );\n if (queryParams) {\n schemas.push(queryParams.schema, ...queryParams.deps);\n }\n if (headers) {\n schemas.push(headers.schema, ...headers.deps);\n }\n\n schemas.push(...body.schemas, ...response.schemas);\n }\n\n const fullRoute = getFullRoute(\n route,\n verbs.servers ?? context.spec.servers,\n output.baseUrl,\n );\n if (!output.target) {\n throw new Error('Output does not have a target');\n }\n const pathOperations = await generateOperations(\n output.client,\n verbsOptions,\n {\n route: fullRoute,\n pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n },\n output,\n );\n\n for (const verbOption of verbsOptions) {\n acc.verbOptions[verbOption.operationId] = verbOption;\n }\n acc.schemas.push(...schemas);\n acc.operations = { ...acc.operations, ...pathOperations };\n\n return acc;\n },\n {\n operations: {},\n verbOptions: {},\n schemas: [],\n } as GeneratorApiOperations,\n );\n\n const extraFiles = await generateExtraFiles(\n output.client,\n api.verbOptions,\n output,\n context,\n );\n\n return {\n operations: api.operations,\n schemas: api.schemas,\n verbOptions: api.verbOptions,\n title: generateClientTitle,\n header: generateClientHeader,\n footer: generateClientFooter,\n imports: generateClientImports,\n importsMock: generateMockImports,\n extraFiles,\n };\n}\n","import {\n type ContextSpec,\n dynamicImport,\n generateComponentDefinition,\n generateParameterDefinition,\n generateSchemasDefinition,\n type ImportOpenApi,\n type InputOptions,\n type NormalizedOutputOptions,\n type OpenApiComponentsObject,\n type OpenApiDocument,\n type OverrideInput,\n type WriteSpecBuilder,\n} from '@orval/core';\nimport { validate } from '@scalar/openapi-parser';\n\nimport { getApiBuilder } from './api';\n\nexport async function importOpenApi({\n spec,\n input,\n output,\n target,\n workspace,\n projectName,\n}: ImportOpenApi): Promise<WriteSpecBuilder> {\n const transformedOpenApi = await applyTransformer(\n spec,\n input.override.transformer,\n workspace,\n );\n\n const schemas = getApiSchemas({\n input,\n output,\n target,\n workspace,\n spec: transformedOpenApi,\n });\n\n const api = await getApiBuilder({\n input,\n output,\n context: {\n projectName,\n target,\n workspace,\n spec: transformedOpenApi,\n output,\n } satisfies ContextSpec,\n });\n\n return {\n ...api,\n schemas: [...schemas, ...api.schemas],\n target,\n // a valid spec will have info\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n info: transformedOpenApi.info!,\n spec: transformedOpenApi,\n };\n}\n\nasync function applyTransformer(\n openApi: OpenApiDocument,\n transformer: OverrideInput['transformer'],\n workspace: string,\n): Promise<OpenApiDocument> {\n const transformerFn = transformer\n ? await dynamicImport(transformer, workspace)\n : undefined;\n\n if (!transformerFn) {\n return openApi;\n }\n\n const transformedOpenApi = transformerFn(openApi);\n\n const { valid, errors } = await validate(transformedOpenApi);\n if (!valid) {\n throw new Error(`Validation failed`, { cause: errors });\n }\n\n return transformedOpenApi;\n}\n\ninterface GetApiSchemasOptions {\n input: InputOptions;\n output: NormalizedOutputOptions;\n workspace: string;\n target: string;\n spec: OpenApiDocument;\n}\n\nfunction getApiSchemas({\n input,\n output,\n target,\n workspace,\n spec,\n}: GetApiSchemasOptions) {\n const context: ContextSpec = {\n target,\n workspace,\n spec,\n output,\n };\n\n const schemaDefinition = generateSchemasDefinition(\n spec.components?.schemas,\n context,\n output.override.components.schemas.suffix,\n input.filters,\n );\n\n const responseDefinition = generateComponentDefinition(\n spec.components?.responses,\n context,\n output.override.components.responses.suffix,\n );\n\n const swaggerResponseDefinition = generateComponentDefinition(\n 'responses' in spec\n ? (spec as { responses?: OpenApiComponentsObject['responses'] }).responses\n : undefined,\n context,\n '',\n );\n\n const bodyDefinition = generateComponentDefinition(\n spec.components?.requestBodies,\n context,\n output.override.components.requestBodies.suffix,\n );\n\n const parameters = generateParameterDefinition(\n spec.components?.parameters,\n context,\n output.override.components.parameters.suffix,\n );\n\n const schemas = [\n ...schemaDefinition,\n ...responseDefinition,\n ...swaggerResponseDefinition,\n ...bodyDefinition,\n ...parameters,\n ];\n\n return schemas;\n}\n","import {\n isObject,\n isString,\n type NormalizedOptions,\n type OpenApiDocument,\n type WriteSpecBuilder,\n} from '@orval/core';\nimport { bundle } from '@scalar/json-magic/bundle';\nimport {\n fetchUrls,\n parseJson,\n parseYaml,\n readFiles,\n} from '@scalar/json-magic/bundle/plugins/node';\nimport { upgrade, validate as validateSpec } from '@scalar/openapi-parser';\n\nimport { importOpenApi } from './import-open-api';\n\nasync function resolveSpec(\n input: string | Record<string, unknown>,\n parserOptions?: {\n headers?: {\n domains: string[];\n headers: Record<string, string>;\n }[];\n },\n): Promise<OpenApiDocument> {\n const data = await bundle(input, {\n plugins: [\n readFiles(),\n fetchUrls({\n headers: parserOptions?.headers,\n }),\n parseJson(),\n parseYaml(),\n ],\n treeShake: true,\n });\n const dereferencedData = dereferenceExternalRef(data);\n const { valid, errors } = await validateSpec(dereferencedData);\n if (!valid) {\n throw new Error('Validation failed', { cause: errors });\n }\n\n const { specification } = upgrade(dereferencedData);\n\n return specification;\n}\n\nexport async function importSpecs(\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n): Promise<WriteSpecBuilder> {\n const { input, output } = options;\n\n const spec = await resolveSpec(input.target, input.parserOptions);\n\n return importOpenApi({\n spec,\n input,\n output,\n target: input.target,\n workspace,\n projectName,\n });\n}\n\n/**\n * The plugins from `@scalar/json-magic` does not dereference $ref.\n * Instead it fetches them and puts them under x-ext, and changes the $ref to point to #x-ext/<name>.\n * This function dereferences those x-ext $ref's.\n */\nexport function dereferenceExternalRef(\n data: Record<string, unknown>,\n): Record<string, unknown> {\n const extensions = (data['x-ext'] ?? {}) as Record<string, unknown>;\n\n const UNWANTED_KEYS = new Set(['$schema', '$id']);\n\n function scrub(obj: unknown): unknown {\n if (obj === null || obj === undefined) return obj;\n if (Array.isArray(obj)) return obj.map((x) => scrub(x));\n if (isObject(obj)) {\n const rec = obj as Record<string, unknown>;\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(rec)) {\n if (UNWANTED_KEYS.has(k)) continue;\n out[k] = scrub(v);\n }\n return out;\n }\n return obj;\n }\n\n function replaceRefs(obj: unknown): unknown {\n if (obj === null || obj === undefined) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((element) => replaceRefs(element));\n }\n\n if (isObject(obj)) {\n const record = obj as Record<string, unknown>;\n\n // Check if this object is a $ref to x-ext\n if ('$ref' in record && isString(record.$ref)) {\n const refValue = record.$ref;\n if (refValue.startsWith('#/x-ext/')) {\n const pathStr = refValue.replace('#/x-ext/', '');\n const parts = pathStr.split('/');\n const extKey = parts.shift();\n if (extKey) {\n let refObj: unknown = extensions[extKey];\n // Traverse remaining path parts inside the extension object\n for (const p of parts) {\n if (\n refObj &&\n (isObject(refObj) || Array.isArray(refObj)) &&\n p in (refObj as Record<string, unknown>)\n ) {\n refObj = (refObj as Record<string, unknown>)[p];\n } else {\n refObj = undefined;\n break;\n }\n }\n\n if (refObj) {\n // Scrub unwanted keys from the extension before inlining\n const cleaned = scrub(refObj);\n // Replace the $ref with the dereferenced (and scrubbed) object\n return replaceRefs(cleaned);\n }\n }\n }\n }\n\n // Recursively process all properties\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(record)) {\n result[key] = replaceRefs(value);\n }\n return result;\n }\n\n return obj;\n }\n\n // Create a new object with dereferenced properties (excluding x-ext)\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n if (key !== 'x-ext') {\n result[key] = replaceRefs(value);\n }\n }\n\n return result;\n}\n","import {\n type Hook,\n type HookOption,\n isFunction,\n isObject,\n isString,\n log,\n logError,\n type NormalizedHookCommand,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { execa } from 'execa';\nimport { parseArgsStringToArgv } from 'string-argv';\n\nexport const executeHook = async (\n name: Hook,\n commands: NormalizedHookCommand = [],\n args: string[] = [],\n) => {\n log(chalk.white(`Running ${name} hook...`));\n\n for (const command of commands) {\n try {\n if (isString(command)) {\n await executeCommand(command, args);\n } else if (isFunction(command)) {\n await command(args);\n } else if (isObject(command)) {\n await executeObjectCommand(command as HookOption, args);\n }\n } catch (error) {\n logError(error, `Failed to run ${name} hook`);\n }\n }\n};\n\nasync function executeCommand(command: string, args: string[]) {\n const [cmd, ..._args] = [...parseArgsStringToArgv(command), ...args];\n\n await execa(cmd, _args);\n}\n\nasync function executeObjectCommand(command: HookOption, args: string[]) {\n if (command.injectGeneratedDirsAndFiles === false) {\n args = [];\n }\n\n if (isString(command.command)) {\n await executeCommand(command.command, args);\n } else if (isFunction(command.command)) {\n await command.command();\n }\n}\n","import {\n dynamicImport,\n isObject,\n isString,\n log,\n type PackageJson,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { findUp, findUpMultiple } from 'find-up';\nimport fs from 'fs-extra';\nimport yaml from 'js-yaml';\n\nimport { normalizePath } from './options';\n\ntype CatalogData = Pick<PackageJson, 'catalog' | 'catalogs'>;\n\nexport const loadPackageJson = async (\n packageJson?: string,\n workspace = process.cwd(),\n): Promise<PackageJson | undefined> => {\n if (!packageJson) {\n const pkgPath = await findUp(['package.json'], { cwd: workspace });\n if (pkgPath) {\n const pkg = await dynamicImport<unknown>(pkgPath, workspace);\n\n if (isPackageJson(pkg)) {\n return await maybeReplaceCatalog(pkg, workspace);\n } else {\n throw new Error('Invalid package.json file');\n }\n }\n return;\n }\n\n const normalizedPath = normalizePath(packageJson, workspace);\n if (fs.existsSync(normalizedPath)) {\n const pkg = await dynamicImport<unknown>(normalizedPath);\n\n if (isPackageJson(pkg)) {\n return await maybeReplaceCatalog(pkg, workspace);\n } else {\n throw new Error(`Invalid package.json file: ${normalizedPath}`);\n }\n }\n return;\n};\n\nconst isPackageJson = (obj: unknown): obj is PackageJson => isObject(obj);\n\nconst hasCatalogReferences = (pkg: PackageJson): boolean => {\n return [\n ...Object.entries(pkg.dependencies ?? {}),\n ...Object.entries(pkg.devDependencies ?? {}),\n ...Object.entries(pkg.peerDependencies ?? {}),\n ].some(([, value]) => isString(value) && value.startsWith('catalog:'));\n};\n\nconst loadPnpmWorkspaceCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePath = await findUp('pnpm-workspace.yaml', { cwd: workspace });\n if (!filePath) return undefined;\n try {\n const file = await fs.readFile(filePath, 'utf8');\n const data = yaml.load(file) as Record<string, unknown> | undefined;\n if (!data?.catalog && !data?.catalogs) return undefined;\n return {\n catalog: data.catalog as CatalogData['catalog'],\n catalogs: data.catalogs as CatalogData['catalogs'],\n };\n } catch {\n return undefined;\n }\n};\n\nconst loadPackageJsonCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePaths = await findUpMultiple('package.json', { cwd: workspace });\n\n for (const filePath of filePaths) {\n try {\n const pkg = (await fs.readJson(filePath)) as Record<string, unknown>;\n if (pkg.catalog || pkg.catalogs) {\n return {\n catalog: pkg.catalog as CatalogData['catalog'],\n catalogs: pkg.catalogs as CatalogData['catalogs'],\n };\n }\n } catch {\n // Continue to next file\n }\n }\n return undefined;\n};\n\nconst loadYarnrcCatalog = async (\n workspace: string,\n): Promise<CatalogData | undefined> => {\n const filePath = await findUp('.yarnrc.yml', { cwd: workspace });\n if (!filePath) return undefined;\n try {\n const file = await fs.readFile(filePath, 'utf8');\n const data = yaml.load(file) as Record<string, unknown> | undefined;\n if (!data?.catalog && !data?.catalogs) return undefined;\n return {\n catalog: data.catalog as CatalogData['catalog'],\n catalogs: data.catalogs as CatalogData['catalogs'],\n };\n } catch {\n return undefined;\n }\n};\n\nconst maybeReplaceCatalog = async (\n pkg: PackageJson,\n workspace: string,\n): Promise<PackageJson> => {\n if (!hasCatalogReferences(pkg)) {\n return pkg;\n }\n\n const catalogData =\n (await loadPnpmWorkspaceCatalog(workspace)) ??\n (await loadPackageJsonCatalog(workspace)) ??\n (await loadYarnrcCatalog(workspace));\n\n if (!catalogData) {\n log(\n `⚠️ ${chalk.yellow('package.json contains catalog: references, but no catalog source was found (checked: pnpm-workspace.yaml, package.json, .yarnrc.yml).')}`,\n );\n return pkg;\n }\n\n performSubstitution(pkg.dependencies, catalogData);\n performSubstitution(pkg.devDependencies, catalogData);\n performSubstitution(pkg.peerDependencies, catalogData);\n\n return pkg;\n};\n\nconst performSubstitution = (\n dependencies: Record<string, string> | undefined,\n catalogData: CatalogData,\n) => {\n if (!dependencies) return;\n for (const [packageName, version] of Object.entries(dependencies)) {\n if (version === 'catalog:' || version === 'catalog:default') {\n if (!catalogData.catalog) {\n log(\n `⚠️ ${chalk.yellow(`catalog: substitution for the package '${packageName}' failed as there is no default catalog.`)}`,\n );\n continue;\n }\n const sub = catalogData.catalog[packageName];\n if (!sub) {\n log(\n `⚠️ ${chalk.yellow(`catalog: substitution for the package '${packageName}' failed as there is no matching package in the default catalog.`)}`,\n );\n continue;\n }\n dependencies[packageName] = sub;\n } else if (version.startsWith('catalog:')) {\n const catalogName = version.slice('catalog:'.length);\n const catalog = catalogData.catalogs?.[catalogName];\n if (!catalog) {\n log(\n `⚠️ ${chalk.yellow(`'${version}' substitution for the package '${packageName}' failed as there is no matching catalog named '${catalogName}'. (available named catalogs are: ${Object.keys(catalogData.catalogs ?? {}).join(', ')})`)}`,\n );\n continue;\n }\n const sub = catalog[packageName];\n if (!sub) {\n log(\n `⚠️ ${chalk.yellow(`'${version}' substitution for the package '${packageName}' failed as there is no package in the catalog named '${catalogName}'. (packages in the catalog are: ${Object.keys(catalog).join(', ')})`)}`,\n );\n continue;\n }\n dependencies[packageName] = sub;\n }\n }\n};\n","import { isNullish, isObject, isString, type Tsconfig } from '@orval/core';\nimport { findUp } from 'find-up';\nimport fs from 'fs-extra';\nimport { parse } from 'tsconfck';\n\nimport { normalizePath } from './options';\n\nexport const loadTsconfig = async (\n tsconfig?: Tsconfig | string,\n workspace = process.cwd(),\n): Promise<Tsconfig | undefined> => {\n if (isNullish(tsconfig)) {\n const configPath = await findUp(['tsconfig.json', 'jsconfig.json'], {\n cwd: workspace,\n });\n if (configPath) {\n const config = await parse(configPath);\n return config.tsconfig as Tsconfig;\n }\n return;\n }\n\n if (isString(tsconfig)) {\n const normalizedPath = normalizePath(tsconfig, workspace);\n if (fs.existsSync(normalizedPath)) {\n const config = await parse(normalizedPath);\n\n const tsconfig = (config.referenced?.find(\n ({ tsconfigFile }) => tsconfigFile === normalizedPath,\n )?.tsconfig ?? config.tsconfig) as Tsconfig;\n\n return tsconfig;\n }\n return;\n }\n\n if (isObject(tsconfig)) {\n return tsconfig;\n }\n return;\n};\n","import {\n type ClientMockBuilder,\n type ConfigExternal,\n createLogger,\n FormDataArrayHandling,\n type GlobalMockOptions,\n type GlobalOptions,\n type HonoOptions,\n type Hook,\n type HookFunction,\n type HookOption,\n type HooksOptions,\n isBoolean,\n isFunction,\n isNullish,\n isObject,\n isString,\n isUrl,\n type JsDocOptions,\n type Mutator,\n NamingConvention,\n type NormalizedHonoOptions,\n type NormalizedHookOptions,\n type NormalizedJsDocOptions,\n type NormalizedMutator,\n type NormalizedOperationOptions,\n type NormalizedOptions,\n type NormalizedOverrideOutput,\n type NormalizedQueryOptions,\n type NormalizedSchemaOptions,\n type OperationOptions,\n type OptionsExport,\n OutputClient,\n OutputHttpClient,\n OutputMode,\n type OverrideOutput,\n PropertySortOrder,\n type QueryOptions,\n RefComponentSuffix,\n type SchemaOptions,\n upath,\n} from '@orval/core';\nimport { DEFAULT_MOCK_OPTIONS } from '@orval/mock';\nimport chalk from 'chalk';\n\nimport pkg from '../../package.json';\nimport { loadPackageJson } from './package-json';\nimport { loadTsconfig } from './tsconfig';\n\n/**\n * Type helper to make it easier to use orval.config.ts\n * accepts a direct {@link ConfigExternal} object.\n */\nexport function defineConfig(options: ConfigExternal): ConfigExternal {\n return options;\n}\n\nfunction createFormData(\n workspace: string,\n formData: OverrideOutput['formData'],\n): NormalizedOverrideOutput['formData'] {\n const defaultArrayHandling = FormDataArrayHandling.SERIALIZE;\n if (formData === undefined)\n return { disabled: false, arrayHandling: defaultArrayHandling };\n if (isBoolean(formData))\n return { disabled: !formData, arrayHandling: defaultArrayHandling };\n if (isString(formData))\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData),\n arrayHandling: defaultArrayHandling,\n };\n if ('mutator' in formData || 'arrayHandling' in formData)\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData.mutator),\n arrayHandling: formData.arrayHandling ?? defaultArrayHandling,\n };\n return {\n disabled: false,\n mutator: normalizeMutator(workspace, formData),\n arrayHandling: defaultArrayHandling,\n };\n}\n\nfunction normalizeSchemasOption(\n schemas: string | SchemaOptions | undefined,\n workspace: string,\n): string | NormalizedSchemaOptions | undefined {\n if (!schemas) {\n return undefined;\n }\n\n if (isString(schemas)) {\n return normalizePath(schemas, workspace);\n }\n\n return {\n path: normalizePath(schemas.path, workspace),\n type: schemas.type,\n };\n}\n\nexport async function normalizeOptions(\n optionsExport: OptionsExport,\n workspace = process.cwd(),\n globalOptions: GlobalOptions = {},\n): Promise<NormalizedOptions> {\n const options = await (isFunction(optionsExport)\n ? optionsExport()\n : optionsExport);\n\n if (!options.input) {\n throw new Error(chalk.red(`Config require an input`));\n }\n\n if (!options.output) {\n throw new Error(chalk.red(`Config require an output`));\n }\n\n const inputOptions = isString(options.input)\n ? { target: options.input }\n : options.input;\n\n const outputOptions = isString(options.output)\n ? { target: options.output }\n : options.output;\n\n const outputWorkspace = normalizePath(\n outputOptions.workspace ?? '',\n workspace,\n );\n\n const { clean, prettier, client, httpClient, mode, biome } = globalOptions;\n\n const tsconfig = await loadTsconfig(\n outputOptions.tsconfig ?? globalOptions.tsconfig,\n workspace,\n );\n\n const packageJson = await loadPackageJson(\n outputOptions.packageJson ?? globalOptions.packageJson,\n workspace,\n );\n\n const mockOption = outputOptions.mock ?? globalOptions.mock;\n let mock: GlobalMockOptions | ClientMockBuilder | undefined;\n if (isBoolean(mockOption) && mockOption) {\n mock = DEFAULT_MOCK_OPTIONS;\n } else if (isFunction(mockOption)) {\n mock = mockOption;\n } else if (mockOption) {\n mock = {\n ...DEFAULT_MOCK_OPTIONS,\n ...mockOption,\n };\n } else {\n mock = undefined;\n }\n\n const defaultFileExtension = '.ts';\n\n const globalQueryOptions: NormalizedQueryOptions = {\n useQuery: true,\n useMutation: true,\n signal: true,\n shouldExportMutatorHooks: true,\n shouldExportHttpClient: true,\n shouldExportQueryKey: true,\n shouldSplitQueryKey: false,\n ...normalizeQueryOptions(outputOptions.override?.query, workspace),\n };\n\n const normalizedOptions: NormalizedOptions = {\n input: {\n target: globalOptions.input\n ? normalizePathOrUrl(globalOptions.input, process.cwd())\n : normalizePathOrUrl(inputOptions.target, workspace),\n override: {\n transformer: normalizePath(\n inputOptions.override?.transformer,\n workspace,\n ),\n },\n filters: inputOptions.filters,\n parserOptions: inputOptions.parserOptions,\n },\n output: {\n target: globalOptions.output\n ? normalizePath(globalOptions.output, process.cwd())\n : normalizePath(outputOptions.target, outputWorkspace),\n schemas: normalizeSchemasOption(outputOptions.schemas, outputWorkspace),\n operationSchemas: outputOptions.operationSchemas\n ? normalizePath(outputOptions.operationSchemas, outputWorkspace)\n : undefined,\n namingConvention:\n outputOptions.namingConvention ?? NamingConvention.CAMEL_CASE,\n fileExtension: outputOptions.fileExtension ?? defaultFileExtension,\n workspace: outputOptions.workspace ? outputWorkspace : undefined,\n client: outputOptions.client ?? client ?? OutputClient.AXIOS_FUNCTIONS,\n httpClient:\n outputOptions.httpClient ??\n httpClient ??\n // Auto-detect: use Angular HttpClient for angular-query by default\n ((outputOptions.client ?? client) === OutputClient.ANGULAR_QUERY\n ? OutputHttpClient.ANGULAR\n : OutputHttpClient.FETCH),\n mode: normalizeOutputMode(outputOptions.mode ?? mode),\n mock,\n clean: outputOptions.clean ?? clean ?? false,\n docs: outputOptions.docs ?? false,\n prettier: outputOptions.prettier ?? prettier ?? false,\n biome: outputOptions.biome ?? biome ?? false,\n tsconfig,\n packageJson,\n headers: outputOptions.headers ?? false,\n indexFiles: outputOptions.indexFiles ?? true,\n baseUrl: outputOptions.baseUrl,\n unionAddMissingProperties:\n outputOptions.unionAddMissingProperties ?? false,\n override: {\n ...outputOptions.override,\n mock: {\n arrayMin: outputOptions.override?.mock?.arrayMin ?? 1,\n arrayMax: outputOptions.override?.mock?.arrayMax ?? 10,\n stringMin: outputOptions.override?.mock?.stringMin ?? 10,\n stringMax: outputOptions.override?.mock?.stringMax ?? 20,\n fractionDigits: outputOptions.override?.mock?.fractionDigits ?? 2,\n ...outputOptions.override?.mock,\n },\n operations: normalizeOperationsAndTags(\n outputOptions.override?.operations ?? {},\n outputWorkspace,\n {\n query: globalQueryOptions,\n },\n ),\n tags: normalizeOperationsAndTags(\n outputOptions.override?.tags ?? {},\n outputWorkspace,\n {\n query: globalQueryOptions,\n },\n ),\n mutator: normalizeMutator(\n outputWorkspace,\n outputOptions.override?.mutator,\n ),\n formData: createFormData(\n outputWorkspace,\n outputOptions.override?.formData,\n ),\n formUrlEncoded:\n (isBoolean(outputOptions.override?.formUrlEncoded)\n ? outputOptions.override.formUrlEncoded\n : normalizeMutator(\n outputWorkspace,\n outputOptions.override?.formUrlEncoded,\n )) ?? true,\n paramsSerializer: normalizeMutator(\n outputWorkspace,\n outputOptions.override?.paramsSerializer,\n ),\n header:\n outputOptions.override?.header === false\n ? false\n : isFunction(outputOptions.override?.header)\n ? outputOptions.override.header\n : getDefaultFilesHeader,\n requestOptions: outputOptions.override?.requestOptions ?? true,\n namingConvention: outputOptions.override?.namingConvention ?? {},\n components: {\n schemas: {\n suffix: RefComponentSuffix.schemas,\n itemSuffix:\n outputOptions.override?.components?.schemas?.itemSuffix ?? 'Item',\n ...outputOptions.override?.components?.schemas,\n },\n responses: {\n suffix: RefComponentSuffix.responses,\n ...outputOptions.override?.components?.responses,\n },\n parameters: {\n suffix: RefComponentSuffix.parameters,\n ...outputOptions.override?.components?.parameters,\n },\n requestBodies: {\n suffix: RefComponentSuffix.requestBodies,\n ...outputOptions.override?.components?.requestBodies,\n },\n },\n hono: normalizeHonoOptions(outputOptions.override?.hono, workspace),\n jsDoc: normalizeJSDocOptions(outputOptions.override?.jsDoc),\n query: globalQueryOptions,\n zod: {\n strict: {\n param: outputOptions.override?.zod?.strict?.param ?? false,\n query: outputOptions.override?.zod?.strict?.query ?? false,\n header: outputOptions.override?.zod?.strict?.header ?? false,\n body: outputOptions.override?.zod?.strict?.body ?? false,\n response: outputOptions.override?.zod?.strict?.response ?? false,\n },\n generate: {\n param: outputOptions.override?.zod?.generate?.param ?? true,\n query: outputOptions.override?.zod?.generate?.query ?? true,\n header: outputOptions.override?.zod?.generate?.header ?? true,\n body: outputOptions.override?.zod?.generate?.body ?? true,\n response: outputOptions.override?.zod?.generate?.response ?? true,\n },\n coerce: {\n param: outputOptions.override?.zod?.coerce?.param ?? false,\n query: outputOptions.override?.zod?.coerce?.query ?? false,\n header: outputOptions.override?.zod?.coerce?.header ?? false,\n body: outputOptions.override?.zod?.coerce?.body ?? false,\n response: outputOptions.override?.zod?.coerce?.response ?? false,\n },\n preprocess: {\n ...(outputOptions.override?.zod?.preprocess?.param\n ? {\n param: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.param,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.query\n ? {\n query: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.query,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.header\n ? {\n header: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.header,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.body\n ? {\n body: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.body,\n ),\n }\n : {}),\n ...(outputOptions.override?.zod?.preprocess?.response\n ? {\n response: normalizeMutator(\n workspace,\n outputOptions.override.zod.preprocess.response,\n ),\n }\n : {}),\n },\n generateEachHttpStatus:\n outputOptions.override?.zod?.generateEachHttpStatus ?? false,\n dateTimeOptions: outputOptions.override?.zod?.dateTimeOptions ?? {},\n timeOptions: outputOptions.override?.zod?.timeOptions ?? {},\n },\n swr: {\n generateErrorTypes: false,\n ...outputOptions.override?.swr,\n },\n angular: {\n provideIn: outputOptions.override?.angular?.provideIn ?? 'root',\n },\n fetch: {\n includeHttpResponseReturnType:\n outputOptions.override?.fetch?.includeHttpResponseReturnType ??\n true,\n forceSuccessResponse:\n outputOptions.override?.fetch?.forceSuccessResponse ?? false,\n runtimeValidation:\n outputOptions.override?.fetch?.runtimeValidation ?? false,\n ...outputOptions.override?.fetch,\n },\n useDates: outputOptions.override?.useDates ?? false,\n useDeprecatedOperations:\n outputOptions.override?.useDeprecatedOperations ?? true,\n enumGenerationType:\n outputOptions.override?.enumGenerationType ?? 'const',\n suppressReadonlyModifier:\n outputOptions.override?.suppressReadonlyModifier ?? false,\n aliasCombinedTypes: outputOptions.override?.aliasCombinedTypes ?? false,\n },\n allParamsOptional: outputOptions.allParamsOptional ?? false,\n urlEncodeParameters: outputOptions.urlEncodeParameters ?? false,\n optionsParamRequired: outputOptions.optionsParamRequired ?? false,\n propertySortOrder:\n outputOptions.propertySortOrder ?? PropertySortOrder.SPECIFICATION,\n },\n hooks: options.hooks ? normalizeHooks(options.hooks) : {},\n };\n\n if (!normalizedOptions.input.target) {\n throw new Error(chalk.red(`Config require an input target`));\n }\n\n if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) {\n throw new Error(chalk.red(`Config require an output target or schemas`));\n }\n\n return normalizedOptions;\n}\n\nfunction normalizeMutator(\n workspace: string,\n mutator?: Mutator,\n): NormalizedMutator | undefined {\n if (isObject(mutator)) {\n if (!mutator.path) {\n throw new Error(chalk.red(`Mutator need a path`));\n }\n\n return {\n ...mutator,\n path: upath.resolve(workspace, mutator.path),\n default: mutator.default ?? !mutator.name,\n };\n }\n\n if (isString(mutator)) {\n return {\n path: upath.resolve(workspace, mutator),\n default: true,\n };\n }\n\n return mutator;\n}\n\nfunction normalizePathOrUrl<T>(path: T, workspace: string) {\n if (isString(path) && !isUrl(path)) {\n return normalizePath(path, workspace);\n }\n\n return path;\n}\n\nexport function normalizePath<T>(path: T, workspace: string) {\n if (!isString(path)) {\n return path;\n }\n return upath.resolve(workspace, path);\n}\n\nfunction normalizeOperationsAndTags(\n operationsOrTags: Record<string, OperationOptions>,\n workspace: string,\n global: {\n query: NormalizedQueryOptions;\n },\n): Record<string, NormalizedOperationOptions> {\n return Object.fromEntries(\n Object.entries(operationsOrTags).map(\n ([\n key,\n {\n transformer,\n mutator,\n formData,\n formUrlEncoded,\n paramsSerializer,\n query,\n zod,\n ...rest\n },\n ]) => {\n return [\n key,\n {\n ...rest,\n ...(query\n ? {\n query: normalizeQueryOptions(query, workspace, global.query),\n }\n : {}),\n ...(zod\n ? {\n zod: {\n strict: {\n param: zod.strict?.param ?? false,\n query: zod.strict?.query ?? false,\n header: zod.strict?.header ?? false,\n body: zod.strict?.body ?? false,\n response: zod.strict?.response ?? false,\n },\n generate: {\n param: zod.generate?.param ?? true,\n query: zod.generate?.query ?? true,\n header: zod.generate?.header ?? true,\n body: zod.generate?.body ?? true,\n response: zod.generate?.response ?? true,\n },\n coerce: {\n param: zod.coerce?.param ?? false,\n query: zod.coerce?.query ?? false,\n header: zod.coerce?.header ?? false,\n body: zod.coerce?.body ?? false,\n response: zod.coerce?.response ?? false,\n },\n preprocess: {\n ...(zod.preprocess?.param\n ? {\n param: normalizeMutator(\n workspace,\n zod.preprocess.param,\n ),\n }\n : {}),\n ...(zod.preprocess?.query\n ? {\n query: normalizeMutator(\n workspace,\n zod.preprocess.query,\n ),\n }\n : {}),\n ...(zod.preprocess?.header\n ? {\n header: normalizeMutator(\n workspace,\n zod.preprocess.header,\n ),\n }\n : {}),\n ...(zod.preprocess?.body\n ? {\n body: normalizeMutator(\n workspace,\n zod.preprocess.body,\n ),\n }\n : {}),\n ...(zod.preprocess?.response\n ? {\n response: normalizeMutator(\n workspace,\n zod.preprocess.response,\n ),\n }\n : {}),\n },\n generateEachHttpStatus: zod.generateEachHttpStatus ?? false,\n dateTimeOptions: zod.dateTimeOptions ?? {},\n timeOptions: zod.timeOptions ?? {},\n },\n }\n : {}),\n ...(transformer\n ? { transformer: normalizePath(transformer, workspace) }\n : {}),\n ...(mutator\n ? { mutator: normalizeMutator(workspace, mutator) }\n : {}),\n ...createFormData(workspace, formData),\n ...(formUrlEncoded\n ? {\n formUrlEncoded: isBoolean(formUrlEncoded)\n ? formUrlEncoded\n : normalizeMutator(workspace, formUrlEncoded),\n }\n : {}),\n ...(paramsSerializer\n ? {\n paramsSerializer: normalizeMutator(\n workspace,\n paramsSerializer,\n ),\n }\n : {}),\n },\n ];\n },\n ),\n );\n}\n\nfunction normalizeOutputMode(mode?: OutputMode): OutputMode {\n if (!mode) {\n return OutputMode.SINGLE;\n }\n\n if (!Object.values(OutputMode).includes(mode)) {\n createLogger().warn(chalk.yellow(`Unknown the provided mode => ${mode}`));\n return OutputMode.SINGLE;\n }\n\n return mode;\n}\n\nfunction normalizeHooks(hooks: HooksOptions): NormalizedHookOptions {\n const keys = Object.keys(hooks) as unknown as Hook[];\n\n const result: NormalizedHookOptions = {};\n for (const key of keys) {\n if (isString(hooks[key])) {\n result[key] = [hooks[key]] as string[];\n } else if (Array.isArray(hooks[key])) {\n result[key] = hooks[key] as string[];\n } else if (isFunction(hooks[key])) {\n result[key] = [hooks[key]] as HookFunction[];\n } else if (isObject(hooks[key])) {\n result[key] = [hooks[key]] as HookOption[];\n }\n }\n return result;\n}\n\nfunction normalizeHonoOptions(\n hono: HonoOptions = {},\n workspace: string,\n): NormalizedHonoOptions {\n return {\n ...(hono.handlers\n ? { handlers: upath.resolve(workspace, hono.handlers) }\n : {}),\n compositeRoute: hono.compositeRoute ?? '',\n validator: hono.validator ?? true,\n validatorOutputPath: hono.validatorOutputPath\n ? upath.resolve(workspace, hono.validatorOutputPath)\n : '',\n };\n}\n\nfunction normalizeJSDocOptions(\n jsdoc: JsDocOptions = {},\n): NormalizedJsDocOptions {\n return {\n ...jsdoc,\n };\n}\n\nfunction normalizeQueryOptions(\n queryOptions: QueryOptions = {},\n outputWorkspace: string,\n globalOptions: NormalizedQueryOptions = {},\n): NormalizedQueryOptions {\n if (queryOptions.options) {\n console.warn(\n '[WARN] Using query options is deprecated and will be removed in a future major release. Please use queryOptions or mutationOptions instead.',\n );\n }\n\n return {\n ...(isNullish(queryOptions.usePrefetch)\n ? {}\n : { usePrefetch: queryOptions.usePrefetch }),\n ...(isNullish(queryOptions.useInvalidate)\n ? {}\n : { useInvalidate: queryOptions.useInvalidate }),\n ...(isNullish(queryOptions.useQuery)\n ? {}\n : { useQuery: queryOptions.useQuery }),\n ...(isNullish(queryOptions.useSuspenseQuery)\n ? {}\n : { useSuspenseQuery: queryOptions.useSuspenseQuery }),\n ...(isNullish(queryOptions.useMutation)\n ? {}\n : { useMutation: queryOptions.useMutation }),\n ...(isNullish(queryOptions.useInfinite)\n ? {}\n : { useInfinite: queryOptions.useInfinite }),\n ...(isNullish(queryOptions.useSuspenseInfiniteQuery)\n ? {}\n : { useSuspenseInfiniteQuery: queryOptions.useSuspenseInfiniteQuery }),\n ...(queryOptions.useInfiniteQueryParam\n ? { useInfiniteQueryParam: queryOptions.useInfiniteQueryParam }\n : {}),\n ...(queryOptions.options ? { options: queryOptions.options } : {}),\n ...(globalOptions.queryKey\n ? {\n queryKey: globalOptions.queryKey,\n }\n : {}),\n ...(queryOptions.queryKey\n ? {\n queryKey: normalizeMutator(outputWorkspace, queryOptions.queryKey),\n }\n : {}),\n ...(globalOptions.queryOptions\n ? {\n queryOptions: globalOptions.queryOptions,\n }\n : {}),\n ...(queryOptions.queryOptions\n ? {\n queryOptions: normalizeMutator(\n outputWorkspace,\n queryOptions.queryOptions,\n ),\n }\n : {}),\n ...(globalOptions.mutationOptions\n ? {\n mutationOptions: globalOptions.mutationOptions,\n }\n : {}),\n ...(queryOptions.mutationOptions\n ? {\n mutationOptions: normalizeMutator(\n outputWorkspace,\n queryOptions.mutationOptions,\n ),\n }\n : {}),\n ...(isNullish(globalOptions.shouldExportQueryKey)\n ? {}\n : {\n shouldExportQueryKey: globalOptions.shouldExportQueryKey,\n }),\n ...(isNullish(queryOptions.shouldExportQueryKey)\n ? {}\n : { shouldExportQueryKey: queryOptions.shouldExportQueryKey }),\n ...(isNullish(globalOptions.shouldExportHttpClient)\n ? {}\n : {\n shouldExportHttpClient: globalOptions.shouldExportHttpClient,\n }),\n ...(isNullish(queryOptions.shouldExportHttpClient)\n ? {}\n : { shouldExportHttpClient: queryOptions.shouldExportHttpClient }),\n ...(isNullish(globalOptions.shouldExportMutatorHooks)\n ? {}\n : {\n shouldExportMutatorHooks: globalOptions.shouldExportMutatorHooks,\n }),\n ...(isNullish(queryOptions.shouldExportMutatorHooks)\n ? {}\n : { shouldExportMutatorHooks: queryOptions.shouldExportMutatorHooks }),\n ...(isNullish(globalOptions.shouldSplitQueryKey)\n ? {}\n : {\n shouldSplitQueryKey: globalOptions.shouldSplitQueryKey,\n }),\n ...(isNullish(queryOptions.shouldSplitQueryKey)\n ? {}\n : { shouldSplitQueryKey: queryOptions.shouldSplitQueryKey }),\n ...(isNullish(globalOptions.signal)\n ? {}\n : {\n signal: globalOptions.signal,\n }),\n ...(isNullish(globalOptions.useOperationIdAsQueryKey)\n ? {}\n : {\n useOperationIdAsQueryKey: globalOptions.useOperationIdAsQueryKey,\n }),\n ...(isNullish(queryOptions.useOperationIdAsQueryKey)\n ? {}\n : { useOperationIdAsQueryKey: queryOptions.useOperationIdAsQueryKey }),\n ...(isNullish(globalOptions.signal)\n ? {}\n : {\n signal: globalOptions.signal,\n }),\n ...(isNullish(queryOptions.signal) ? {} : { signal: queryOptions.signal }),\n ...(isNullish(globalOptions.version)\n ? {}\n : {\n version: globalOptions.version,\n }),\n ...(isNullish(queryOptions.version)\n ? {}\n : { version: queryOptions.version }),\n ...(queryOptions.mutationInvalidates\n ? { mutationInvalidates: queryOptions.mutationInvalidates }\n : {}),\n ...(isNullish(globalOptions.runtimeValidation)\n ? {}\n : {\n runtimeValidation: globalOptions.runtimeValidation,\n }),\n ...(isNullish(queryOptions.runtimeValidation)\n ? {}\n : { runtimeValidation: queryOptions.runtimeValidation }),\n };\n}\n\nexport function getDefaultFilesHeader({\n title,\n description,\n version,\n}: {\n title?: string;\n description?: string;\n version?: string;\n} = {}) {\n return [\n `Generated by ${pkg.name} v${pkg.version} 🍺`,\n `Do not edit manually.`,\n ...(title ? [title] : []),\n ...(description ? [description] : []),\n ...(version ? [`OpenAPI spec version: ${version}`] : []),\n ];\n}\n","import { isBoolean, log, logError } from '@orval/core';\n\n/**\n * Start a file watcher and invoke an async callback on file changes.\n *\n * If `watchOptions` is falsy the watcher is not started. Supported shapes:\n * - boolean: when true the `defaultTarget` is watched\n * - string: a single path to watch\n * - string[]: an array of paths to watch\n *\n * @param watchOptions - false to disable watching, or a path/paths to watch\n * @param watchFn - async callback executed on change events\n * @param defaultTarget - path(s) to watch when `watchOptions` is `true` (default: '.')\n * @returns Resolves once the watcher has been started (or immediately if disabled)\n *\n * @example\n * await startWatcher(true, async () => { await buildProject(); }, 'src');\n */\nexport async function startWatcher(\n watchOptions: boolean | string | string[],\n watchFn: () => Promise<void>,\n defaultTarget: string | string[] = '.',\n) {\n if (!watchOptions) return;\n const { watch } = await import('chokidar');\n\n const ignored = ['**/{.git,node_modules}/**'];\n\n const watchPaths = isBoolean(watchOptions) ? defaultTarget : watchOptions;\n\n log(\n `Watching for changes in ${\n Array.isArray(watchPaths)\n ? watchPaths.map((v) => '\"' + v + '\"').join(' | ')\n : '\"' + watchPaths + '\"'\n }`,\n );\n\n const watcher = watch(watchPaths, {\n ignorePermissionErrors: true,\n ignored,\n });\n watcher.on('all', (type, file) => {\n log(`Change detected: ${type} ${file}`);\n\n watchFn().catch((error: unknown) => {\n logError(error);\n });\n });\n}\n","import {\n type ContextSpec,\n conventionName,\n type GeneratorVerbOptions,\n type NamingConvention,\n type NormalizedOutputOptions,\n type OpenApiParameterObject,\n type OpenApiReferenceObject,\n type OpenApiRequestBodyObject,\n type OpenApiSchemaObject,\n pascal,\n upath,\n type WriteSpecBuilder,\n} from '@orval/core';\nimport {\n dereference,\n generateZodValidationSchemaDefinition,\n isZodVersionV4,\n parseZodValidationSchemaDefinition,\n} from '@orval/zod';\nimport fs from 'fs-extra';\n\nfunction generateZodSchemaFileContent(\n header: string,\n schemaName: string,\n zodContent: string,\n): string {\n return `${header}import { z as zod } from 'zod';\n\nexport const ${schemaName} = ${zodContent}\n\nexport type ${schemaName} = zod.infer<typeof ${schemaName}>;\n`;\n}\n\nasync function writeZodSchemaIndex(\n schemasPath: string,\n fileExtension: string,\n header: string,\n schemaNames: string[],\n namingConvention: NamingConvention,\n shouldMergeExisting = false,\n) {\n const importFileExtension = fileExtension.replace(/\\.ts$/, '');\n const indexPath = upath.join(schemasPath, `index${fileExtension}`);\n\n let existingExports = '';\n if (shouldMergeExisting && (await fs.pathExists(indexPath))) {\n const existingContent = await fs.readFile(indexPath, 'utf8');\n const headerMatch = /^(\\/\\*\\*[\\s\\S]*?\\*\\/\\n)?/.exec(existingContent);\n const headerPart = headerMatch ? headerMatch[0] : '';\n existingExports = existingContent.slice(headerPart.length).trim();\n }\n\n const newExports = schemaNames\n .map((schemaName) => {\n const fileName = conventionName(schemaName, namingConvention);\n return `export * from './${fileName}${importFileExtension}';`;\n })\n .toSorted()\n .join('\\n');\n\n const allExports = existingExports\n ? `${existingExports}\\n${newExports}`\n : newExports;\n\n const uniqueExports = [...new Set(allExports.split('\\n'))]\n .filter((line) => line.trim())\n .toSorted()\n .join('\\n');\n\n await fs.outputFile(indexPath, `${header}\\n${uniqueExports}\\n`);\n}\n\nexport async function writeZodSchemas(\n builder: WriteSpecBuilder,\n schemasPath: string,\n fileExtension: string,\n header: string,\n output: NormalizedOutputOptions,\n) {\n const schemasWithOpenApiDef = builder.schemas.filter((s) => s.schema);\n\n await Promise.all(\n schemasWithOpenApiDef.map(async (generatorSchema) => {\n const { name, schema: schemaObject } = generatorSchema;\n\n if (!schemaObject) {\n return;\n }\n\n const fileName = conventionName(name, output.namingConvention);\n const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);\n const context: ContextSpec = {\n spec: builder.spec,\n target: builder.target,\n workspace: '',\n output,\n };\n\n const isZodV4 =\n !!output.packageJson && isZodVersionV4(output.packageJson);\n const strict = output.override.zod.strict.body;\n const coerce = output.override.zod.coerce.body;\n\n // Dereference the schema to resolve $ref\n const dereferencedSchema = dereference(schemaObject, context);\n\n const zodDefinition = generateZodValidationSchemaDefinition(\n dereferencedSchema,\n context,\n name,\n strict,\n isZodV4,\n {\n required: true,\n },\n );\n\n const parsedZodDefinition = parseZodValidationSchemaDefinition(\n zodDefinition,\n context,\n coerce,\n strict,\n isZodV4,\n );\n\n const zodContent = parsedZodDefinition.consts\n ? `${parsedZodDefinition.consts}\\n${parsedZodDefinition.zod}`\n : parsedZodDefinition.zod;\n\n const fileContent = generateZodSchemaFileContent(\n header,\n name,\n zodContent,\n );\n\n await fs.outputFile(filePath, fileContent);\n }),\n );\n\n if (output.indexFiles) {\n const schemaNames = schemasWithOpenApiDef.map((schema) => schema.name);\n await writeZodSchemaIndex(\n schemasPath,\n fileExtension,\n header,\n schemaNames,\n output.namingConvention,\n false,\n );\n }\n}\n\nexport async function writeZodSchemasFromVerbs(\n verbOptions: Record<string, GeneratorVerbOptions>,\n schemasPath: string,\n fileExtension: string,\n header: string,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) {\n const verbOptionsArray = Object.values(verbOptions);\n\n if (verbOptionsArray.length === 0) {\n return;\n }\n\n const isZodV4 = !!output.packageJson && isZodVersionV4(output.packageJson);\n const strict = output.override.zod.strict.body;\n const coerce = output.override.zod.coerce.body;\n\n const generateVerbsSchemas = verbOptionsArray.flatMap((verbOption) => {\n const operation = verbOption.originalOperation;\n\n const requestBody = operation.requestBody as\n | OpenApiRequestBodyObject\n | OpenApiReferenceObject\n | undefined;\n const requestBodyContent =\n requestBody && 'content' in requestBody\n ? (requestBody as OpenApiRequestBodyObject).content\n : undefined;\n const bodySchema = requestBodyContent?.['application/json']?.schema as\n | OpenApiSchemaObject\n | undefined;\n\n const bodySchemas = bodySchema\n ? [\n {\n name: `${pascal(verbOption.operationName)}Body`,\n schema: dereference(bodySchema, context),\n },\n ]\n : [];\n\n const parameters = operation.parameters as\n | (OpenApiParameterObject | OpenApiReferenceObject)[]\n | undefined;\n\n const queryParams = parameters?.filter(\n (p): p is OpenApiParameterObject => 'in' in p && p.in === 'query',\n );\n\n const queryParamsSchemas =\n queryParams && queryParams.length > 0\n ? [\n {\n name: `${pascal(verbOption.operationName)}Params`,\n schema: {\n type: 'object' as const,\n properties: Object.fromEntries(\n queryParams\n .filter((p) => 'schema' in p && p.schema)\n .map((p) => [\n p.name,\n dereference(p.schema as OpenApiSchemaObject, context),\n ]),\n ) as Record<string, OpenApiSchemaObject>,\n required: queryParams\n .filter((p) => p.required)\n .map((p) => p.name),\n },\n },\n ]\n : [];\n\n const headerParams = parameters?.filter(\n (p): p is OpenApiParameterObject => 'in' in p && p.in === 'header',\n );\n\n const headerParamsSchemas =\n headerParams && headerParams.length > 0\n ? [\n {\n name: `${pascal(verbOption.operationName)}Headers`,\n schema: {\n type: 'object' as const,\n properties: Object.fromEntries(\n headerParams\n .filter((p) => 'schema' in p && p.schema)\n .map((p) => [\n p.name,\n dereference(p.schema as OpenApiSchemaObject, context),\n ]),\n ) as Record<string, OpenApiSchemaObject>,\n required: headerParams\n .filter((p) => p.required)\n .map((p) => p.name),\n },\n },\n ]\n : [];\n\n return [...bodySchemas, ...queryParamsSchemas, ...headerParamsSchemas];\n });\n\n await Promise.all(\n generateVerbsSchemas.map(async ({ name, schema }) => {\n const fileName = conventionName(name, output.namingConvention);\n const filePath = upath.join(schemasPath, `${fileName}${fileExtension}`);\n\n const zodDefinition = generateZodValidationSchemaDefinition(\n schema,\n context,\n name,\n strict,\n isZodV4,\n {\n required: true,\n },\n );\n\n const parsedZodDefinition = parseZodValidationSchemaDefinition(\n zodDefinition,\n context,\n coerce,\n strict,\n isZodV4,\n );\n\n const zodContent = parsedZodDefinition.consts\n ? `${parsedZodDefinition.consts}\\n${parsedZodDefinition.zod}`\n : parsedZodDefinition.zod;\n\n const fileContent = generateZodSchemaFileContent(\n header,\n name,\n zodContent,\n );\n\n await fs.outputFile(filePath, fileContent);\n }),\n );\n\n if (output.indexFiles && generateVerbsSchemas.length > 0) {\n const schemaNames = generateVerbsSchemas.map((s) => s.name);\n await writeZodSchemaIndex(\n schemasPath,\n fileExtension,\n header,\n schemaNames,\n output.namingConvention,\n true,\n );\n }\n}\n","import {\n createSuccessMessage,\n fixCrossDirectoryImports,\n fixRegularSchemaImports,\n getFileInfo,\n getMockFileExtensionByTypeName,\n isObject,\n isString,\n jsDoc,\n log,\n type NormalizedOptions,\n type OpenApiInfoObject,\n OutputMode,\n splitSchemasByType,\n upath,\n writeSchemas,\n writeSingleMode,\n type WriteSpecBuilder,\n writeSplitMode,\n writeSplitTagsMode,\n writeTagsMode,\n} from '@orval/core';\nimport chalk from 'chalk';\nimport { execa, ExecaError } from 'execa';\nimport fs from 'fs-extra';\nimport { unique } from 'remeda';\nimport type { TypeDocOptions } from 'typedoc';\n\nimport { executeHook } from './utils';\nimport { writeZodSchemas, writeZodSchemasFromVerbs } from './write-zod-specs';\n\nfunction getHeader(\n option: false | ((info: OpenApiInfoObject) => string | string[]),\n info: OpenApiInfoObject,\n): string {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n}\n\n/**\n * Add re-export of operation schemas from the main schemas index file.\n * Handles the case where the index file doesn't exist (no regular schemas).\n */\nasync function addOperationSchemasReExport(\n schemaPath: string,\n operationSchemasPath: string,\n fileExtension: string,\n header: string,\n): Promise<void> {\n const relativePath = upath.relativeSafe(schemaPath, operationSchemasPath);\n const schemaIndexPath = upath.join(schemaPath, `index${fileExtension}`);\n const exportLine = `export * from '${relativePath}';\\n`;\n\n const indexExists = await fs.pathExists(schemaIndexPath);\n if (indexExists) {\n // Check if export already exists to prevent duplicates on re-runs\n // Use regex to handle both single and double quotes\n const existingContent = await fs.readFile(schemaIndexPath, 'utf8');\n const exportPattern = new RegExp(\n String.raw`export\\s*\\*\\s*from\\s*['\"]${relativePath.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`)}['\"]`,\n );\n if (!exportPattern.test(existingContent)) {\n await fs.appendFile(schemaIndexPath, exportLine);\n }\n } else {\n // Create index with header if file doesn't exist (no regular schemas case)\n const content =\n header && header.trim().length > 0\n ? `${header}\\n${exportLine}`\n : exportLine;\n await fs.outputFile(schemaIndexPath, content);\n }\n}\n\nexport async function writeSpecs(\n builder: WriteSpecBuilder,\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n) {\n const { info, schemas, target } = builder;\n const { output } = options;\n const projectTitle = projectName ?? info.title;\n\n const header = getHeader(output.override.header, info);\n\n if (output.schemas) {\n if (isString(output.schemas)) {\n const fileExtension = output.fileExtension || '.ts';\n const schemaPath = output.schemas;\n\n // Split schemas if operationSchemas path is configured\n if (output.operationSchemas) {\n const { regularSchemas, operationSchemas: opSchemas } =\n splitSchemasByType(schemas);\n\n // Fix cross-directory imports before writing (both directions)\n const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));\n const operationSchemaNames = new Set(opSchemas.map((s) => s.name));\n fixCrossDirectoryImports(\n opSchemas,\n regularSchemaNames,\n schemaPath,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n fixRegularSchemaImports(\n regularSchemas,\n operationSchemaNames,\n schemaPath,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n\n // Write regular schemas to schemas path\n if (regularSchemas.length > 0) {\n await writeSchemas({\n schemaPath,\n schemas: regularSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n\n // Write operation schemas to operationSchemas path\n if (opSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.operationSchemas,\n schemas: opSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n\n // Add re-export from operations in the main schemas index\n if (output.indexFiles) {\n await addOperationSchemasReExport(\n schemaPath,\n output.operationSchemas,\n fileExtension,\n header,\n );\n }\n }\n } else {\n await writeSchemas({\n schemaPath,\n schemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n } else {\n const schemaType = output.schemas.type;\n\n if (schemaType === 'typescript') {\n const fileExtension = output.fileExtension || '.ts';\n\n // Split schemas if operationSchemas path is configured\n if (output.operationSchemas) {\n const { regularSchemas, operationSchemas: opSchemas } =\n splitSchemasByType(schemas);\n\n // Fix cross-directory imports before writing (both directions)\n const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));\n const operationSchemaNames = new Set(opSchemas.map((s) => s.name));\n fixCrossDirectoryImports(\n opSchemas,\n regularSchemaNames,\n output.schemas.path,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n fixRegularSchemaImports(\n regularSchemas,\n operationSchemaNames,\n output.schemas.path,\n output.operationSchemas,\n output.namingConvention,\n fileExtension,\n );\n\n if (regularSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.schemas.path,\n schemas: regularSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n\n if (opSchemas.length > 0) {\n await writeSchemas({\n schemaPath: output.operationSchemas,\n schemas: opSchemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n\n // Add re-export from operations in the main schemas index\n if (output.indexFiles) {\n await addOperationSchemasReExport(\n output.schemas.path,\n output.operationSchemas,\n fileExtension,\n header,\n );\n }\n }\n } else {\n await writeSchemas({\n schemaPath: output.schemas.path,\n schemas,\n target,\n namingConvention: output.namingConvention,\n fileExtension,\n header,\n indexFiles: output.indexFiles,\n });\n }\n } else {\n // schemaType === 'zod'\n const fileExtension = '.zod.ts';\n\n await writeZodSchemas(\n builder,\n output.schemas.path,\n fileExtension,\n header,\n output,\n );\n\n await writeZodSchemasFromVerbs(\n builder.verbOptions,\n output.schemas.path,\n fileExtension,\n header,\n output,\n {\n spec: builder.spec,\n target: builder.target,\n workspace,\n output,\n },\n );\n }\n }\n }\n\n let implementationPaths: string[] = [];\n\n if (output.target) {\n const writeMode = getWriteMode(output.mode);\n implementationPaths = await writeMode({\n builder,\n workspace,\n output,\n projectName,\n header,\n needSchema: !output.schemas && output.client !== 'zod',\n });\n }\n\n if (output.workspace) {\n const workspacePath = output.workspace;\n const imports = implementationPaths\n .filter(\n (path) =>\n !output.mock ||\n !path.endsWith(`.${getMockFileExtensionByTypeName(output.mock)}.ts`),\n )\n .map((path) =>\n upath.relativeSafe(\n workspacePath,\n getFileInfo(path).pathWithoutExtension,\n ),\n );\n\n if (output.schemas) {\n const schemasPath = isString(output.schemas)\n ? output.schemas\n : output.schemas.path;\n imports.push(\n upath.relativeSafe(workspacePath, getFileInfo(schemasPath).dirname),\n );\n }\n\n if (output.operationSchemas) {\n imports.push(\n upath.relativeSafe(\n workspacePath,\n getFileInfo(output.operationSchemas).dirname,\n ),\n );\n }\n\n if (output.indexFiles) {\n const indexFile = upath.join(workspacePath, '/index.ts');\n\n if (await fs.pathExists(indexFile)) {\n const data = await fs.readFile(indexFile, 'utf8');\n const importsNotDeclared = imports.filter((imp) => !data.includes(imp));\n await fs.appendFile(\n indexFile,\n unique(importsNotDeclared)\n .map((imp) => `export * from '${imp}';\\n`)\n .join(''),\n );\n } else {\n await fs.outputFile(\n indexFile,\n unique(imports)\n .map((imp) => `export * from '${imp}';`)\n .join('\\n') + '\\n',\n );\n }\n\n implementationPaths = [indexFile, ...implementationPaths];\n }\n }\n\n if (builder.extraFiles.length > 0) {\n await Promise.all(\n builder.extraFiles.map(async (file) =>\n fs.outputFile(file.path, file.content),\n ),\n );\n\n implementationPaths = [\n ...implementationPaths,\n ...builder.extraFiles.map((file) => file.path),\n ];\n }\n\n const paths = [\n ...(output.schemas\n ? [\n getFileInfo(\n isString(output.schemas) ? output.schemas : output.schemas.path,\n ).dirname,\n ]\n : []),\n ...(output.operationSchemas\n ? [getFileInfo(output.operationSchemas).dirname]\n : []),\n ...implementationPaths,\n ];\n\n if (options.hooks.afterAllFilesWrite) {\n await executeHook(\n 'afterAllFilesWrite',\n options.hooks.afterAllFilesWrite,\n paths,\n );\n }\n\n if (output.prettier) {\n try {\n await execa('prettier', ['--write', ...paths]);\n } catch {\n log(\n chalk.yellow(\n `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}Globally installed prettier not found`,\n ),\n );\n }\n }\n\n if (output.biome) {\n try {\n await execa('biome', ['check', '--write', ...paths]);\n } catch (error) {\n let message = `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}biome not found`;\n if (error instanceof ExecaError && error.exitCode === 1)\n message = error.message;\n\n log(chalk.yellow(message));\n }\n }\n\n if (output.docs) {\n try {\n let config: Partial<TypeDocOptions> = {};\n let configPath: string | undefined;\n if (isObject(output.docs)) {\n ({ configPath, ...config } = output.docs);\n if (configPath) {\n config.options = configPath;\n }\n }\n\n const getTypedocApplication = async () => {\n const { Application } = await import('typedoc');\n return Application;\n };\n\n const Application = await getTypedocApplication();\n const app = await Application.bootstrapWithPlugins({\n entryPoints: paths,\n theme: 'markdown',\n // Set the custom config location if it has been provided.\n ...config,\n plugin: ['typedoc-plugin-markdown', ...(config.plugin ?? [])],\n });\n // Set defaults if the have not been provided by the external config.\n if (!app.options.isSet('readme')) {\n app.options.setValue('readme', 'none');\n }\n if (!app.options.isSet('logLevel')) {\n app.options.setValue('logLevel', 'None');\n }\n const project = await app.convert();\n if (project) {\n await app.generateDocs(project, app.options.getValue('out') as string);\n } else {\n throw new Error('TypeDoc not initialized');\n }\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : `⚠️ ${projectTitle ? `${projectTitle} - ` : ''}Unable to generate docs`;\n\n log(chalk.yellow(message));\n }\n }\n\n createSuccessMessage(projectTitle);\n}\n\nfunction getWriteMode(mode: OutputMode) {\n switch (mode) {\n case OutputMode.SPLIT: {\n return writeSplitMode;\n }\n case OutputMode.TAGS: {\n return writeTagsMode;\n }\n case OutputMode.TAGS_SPLIT: {\n return writeSplitTagsMode;\n }\n default: {\n return writeSingleMode;\n }\n }\n}\n","import {\n getFileInfo,\n isString,\n log,\n type NormalizedOptions,\n removeFilesAndEmptyFolders,\n} from '@orval/core';\n\nimport { importSpecs } from './import-specs';\nimport { writeSpecs } from './write-specs';\n\n/**\n * Generate client/spec files for a single Orval project.\n *\n * @param workspace - Absolute or relative workspace path used to resolve imports.\n * @param options - Normalized generation options for this project.\n * @param projectName - Optional project name used in logging output.\n * @returns A promise that resolves once generation (and optional cleaning) completes.\n *\n * @example\n * await generateSpec(process.cwd(), normalizedOptions, 'my-project');\n */\nexport async function generateSpec(\n workspace: string,\n options: NormalizedOptions,\n projectName?: string,\n) {\n if (options.output.clean) {\n const extraPatterns = Array.isArray(options.output.clean)\n ? options.output.clean\n : [];\n\n if (options.output.target) {\n await removeFilesAndEmptyFolders(\n ['**/*', '!**/*.d.ts', ...extraPatterns],\n getFileInfo(options.output.target).dirname,\n );\n }\n if (options.output.schemas) {\n const schemasPath = isString(options.output.schemas)\n ? options.output.schemas\n : options.output.schemas.path;\n await removeFilesAndEmptyFolders(\n ['**/*', '!**/*.d.ts', ...extraPatterns],\n getFileInfo(schemasPath).dirname,\n );\n }\n log(`${projectName} Cleaning output folder`);\n }\n\n const writeSpecBuilder = await importSpecs(workspace, options, projectName);\n await writeSpecs(writeSpecBuilder, workspace, options, projectName);\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { type Config, type ConfigExternal, isFunction } from '@orval/core';\nimport { createJiti } from 'jiti';\n\n/**\n * Resolve the Orval config file path.\n *\n * @param configFilePath - Optional path to the config file (absolute or relative).\n * @returns The absolute path to the resolved config file.\n * @throws If a provided path does not exist or if no config file is found.\n *\n * @example\n * // explicit path\n * const p = findConfigFile('./orval.config.ts');\n *\n * @example\n * // automatic discovery (searches process.cwd())\n * const p = findConfigFile();\n */\nexport function findConfigFile(configFilePath?: string) {\n if (configFilePath) {\n const absolutePath = path.isAbsolute(configFilePath)\n ? configFilePath\n : path.resolve(process.cwd(), configFilePath);\n\n if (!fs.existsSync(absolutePath))\n throw new Error(`Config file ${configFilePath} does not exist`);\n\n return absolutePath;\n }\n\n const root = process.cwd();\n const exts = ['.ts', '.js', '.mjs', '.mts'];\n for (const ext of exts) {\n const fullPath = path.resolve(root, `orval.config${ext}`);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n throw new Error(`No config file found in ${root}`);\n}\n\n/**\n * Load an Orval config file\n * @param configFilePath - Path to the config file (absolute or relative).\n * @returns The resolved Orval `Config` object.\n * @throws If the module does not provide a default export or the default export resolves to `undefined`.\n *\n * @example\n * // load a config object\n * const cfg = await loadConfigFile('./orval.config.ts');\n */\nexport async function loadConfigFile(configFilePath: string): Promise<Config> {\n const jiti = createJiti(process.cwd(), {\n interopDefault: true,\n });\n\n const configExternal = await jiti.import<ConfigExternal | undefined>(\n configFilePath,\n {\n default: true,\n },\n );\n\n if (configExternal === undefined) {\n throw new Error(`${configFilePath} doesn't have a default export`);\n }\n\n const config = await (isFunction(configExternal)\n ? configExternal()\n : configExternal);\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiCA,MAAM,iBAAiB,aAAa;AAEpC,MAAM,sBACJ,cACA,WACG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