orval 7.8.0 → 7.9.0
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.js +275 -184
- package/dist/bin/orval.js.map +1 -1
- package/dist/index.js +275 -184
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
package/dist/index.js
CHANGED
|
@@ -31,16 +31,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var src_exports = {};
|
|
33
33
|
__export(src_exports, {
|
|
34
|
-
Options: () =>
|
|
34
|
+
Options: () => import_core13.Options,
|
|
35
35
|
default: () => src_default,
|
|
36
36
|
defineConfig: () => defineConfig,
|
|
37
37
|
generate: () => generate
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(src_exports);
|
|
40
|
-
var
|
|
40
|
+
var import_core13 = require("@orval/core");
|
|
41
41
|
|
|
42
42
|
// src/generate.ts
|
|
43
|
-
var
|
|
43
|
+
var import_core12 = require("@orval/core");
|
|
44
44
|
|
|
45
45
|
// src/import-specs.ts
|
|
46
46
|
var import_swagger_parser = __toESM(require("@apidevtools/swagger-parser"));
|
|
@@ -2689,6 +2689,7 @@ var mock = __toESM(require("@orval/mock"));
|
|
|
2689
2689
|
var import_query = __toESM(require("@orval/query"));
|
|
2690
2690
|
var import_swr = __toESM(require("@orval/swr"));
|
|
2691
2691
|
var import_zod = __toESM(require("@orval/zod"));
|
|
2692
|
+
var import_mcp = __toESM(require("@orval/mcp"));
|
|
2692
2693
|
var DEFAULT_CLIENT = import_core.OutputClient.AXIOS;
|
|
2693
2694
|
var getGeneratorClient = (outputClient, output) => {
|
|
2694
2695
|
const GENERATOR_CLIENT = {
|
|
@@ -2701,7 +2702,8 @@ var getGeneratorClient = (outputClient, output) => {
|
|
|
2701
2702
|
swr: (0, import_swr.default)()(),
|
|
2702
2703
|
zod: (0, import_zod.default)()(),
|
|
2703
2704
|
hono: (0, import_hono.default)()(),
|
|
2704
|
-
fetch: (0, import_fetch.default)()()
|
|
2705
|
+
fetch: (0, import_fetch.default)()(),
|
|
2706
|
+
mcp: (0, import_mcp.default)()()
|
|
2705
2707
|
};
|
|
2706
2708
|
const generator = (0, import_core.isFunction)(outputClient) ? outputClient(GENERATOR_CLIENT) : GENERATOR_CLIENT[outputClient];
|
|
2707
2709
|
if (!generator) {
|
|
@@ -3240,15 +3242,15 @@ var importSpecs = async (workspace, options) => {
|
|
|
3240
3242
|
};
|
|
3241
3243
|
|
|
3242
3244
|
// src/utils/options.ts
|
|
3243
|
-
var
|
|
3245
|
+
var import_core8 = require("@orval/core");
|
|
3244
3246
|
var import_mock2 = require("@orval/mock");
|
|
3245
|
-
var
|
|
3247
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
3246
3248
|
|
|
3247
3249
|
// package.json
|
|
3248
3250
|
var package_default = {
|
|
3249
3251
|
name: "orval",
|
|
3250
3252
|
description: "A swagger client generator for typescript",
|
|
3251
|
-
version: "7.
|
|
3253
|
+
version: "7.9.0",
|
|
3252
3254
|
license: "MIT",
|
|
3253
3255
|
files: [
|
|
3254
3256
|
"dist"
|
|
@@ -3303,15 +3305,16 @@ var package_default = {
|
|
|
3303
3305
|
},
|
|
3304
3306
|
dependencies: {
|
|
3305
3307
|
"@apidevtools/swagger-parser": "^10.1.1",
|
|
3306
|
-
"@orval/angular": "7.
|
|
3307
|
-
"@orval/axios": "7.
|
|
3308
|
-
"@orval/core": "7.
|
|
3309
|
-
"@orval/fetch": "7.
|
|
3310
|
-
"@orval/hono": "7.
|
|
3311
|
-
"@orval/
|
|
3312
|
-
"@orval/
|
|
3313
|
-
"@orval/
|
|
3314
|
-
"@orval/
|
|
3308
|
+
"@orval/angular": "7.9.0",
|
|
3309
|
+
"@orval/axios": "7.9.0",
|
|
3310
|
+
"@orval/core": "7.9.0",
|
|
3311
|
+
"@orval/fetch": "7.9.0",
|
|
3312
|
+
"@orval/hono": "7.9.0",
|
|
3313
|
+
"@orval/mcp": "7.9.0",
|
|
3314
|
+
"@orval/mock": "7.9.0",
|
|
3315
|
+
"@orval/query": "7.9.0",
|
|
3316
|
+
"@orval/swr": "7.9.0",
|
|
3317
|
+
"@orval/zod": "7.9.0",
|
|
3315
3318
|
ajv: "^8.17.1",
|
|
3316
3319
|
cac: "^6.7.14",
|
|
3317
3320
|
chalk: "^4.1.2",
|
|
@@ -3482,6 +3485,8 @@ var githubResolver = {
|
|
|
3482
3485
|
};
|
|
3483
3486
|
|
|
3484
3487
|
// src/utils/package-json.ts
|
|
3488
|
+
var import_core6 = require("@orval/core");
|
|
3489
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
3485
3490
|
var import_find_up = __toESM(require("find-up"));
|
|
3486
3491
|
var import_fs_extra3 = __toESM(require("fs-extra"));
|
|
3487
3492
|
var loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
@@ -3491,26 +3496,88 @@ var loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
|
3491
3496
|
});
|
|
3492
3497
|
if (pkgPath) {
|
|
3493
3498
|
const pkg = await Promise.resolve().then(() => __toESM(require(pkgPath)));
|
|
3494
|
-
return pkg;
|
|
3499
|
+
return await maybeReplaceCatalog(pkg, workspace);
|
|
3495
3500
|
}
|
|
3496
3501
|
return;
|
|
3497
3502
|
}
|
|
3498
3503
|
const normalizedPath = normalizePath(packageJson, workspace);
|
|
3499
3504
|
if (import_fs_extra3.default.existsSync(normalizedPath)) {
|
|
3500
3505
|
const pkg = await Promise.resolve().then(() => __toESM(require(normalizedPath)));
|
|
3501
|
-
return pkg;
|
|
3506
|
+
return await maybeReplaceCatalog(pkg, workspace);
|
|
3502
3507
|
}
|
|
3503
3508
|
return;
|
|
3504
3509
|
};
|
|
3510
|
+
var maybeReplaceCatalog = async (pkg, workspace) => {
|
|
3511
|
+
var _a, _b, _c;
|
|
3512
|
+
if (![
|
|
3513
|
+
...Object.entries((_a = pkg.dependencies) != null ? _a : {}),
|
|
3514
|
+
...Object.entries((_b = pkg.devDependencies) != null ? _b : {}),
|
|
3515
|
+
...Object.entries((_c = pkg.peerDependencies) != null ? _c : {})
|
|
3516
|
+
].some(([key]) => key.startsWith("catalog:"))) {
|
|
3517
|
+
return pkg;
|
|
3518
|
+
}
|
|
3519
|
+
const filePath = await (0, import_find_up.default)("pnpm-workspace.yaml", { cwd: workspace });
|
|
3520
|
+
if (!filePath) {
|
|
3521
|
+
(0, import_core6.log)(
|
|
3522
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow("package.json contains pnpm catalog: in dependencies, but no pnpm-workspace.yaml was found.")}`
|
|
3523
|
+
);
|
|
3524
|
+
return pkg;
|
|
3525
|
+
}
|
|
3526
|
+
const file = await import_fs_extra3.default.readFile(filePath, "utf8");
|
|
3527
|
+
const pnpmWorkspaceFile = js_yaml_default.load(file);
|
|
3528
|
+
performSubstitution(pkg.dependencies, pnpmWorkspaceFile);
|
|
3529
|
+
performSubstitution(pkg.devDependencies, pnpmWorkspaceFile);
|
|
3530
|
+
performSubstitution(pkg.peerDependencies, pnpmWorkspaceFile);
|
|
3531
|
+
return pkg;
|
|
3532
|
+
};
|
|
3533
|
+
var performSubstitution = (dependencies, pnpmWorkspaceFile) => {
|
|
3534
|
+
var _a, _b;
|
|
3535
|
+
if (!dependencies) return;
|
|
3536
|
+
for (const [packageName, version] of Object.entries(dependencies)) {
|
|
3537
|
+
if (version === "catalog:" || version === "catalog:default") {
|
|
3538
|
+
if (!pnpmWorkspaceFile.catalog) {
|
|
3539
|
+
(0, import_core6.log)(
|
|
3540
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow(`when reading from pnpm-workspace.yaml, catalog: substitution for the package '${packageName}' failed as there were no default catalog.`)}`
|
|
3541
|
+
);
|
|
3542
|
+
continue;
|
|
3543
|
+
}
|
|
3544
|
+
const sub = pnpmWorkspaceFile.catalog[packageName];
|
|
3545
|
+
if (!sub) {
|
|
3546
|
+
(0, import_core6.log)(
|
|
3547
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow(`when reading from pnpm-workspace.yaml, catalog: substitution for the package '${packageName}' failed as there were no matching package in the default catalog.`)}`
|
|
3548
|
+
);
|
|
3549
|
+
continue;
|
|
3550
|
+
}
|
|
3551
|
+
dependencies[packageName] = sub;
|
|
3552
|
+
} else if (version.startsWith("catalog:")) {
|
|
3553
|
+
const catalogName = version.substring("catalog:".length);
|
|
3554
|
+
const catalog = (_a = pnpmWorkspaceFile.catalogs) == null ? void 0 : _a[catalogName];
|
|
3555
|
+
if (!catalog) {
|
|
3556
|
+
(0, import_core6.log)(
|
|
3557
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow(`when reading from pnpm-workspace.yaml, '${version}' substitution for the package '${packageName}' failed as there were no matching catalog named '${catalogName}'. (available named catalogs are: ${Object.keys((_b = pnpmWorkspaceFile.catalogs) != null ? _b : {}).join(", ")})`)}`
|
|
3558
|
+
);
|
|
3559
|
+
continue;
|
|
3560
|
+
}
|
|
3561
|
+
const sub = catalog[packageName];
|
|
3562
|
+
if (!sub) {
|
|
3563
|
+
(0, import_core6.log)(
|
|
3564
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow(`when reading from pnpm-workspace.yaml, '${version}' substitution for the package '${packageName}' failed as there were no package in the catalog named '${catalogName}'. (packages in the catalog are: ${Object.keys(catalog).join(", ")})`)}`
|
|
3565
|
+
);
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
dependencies[packageName] = sub;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
};
|
|
3505
3572
|
|
|
3506
3573
|
// src/utils/tsconfig.ts
|
|
3507
|
-
var
|
|
3574
|
+
var import_core7 = require("@orval/core");
|
|
3508
3575
|
var import_find_up2 = __toESM(require("find-up"));
|
|
3509
3576
|
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
3510
3577
|
var import_tsconfck = require("tsconfck");
|
|
3511
3578
|
var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
3512
3579
|
var _a, _b;
|
|
3513
|
-
if ((0,
|
|
3580
|
+
if ((0, import_core7.isUndefined)(tsconfig)) {
|
|
3514
3581
|
const configPath = await (0, import_find_up2.default)(["tsconfig.json", "jsconfig.json"], {
|
|
3515
3582
|
cwd: workspace
|
|
3516
3583
|
});
|
|
@@ -3520,7 +3587,7 @@ var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
|
3520
3587
|
}
|
|
3521
3588
|
return;
|
|
3522
3589
|
}
|
|
3523
|
-
if ((0,
|
|
3590
|
+
if ((0, import_core7.isString)(tsconfig)) {
|
|
3524
3591
|
const normalizedPath = normalizePath(tsconfig, workspace);
|
|
3525
3592
|
if (import_fs_extra4.default.existsSync(normalizedPath)) {
|
|
3526
3593
|
const config = await (0, import_tsconfck.parse)(normalizedPath);
|
|
@@ -3531,7 +3598,7 @@ var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
|
3531
3598
|
}
|
|
3532
3599
|
return;
|
|
3533
3600
|
}
|
|
3534
|
-
if ((0,
|
|
3601
|
+
if ((0, import_core7.isObject)(tsconfig)) {
|
|
3535
3602
|
return tsconfig;
|
|
3536
3603
|
}
|
|
3537
3604
|
return;
|
|
@@ -3541,19 +3608,44 @@ var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
|
3541
3608
|
function defineConfig(options) {
|
|
3542
3609
|
return options;
|
|
3543
3610
|
}
|
|
3611
|
+
var createFormData = (workspace, formData) => {
|
|
3612
|
+
var _a;
|
|
3613
|
+
const defaultArrayHandling = import_core8.FormDataArrayHandling.SERIALIZE;
|
|
3614
|
+
if (formData === void 0)
|
|
3615
|
+
return { disabled: false, arrayHandling: defaultArrayHandling };
|
|
3616
|
+
if ((0, import_core8.isBoolean)(formData))
|
|
3617
|
+
return { disabled: !formData, arrayHandling: defaultArrayHandling };
|
|
3618
|
+
if ((0, import_core8.isString)(formData))
|
|
3619
|
+
return {
|
|
3620
|
+
disabled: false,
|
|
3621
|
+
mutator: normalizeMutator(workspace, formData),
|
|
3622
|
+
arrayHandling: defaultArrayHandling
|
|
3623
|
+
};
|
|
3624
|
+
if ("mutator" in formData || "arrayHandling" in formData)
|
|
3625
|
+
return {
|
|
3626
|
+
disabled: false,
|
|
3627
|
+
mutator: normalizeMutator(workspace, formData.mutator),
|
|
3628
|
+
arrayHandling: (_a = formData.arrayHandling) != null ? _a : defaultArrayHandling
|
|
3629
|
+
};
|
|
3630
|
+
return {
|
|
3631
|
+
disabled: false,
|
|
3632
|
+
mutator: normalizeMutator(workspace, formData),
|
|
3633
|
+
arrayHandling: defaultArrayHandling
|
|
3634
|
+
};
|
|
3635
|
+
};
|
|
3544
3636
|
var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOptions = {}) => {
|
|
3545
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib, _Jb, _Kb, _Lb, _Mb, _Nb, _Ob, _Pb, _Qb, _Rb, _Sb, _Tb, _Ub, _Vb, _Wb, _Xb, _Yb, _Zb, __b, _$b, _ac, _bc, _cc, _dc
|
|
3546
|
-
const options = await ((0,
|
|
3637
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib, _Jb, _Kb, _Lb, _Mb, _Nb, _Ob, _Pb, _Qb, _Rb, _Sb, _Tb, _Ub, _Vb, _Wb, _Xb, _Yb, _Zb, __b, _$b, _ac, _bc, _cc, _dc;
|
|
3638
|
+
const options = await ((0, import_core8.isFunction)(optionsExport) ? optionsExport() : optionsExport);
|
|
3547
3639
|
if (!options.input) {
|
|
3548
|
-
(0,
|
|
3640
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an input`));
|
|
3549
3641
|
process.exit(1);
|
|
3550
3642
|
}
|
|
3551
3643
|
if (!options.output) {
|
|
3552
|
-
(0,
|
|
3644
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an output`));
|
|
3553
3645
|
process.exit(1);
|
|
3554
3646
|
}
|
|
3555
|
-
const inputOptions = (0,
|
|
3556
|
-
const outputOptions = (0,
|
|
3647
|
+
const inputOptions = (0, import_core8.isString)(options.input) ? { target: options.input } : options.input;
|
|
3648
|
+
const outputOptions = (0, import_core8.isString)(options.output) ? { target: options.output } : options.output;
|
|
3557
3649
|
const outputWorkspace = normalizePath(
|
|
3558
3650
|
outputOptions.workspace || "",
|
|
3559
3651
|
workspace
|
|
@@ -3571,7 +3663,8 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3571
3663
|
let mock2;
|
|
3572
3664
|
if (typeof mockOption === "boolean" && mockOption) {
|
|
3573
3665
|
mock2 = import_mock2.DEFAULT_MOCK_OPTIONS;
|
|
3574
|
-
} else if ((0,
|
|
3666
|
+
} else if ((0, import_core8.isFunction)(mockOption)) {
|
|
3667
|
+
mock2 = mockOption;
|
|
3575
3668
|
} else if (!mockOption) {
|
|
3576
3669
|
mock2 = void 0;
|
|
3577
3670
|
} else {
|
|
@@ -3602,7 +3695,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3602
3695
|
)
|
|
3603
3696
|
},
|
|
3604
3697
|
converterOptions: (_d = inputOptions.converterOptions) != null ? _d : {},
|
|
3605
|
-
parserOptions: (0,
|
|
3698
|
+
parserOptions: (0, import_core8.mergeDeep)(
|
|
3606
3699
|
parserDefaultOptions,
|
|
3607
3700
|
(_e = inputOptions.parserOptions) != null ? _e : {}
|
|
3608
3701
|
),
|
|
@@ -3611,11 +3704,11 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3611
3704
|
output: {
|
|
3612
3705
|
target: globalOptions.output ? normalizePath(globalOptions.output, process.cwd()) : normalizePath(outputOptions.target, outputWorkspace),
|
|
3613
3706
|
schemas: normalizePath(outputOptions.schemas, outputWorkspace),
|
|
3614
|
-
namingConvention: outputOptions.namingConvention ||
|
|
3707
|
+
namingConvention: outputOptions.namingConvention || import_core8.NamingConvention.CAMEL_CASE,
|
|
3615
3708
|
fileExtension: outputOptions.fileExtension || defaultFileExtension,
|
|
3616
3709
|
workspace: outputOptions.workspace ? outputWorkspace : void 0,
|
|
3617
|
-
client: (_g = (_f = outputOptions.client) != null ? _f : client) != null ? _g :
|
|
3618
|
-
httpClient: (_i = (_h = outputOptions.httpClient) != null ? _h : httpClient) != null ? _i :
|
|
3710
|
+
client: (_g = (_f = outputOptions.client) != null ? _f : client) != null ? _g : import_core8.OutputClient.AXIOS_FUNCTIONS,
|
|
3711
|
+
httpClient: (_i = (_h = outputOptions.httpClient) != null ? _h : httpClient) != null ? _i : import_core8.OutputHttpClient.AXIOS,
|
|
3619
3712
|
mode: normalizeOutputMode((_j = outputOptions.mode) != null ? _j : mode),
|
|
3620
3713
|
mock: mock2,
|
|
3621
3714
|
clean: (_l = (_k = outputOptions.clean) != null ? _k : clean) != null ? _l : false,
|
|
@@ -3654,127 +3747,127 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3654
3747
|
outputWorkspace,
|
|
3655
3748
|
(_I = outputOptions.override) == null ? void 0 : _I.mutator
|
|
3656
3749
|
),
|
|
3657
|
-
formData: (
|
|
3750
|
+
formData: createFormData(
|
|
3658
3751
|
outputWorkspace,
|
|
3659
|
-
(
|
|
3660
|
-
)
|
|
3661
|
-
formUrlEncoded: (
|
|
3752
|
+
(_J = outputOptions.override) == null ? void 0 : _J.formData
|
|
3753
|
+
),
|
|
3754
|
+
formUrlEncoded: (_N = !(0, import_core8.isBoolean)((_K = outputOptions.override) == null ? void 0 : _K.formUrlEncoded) ? normalizeMutator(
|
|
3662
3755
|
outputWorkspace,
|
|
3663
|
-
(
|
|
3664
|
-
) : (
|
|
3756
|
+
(_L = outputOptions.override) == null ? void 0 : _L.formUrlEncoded
|
|
3757
|
+
) : (_M = outputOptions.override) == null ? void 0 : _M.formUrlEncoded) != null ? _N : true,
|
|
3665
3758
|
paramsSerializer: normalizeMutator(
|
|
3666
3759
|
outputWorkspace,
|
|
3667
|
-
(
|
|
3760
|
+
(_O = outputOptions.override) == null ? void 0 : _O.paramsSerializer
|
|
3668
3761
|
),
|
|
3669
|
-
header: ((
|
|
3670
|
-
requestOptions: (
|
|
3762
|
+
header: ((_P = outputOptions.override) == null ? void 0 : _P.header) === false ? false : (0, import_core8.isFunction)((_Q = outputOptions.override) == null ? void 0 : _Q.header) ? (_R = outputOptions.override) == null ? void 0 : _R.header : getDefaultFilesHeader,
|
|
3763
|
+
requestOptions: (_T = (_S = outputOptions.override) == null ? void 0 : _S.requestOptions) != null ? _T : true,
|
|
3671
3764
|
components: {
|
|
3672
3765
|
schemas: {
|
|
3673
|
-
suffix:
|
|
3674
|
-
itemSuffix: (
|
|
3675
|
-
...(
|
|
3766
|
+
suffix: import_core8.RefComponentSuffix.schemas,
|
|
3767
|
+
itemSuffix: (_X = (_W = (_V = (_U = outputOptions.override) == null ? void 0 : _U.components) == null ? void 0 : _V.schemas) == null ? void 0 : _W.itemSuffix) != null ? _X : "Item",
|
|
3768
|
+
...(__ = (_Z = (_Y = outputOptions.override) == null ? void 0 : _Y.components) == null ? void 0 : _Z.schemas) != null ? __ : {}
|
|
3676
3769
|
},
|
|
3677
3770
|
responses: {
|
|
3678
|
-
suffix:
|
|
3679
|
-
...(
|
|
3771
|
+
suffix: import_core8.RefComponentSuffix.responses,
|
|
3772
|
+
...(_ba = (_aa = (_$ = outputOptions.override) == null ? void 0 : _$.components) == null ? void 0 : _aa.responses) != null ? _ba : {}
|
|
3680
3773
|
},
|
|
3681
3774
|
parameters: {
|
|
3682
|
-
suffix:
|
|
3683
|
-
...(
|
|
3775
|
+
suffix: import_core8.RefComponentSuffix.parameters,
|
|
3776
|
+
...(_ea = (_da = (_ca = outputOptions.override) == null ? void 0 : _ca.components) == null ? void 0 : _da.parameters) != null ? _ea : {}
|
|
3684
3777
|
},
|
|
3685
3778
|
requestBodies: {
|
|
3686
|
-
suffix:
|
|
3687
|
-
...(
|
|
3779
|
+
suffix: import_core8.RefComponentSuffix.requestBodies,
|
|
3780
|
+
...(_ha = (_ga = (_fa = outputOptions.override) == null ? void 0 : _fa.components) == null ? void 0 : _ga.requestBodies) != null ? _ha : {}
|
|
3688
3781
|
}
|
|
3689
3782
|
},
|
|
3690
|
-
hono: normalizeHonoOptions((
|
|
3783
|
+
hono: normalizeHonoOptions((_ia = outputOptions.override) == null ? void 0 : _ia.hono, workspace),
|
|
3691
3784
|
query: globalQueryOptions,
|
|
3692
3785
|
zod: {
|
|
3693
3786
|
strict: {
|
|
3694
|
-
param: (
|
|
3695
|
-
query: (
|
|
3696
|
-
header: (
|
|
3697
|
-
body: (
|
|
3698
|
-
response: (
|
|
3787
|
+
param: (_ma = (_la = (_ka = (_ja = outputOptions.override) == null ? void 0 : _ja.zod) == null ? void 0 : _ka.strict) == null ? void 0 : _la.param) != null ? _ma : false,
|
|
3788
|
+
query: (_qa = (_pa = (_oa = (_na = outputOptions.override) == null ? void 0 : _na.zod) == null ? void 0 : _oa.strict) == null ? void 0 : _pa.query) != null ? _qa : false,
|
|
3789
|
+
header: (_ua = (_ta = (_sa = (_ra = outputOptions.override) == null ? void 0 : _ra.zod) == null ? void 0 : _sa.strict) == null ? void 0 : _ta.header) != null ? _ua : false,
|
|
3790
|
+
body: (_ya = (_xa = (_wa = (_va = outputOptions.override) == null ? void 0 : _va.zod) == null ? void 0 : _wa.strict) == null ? void 0 : _xa.body) != null ? _ya : false,
|
|
3791
|
+
response: (_Ca = (_Ba = (_Aa = (_za = outputOptions.override) == null ? void 0 : _za.zod) == null ? void 0 : _Aa.strict) == null ? void 0 : _Ba.response) != null ? _Ca : false
|
|
3699
3792
|
},
|
|
3700
3793
|
generate: {
|
|
3701
|
-
param: (
|
|
3702
|
-
query: (
|
|
3703
|
-
header: (
|
|
3704
|
-
body: (
|
|
3705
|
-
response: (
|
|
3794
|
+
param: (_Ga = (_Fa = (_Ea = (_Da = outputOptions.override) == null ? void 0 : _Da.zod) == null ? void 0 : _Ea.generate) == null ? void 0 : _Fa.param) != null ? _Ga : true,
|
|
3795
|
+
query: (_Ka = (_Ja = (_Ia = (_Ha = outputOptions.override) == null ? void 0 : _Ha.zod) == null ? void 0 : _Ia.generate) == null ? void 0 : _Ja.query) != null ? _Ka : true,
|
|
3796
|
+
header: (_Oa = (_Na = (_Ma = (_La = outputOptions.override) == null ? void 0 : _La.zod) == null ? void 0 : _Ma.generate) == null ? void 0 : _Na.header) != null ? _Oa : true,
|
|
3797
|
+
body: (_Sa = (_Ra = (_Qa = (_Pa = outputOptions.override) == null ? void 0 : _Pa.zod) == null ? void 0 : _Qa.generate) == null ? void 0 : _Ra.body) != null ? _Sa : true,
|
|
3798
|
+
response: (_Wa = (_Va = (_Ua = (_Ta = outputOptions.override) == null ? void 0 : _Ta.zod) == null ? void 0 : _Ua.generate) == null ? void 0 : _Va.response) != null ? _Wa : true
|
|
3706
3799
|
},
|
|
3707
3800
|
coerce: {
|
|
3708
|
-
param: (
|
|
3709
|
-
query: (
|
|
3710
|
-
header: (
|
|
3711
|
-
body: (
|
|
3712
|
-
response: (
|
|
3801
|
+
param: (__a = (_Za = (_Ya = (_Xa = outputOptions.override) == null ? void 0 : _Xa.zod) == null ? void 0 : _Ya.coerce) == null ? void 0 : _Za.param) != null ? __a : false,
|
|
3802
|
+
query: (_cb = (_bb = (_ab = (_$a = outputOptions.override) == null ? void 0 : _$a.zod) == null ? void 0 : _ab.coerce) == null ? void 0 : _bb.query) != null ? _cb : false,
|
|
3803
|
+
header: (_gb = (_fb = (_eb = (_db = outputOptions.override) == null ? void 0 : _db.zod) == null ? void 0 : _eb.coerce) == null ? void 0 : _fb.header) != null ? _gb : false,
|
|
3804
|
+
body: (_kb = (_jb = (_ib = (_hb = outputOptions.override) == null ? void 0 : _hb.zod) == null ? void 0 : _ib.coerce) == null ? void 0 : _jb.body) != null ? _kb : false,
|
|
3805
|
+
response: (_ob = (_nb = (_mb = (_lb = outputOptions.override) == null ? void 0 : _lb.zod) == null ? void 0 : _mb.coerce) == null ? void 0 : _nb.response) != null ? _ob : false
|
|
3713
3806
|
},
|
|
3714
3807
|
preprocess: {
|
|
3715
|
-
...((
|
|
3808
|
+
...((_rb = (_qb = (_pb = outputOptions.override) == null ? void 0 : _pb.zod) == null ? void 0 : _qb.preprocess) == null ? void 0 : _rb.param) ? {
|
|
3716
3809
|
param: normalizeMutator(
|
|
3717
3810
|
workspace,
|
|
3718
3811
|
outputOptions.override.zod.preprocess.param
|
|
3719
3812
|
)
|
|
3720
3813
|
} : {},
|
|
3721
|
-
...((
|
|
3814
|
+
...((_ub = (_tb = (_sb = outputOptions.override) == null ? void 0 : _sb.zod) == null ? void 0 : _tb.preprocess) == null ? void 0 : _ub.query) ? {
|
|
3722
3815
|
query: normalizeMutator(
|
|
3723
3816
|
workspace,
|
|
3724
3817
|
outputOptions.override.zod.preprocess.query
|
|
3725
3818
|
)
|
|
3726
3819
|
} : {},
|
|
3727
|
-
...((
|
|
3820
|
+
...((_xb = (_wb = (_vb = outputOptions.override) == null ? void 0 : _vb.zod) == null ? void 0 : _wb.preprocess) == null ? void 0 : _xb.header) ? {
|
|
3728
3821
|
header: normalizeMutator(
|
|
3729
3822
|
workspace,
|
|
3730
3823
|
outputOptions.override.zod.preprocess.header
|
|
3731
3824
|
)
|
|
3732
3825
|
} : {},
|
|
3733
|
-
...((
|
|
3826
|
+
...((_Ab = (_zb = (_yb = outputOptions.override) == null ? void 0 : _yb.zod) == null ? void 0 : _zb.preprocess) == null ? void 0 : _Ab.body) ? {
|
|
3734
3827
|
body: normalizeMutator(
|
|
3735
3828
|
workspace,
|
|
3736
3829
|
outputOptions.override.zod.preprocess.body
|
|
3737
3830
|
)
|
|
3738
3831
|
} : {},
|
|
3739
|
-
...((
|
|
3832
|
+
...((_Db = (_Cb = (_Bb = outputOptions.override) == null ? void 0 : _Bb.zod) == null ? void 0 : _Cb.preprocess) == null ? void 0 : _Db.response) ? {
|
|
3740
3833
|
response: normalizeMutator(
|
|
3741
3834
|
workspace,
|
|
3742
3835
|
outputOptions.override.zod.preprocess.response
|
|
3743
3836
|
)
|
|
3744
3837
|
} : {}
|
|
3745
3838
|
},
|
|
3746
|
-
generateEachHttpStatus: (
|
|
3747
|
-
dateTimeOptions: (
|
|
3839
|
+
generateEachHttpStatus: (_Gb = (_Fb = (_Eb = outputOptions.override) == null ? void 0 : _Eb.zod) == null ? void 0 : _Fb.generateEachHttpStatus) != null ? _Gb : false,
|
|
3840
|
+
dateTimeOptions: (_Jb = (_Ib = (_Hb = outputOptions.override) == null ? void 0 : _Hb.zod) == null ? void 0 : _Ib.dateTimeOptions) != null ? _Jb : {}
|
|
3748
3841
|
},
|
|
3749
3842
|
swr: {
|
|
3750
|
-
...(
|
|
3843
|
+
...(_Lb = (_Kb = outputOptions.override) == null ? void 0 : _Kb.swr) != null ? _Lb : {}
|
|
3751
3844
|
},
|
|
3752
3845
|
angular: {
|
|
3753
|
-
provideIn: (
|
|
3846
|
+
provideIn: (_Ob = (_Nb = (_Mb = outputOptions.override) == null ? void 0 : _Mb.angular) == null ? void 0 : _Nb.provideIn) != null ? _Ob : "root"
|
|
3754
3847
|
},
|
|
3755
3848
|
fetch: {
|
|
3756
|
-
includeHttpResponseReturnType: (
|
|
3757
|
-
...(
|
|
3849
|
+
includeHttpResponseReturnType: (_Rb = (_Qb = (_Pb = outputOptions.override) == null ? void 0 : _Pb.fetch) == null ? void 0 : _Qb.includeHttpResponseReturnType) != null ? _Rb : true,
|
|
3850
|
+
...(_Tb = (_Sb = outputOptions.override) == null ? void 0 : _Sb.fetch) != null ? _Tb : {}
|
|
3758
3851
|
},
|
|
3759
|
-
useDates: ((
|
|
3760
|
-
useDeprecatedOperations: (
|
|
3761
|
-
|
|
3762
|
-
suppressReadonlyModifier: ((
|
|
3852
|
+
useDates: ((_Ub = outputOptions.override) == null ? void 0 : _Ub.useDates) || false,
|
|
3853
|
+
useDeprecatedOperations: (_Wb = (_Vb = outputOptions.override) == null ? void 0 : _Vb.useDeprecatedOperations) != null ? _Wb : true,
|
|
3854
|
+
enumGenerationType: ((_Yb = (_Xb = outputOptions.override) == null ? void 0 : _Xb.useNativeEnums) != null ? _Yb : false) ? "enum" : (__b = (_Zb = outputOptions.override) == null ? void 0 : _Zb.enumGenerationType) != null ? __b : "const",
|
|
3855
|
+
suppressReadonlyModifier: ((_$b = outputOptions.override) == null ? void 0 : _$b.suppressReadonlyModifier) || false
|
|
3763
3856
|
},
|
|
3764
|
-
allParamsOptional: (
|
|
3765
|
-
urlEncodeParameters: (
|
|
3766
|
-
optionsParamRequired: (
|
|
3767
|
-
propertySortOrder: (
|
|
3857
|
+
allParamsOptional: (_ac = outputOptions.allParamsOptional) != null ? _ac : false,
|
|
3858
|
+
urlEncodeParameters: (_bc = outputOptions.urlEncodeParameters) != null ? _bc : false,
|
|
3859
|
+
optionsParamRequired: (_cc = outputOptions.optionsParamRequired) != null ? _cc : false,
|
|
3860
|
+
propertySortOrder: (_dc = outputOptions.propertySortOrder) != null ? _dc : import_core8.PropertySortOrder.SPECIFICATION
|
|
3768
3861
|
},
|
|
3769
3862
|
hooks: options.hooks ? normalizeHooks(options.hooks) : {}
|
|
3770
3863
|
};
|
|
3771
3864
|
if (!normalizedOptions.input.target) {
|
|
3772
|
-
(0,
|
|
3865
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an input target`));
|
|
3773
3866
|
process.exit(1);
|
|
3774
3867
|
}
|
|
3775
3868
|
if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) {
|
|
3776
|
-
(0,
|
|
3777
|
-
|
|
3869
|
+
(0, import_core8.createLogger)().error(
|
|
3870
|
+
import_chalk3.default.red(`Config require an output target or schemas`)
|
|
3778
3871
|
);
|
|
3779
3872
|
process.exit(1);
|
|
3780
3873
|
}
|
|
@@ -3786,36 +3879,36 @@ var parserDefaultOptions = {
|
|
|
3786
3879
|
};
|
|
3787
3880
|
var normalizeMutator = (workspace, mutator) => {
|
|
3788
3881
|
var _a;
|
|
3789
|
-
if ((0,
|
|
3882
|
+
if ((0, import_core8.isObject)(mutator)) {
|
|
3790
3883
|
if (!mutator.path) {
|
|
3791
|
-
(0,
|
|
3884
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Mutator need a path`));
|
|
3792
3885
|
process.exit(1);
|
|
3793
3886
|
}
|
|
3794
3887
|
return {
|
|
3795
3888
|
...mutator,
|
|
3796
|
-
path:
|
|
3889
|
+
path: import_core8.upath.resolve(workspace, mutator.path),
|
|
3797
3890
|
default: (_a = mutator.default || !mutator.name) != null ? _a : false
|
|
3798
3891
|
};
|
|
3799
3892
|
}
|
|
3800
|
-
if ((0,
|
|
3893
|
+
if ((0, import_core8.isString)(mutator)) {
|
|
3801
3894
|
return {
|
|
3802
|
-
path:
|
|
3895
|
+
path: import_core8.upath.resolve(workspace, mutator),
|
|
3803
3896
|
default: true
|
|
3804
3897
|
};
|
|
3805
3898
|
}
|
|
3806
3899
|
return mutator;
|
|
3807
3900
|
};
|
|
3808
3901
|
var normalizePathOrUrl = (path, workspace) => {
|
|
3809
|
-
if ((0,
|
|
3902
|
+
if ((0, import_core8.isString)(path) && !(0, import_core8.isUrl)(path)) {
|
|
3810
3903
|
return normalizePath(path, workspace);
|
|
3811
3904
|
}
|
|
3812
3905
|
return path;
|
|
3813
3906
|
};
|
|
3814
3907
|
var normalizePath = (path, workspace) => {
|
|
3815
|
-
if (!(0,
|
|
3908
|
+
if (!(0, import_core8.isString)(path)) {
|
|
3816
3909
|
return path;
|
|
3817
3910
|
}
|
|
3818
|
-
return
|
|
3911
|
+
return import_core8.upath.resolve(workspace, path);
|
|
3819
3912
|
};
|
|
3820
3913
|
var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
3821
3914
|
return Object.fromEntries(
|
|
@@ -3902,11 +3995,9 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3902
3995
|
} : {},
|
|
3903
3996
|
...transformer ? { transformer: normalizePath(transformer, workspace) } : {},
|
|
3904
3997
|
...mutator ? { mutator: normalizeMutator(workspace, mutator) } : {},
|
|
3905
|
-
...formData
|
|
3906
|
-
formData: !(0, import_core7.isBoolean)(formData) ? normalizeMutator(workspace, formData) : formData
|
|
3907
|
-
} : {},
|
|
3998
|
+
...createFormData(workspace, formData),
|
|
3908
3999
|
...formUrlEncoded ? {
|
|
3909
|
-
formUrlEncoded: !(0,
|
|
4000
|
+
formUrlEncoded: !(0, import_core8.isBoolean)(formUrlEncoded) ? normalizeMutator(workspace, formUrlEncoded) : formUrlEncoded
|
|
3910
4001
|
} : {},
|
|
3911
4002
|
...paramsSerializer ? {
|
|
3912
4003
|
paramsSerializer: normalizeMutator(
|
|
@@ -3922,18 +4013,18 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3922
4013
|
};
|
|
3923
4014
|
var normalizeOutputMode = (mode) => {
|
|
3924
4015
|
if (!mode) {
|
|
3925
|
-
return
|
|
4016
|
+
return import_core8.OutputMode.SINGLE;
|
|
3926
4017
|
}
|
|
3927
|
-
if (!Object.values(
|
|
3928
|
-
(0,
|
|
3929
|
-
return
|
|
4018
|
+
if (!Object.values(import_core8.OutputMode).includes(mode)) {
|
|
4019
|
+
(0, import_core8.createLogger)().warn(import_chalk3.default.yellow(`Unknown the provided mode => ${mode}`));
|
|
4020
|
+
return import_core8.OutputMode.SINGLE;
|
|
3930
4021
|
}
|
|
3931
4022
|
return mode;
|
|
3932
4023
|
};
|
|
3933
4024
|
var normalizeHooks = (hooks) => {
|
|
3934
4025
|
const keys = Object.keys(hooks);
|
|
3935
4026
|
return keys.reduce((acc, key) => {
|
|
3936
|
-
if ((0,
|
|
4027
|
+
if ((0, import_core8.isString)(hooks[key])) {
|
|
3937
4028
|
return {
|
|
3938
4029
|
...acc,
|
|
3939
4030
|
[key]: [hooks[key]]
|
|
@@ -3943,12 +4034,12 @@ var normalizeHooks = (hooks) => {
|
|
|
3943
4034
|
...acc,
|
|
3944
4035
|
[key]: hooks[key]
|
|
3945
4036
|
};
|
|
3946
|
-
} else if ((0,
|
|
4037
|
+
} else if ((0, import_core8.isFunction)(hooks[key])) {
|
|
3947
4038
|
return {
|
|
3948
4039
|
...acc,
|
|
3949
4040
|
[key]: [hooks[key]]
|
|
3950
4041
|
};
|
|
3951
|
-
} else if ((0,
|
|
4042
|
+
} else if ((0, import_core8.isObject)(hooks[key])) {
|
|
3952
4043
|
return {
|
|
3953
4044
|
...acc,
|
|
3954
4045
|
[key]: [hooks[key]]
|
|
@@ -3960,10 +4051,10 @@ var normalizeHooks = (hooks) => {
|
|
|
3960
4051
|
var normalizeHonoOptions = (hono2 = {}, workspace) => {
|
|
3961
4052
|
var _a, _b;
|
|
3962
4053
|
return {
|
|
3963
|
-
...hono2.handlers ? { handlers:
|
|
4054
|
+
...hono2.handlers ? { handlers: import_core8.upath.resolve(workspace, hono2.handlers) } : {},
|
|
3964
4055
|
compositeRoute: (_a = hono2.compositeRoute) != null ? _a : "",
|
|
3965
4056
|
validator: (_b = hono2.validator) != null ? _b : true,
|
|
3966
|
-
validatorOutputPath: hono2.validatorOutputPath ?
|
|
4057
|
+
validatorOutputPath: hono2.validatorOutputPath ? import_core8.upath.resolve(workspace, hono2.validatorOutputPath) : ""
|
|
3967
4058
|
};
|
|
3968
4059
|
};
|
|
3969
4060
|
var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions = {}) => {
|
|
@@ -3973,12 +4064,12 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
3973
4064
|
);
|
|
3974
4065
|
}
|
|
3975
4066
|
return {
|
|
3976
|
-
...!(0,
|
|
3977
|
-
...!(0,
|
|
3978
|
-
...!(0,
|
|
3979
|
-
...!(0,
|
|
3980
|
-
...!(0,
|
|
3981
|
-
...!(0,
|
|
4067
|
+
...!(0, import_core8.isUndefined)(queryOptions.usePrefetch) ? { usePrefetch: queryOptions.usePrefetch } : {},
|
|
4068
|
+
...!(0, import_core8.isUndefined)(queryOptions.useQuery) ? { useQuery: queryOptions.useQuery } : {},
|
|
4069
|
+
...!(0, import_core8.isUndefined)(queryOptions.useSuspenseQuery) ? { useSuspenseQuery: queryOptions.useSuspenseQuery } : {},
|
|
4070
|
+
...!(0, import_core8.isUndefined)(queryOptions.useMutation) ? { useMutation: queryOptions.useMutation } : {},
|
|
4071
|
+
...!(0, import_core8.isUndefined)(queryOptions.useInfinite) ? { useInfinite: queryOptions.useInfinite } : {},
|
|
4072
|
+
...!(0, import_core8.isUndefined)(queryOptions.useSuspenseInfiniteQuery) ? { useSuspenseInfiniteQuery: queryOptions.useSuspenseInfiniteQuery } : {},
|
|
3982
4073
|
...queryOptions.useInfiniteQueryParam ? { useInfiniteQueryParam: queryOptions.useInfiniteQueryParam } : {},
|
|
3983
4074
|
...queryOptions.options ? { options: queryOptions.options } : {},
|
|
3984
4075
|
...globalOptions.queryKey ? {
|
|
@@ -4005,30 +4096,30 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
4005
4096
|
queryOptions == null ? void 0 : queryOptions.mutationOptions
|
|
4006
4097
|
)
|
|
4007
4098
|
} : {},
|
|
4008
|
-
...!(0,
|
|
4099
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportQueryKey) ? {
|
|
4009
4100
|
shouldExportQueryKey: globalOptions.shouldExportQueryKey
|
|
4010
4101
|
} : {},
|
|
4011
|
-
...!(0,
|
|
4012
|
-
...!(0,
|
|
4102
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportQueryKey) ? { shouldExportQueryKey: queryOptions.shouldExportQueryKey } : {},
|
|
4103
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportHttpClient) ? {
|
|
4013
4104
|
shouldExportHttpClient: globalOptions.shouldExportHttpClient
|
|
4014
4105
|
} : {},
|
|
4015
|
-
...!(0,
|
|
4016
|
-
...!(0,
|
|
4106
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportHttpClient) ? { shouldExportHttpClient: queryOptions.shouldExportHttpClient } : {},
|
|
4107
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportMutatorHooks) ? {
|
|
4017
4108
|
shouldExportMutatorHooks: globalOptions.shouldExportMutatorHooks
|
|
4018
4109
|
} : {},
|
|
4019
|
-
...!(0,
|
|
4020
|
-
...!(0,
|
|
4110
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportMutatorHooks) ? { shouldExportMutatorHooks: queryOptions.shouldExportMutatorHooks } : {},
|
|
4111
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldSplitQueryKey) ? {
|
|
4021
4112
|
shouldSplitQueryKey: globalOptions.shouldSplitQueryKey
|
|
4022
4113
|
} : {},
|
|
4023
|
-
...!(0,
|
|
4024
|
-
...!(0,
|
|
4114
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldSplitQueryKey) ? { shouldSplitQueryKey: queryOptions.shouldSplitQueryKey } : {},
|
|
4115
|
+
...!(0, import_core8.isUndefined)(globalOptions.signal) ? {
|
|
4025
4116
|
signal: globalOptions.signal
|
|
4026
4117
|
} : {},
|
|
4027
|
-
...!(0,
|
|
4028
|
-
...!(0,
|
|
4118
|
+
...!(0, import_core8.isUndefined)(queryOptions.signal) ? { signal: queryOptions.signal } : {},
|
|
4119
|
+
...!(0, import_core8.isUndefined)(globalOptions.version) ? {
|
|
4029
4120
|
version: globalOptions.version
|
|
4030
4121
|
} : {},
|
|
4031
|
-
...!(0,
|
|
4122
|
+
...!(0, import_core8.isUndefined)(queryOptions.version) ? { version: queryOptions.version } : {}
|
|
4032
4123
|
};
|
|
4033
4124
|
};
|
|
4034
4125
|
var getDefaultFilesHeader = ({
|
|
@@ -4044,7 +4135,7 @@ var getDefaultFilesHeader = ({
|
|
|
4044
4135
|
];
|
|
4045
4136
|
|
|
4046
4137
|
// src/utils/watcher.ts
|
|
4047
|
-
var
|
|
4138
|
+
var import_core9 = require("@orval/core");
|
|
4048
4139
|
var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
4049
4140
|
if (!watchOptions) return;
|
|
4050
4141
|
const { watch } = await Promise.resolve().then(() => __toESM(require("chokidar")));
|
|
@@ -4052,7 +4143,7 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4052
4143
|
const watchPaths = typeof watchOptions === "boolean" ? defaultTarget : Array.isArray(watchOptions) ? watchOptions.filter(
|
|
4053
4144
|
(path) => typeof path === "string"
|
|
4054
4145
|
) : watchOptions;
|
|
4055
|
-
(0,
|
|
4146
|
+
(0, import_core9.log)(
|
|
4056
4147
|
`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`
|
|
4057
4148
|
);
|
|
4058
4149
|
const watcher = watch(watchPaths, {
|
|
@@ -4060,40 +4151,40 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4060
4151
|
ignored
|
|
4061
4152
|
});
|
|
4062
4153
|
watcher.on("all", async (type2, file) => {
|
|
4063
|
-
(0,
|
|
4154
|
+
(0, import_core9.log)(`Change detected: ${type2} ${file}`);
|
|
4064
4155
|
try {
|
|
4065
4156
|
await watchFn();
|
|
4066
4157
|
} catch (e) {
|
|
4067
|
-
(0,
|
|
4158
|
+
(0, import_core9.logError)(e);
|
|
4068
4159
|
}
|
|
4069
4160
|
});
|
|
4070
4161
|
};
|
|
4071
4162
|
|
|
4072
4163
|
// src/write-specs.ts
|
|
4073
|
-
var
|
|
4074
|
-
var
|
|
4164
|
+
var import_core11 = require("@orval/core");
|
|
4165
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
4075
4166
|
var import_execa2 = __toESM(require("execa"));
|
|
4076
4167
|
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
4077
4168
|
var import_lodash = __toESM(require("lodash.uniq"));
|
|
4078
4169
|
|
|
4079
4170
|
// src/utils/executeHook.ts
|
|
4080
|
-
var
|
|
4081
|
-
var
|
|
4171
|
+
var import_core10 = require("@orval/core");
|
|
4172
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
4082
4173
|
var import_execa = __toESM(require("execa"));
|
|
4083
4174
|
var import_string_argv = require("string-argv");
|
|
4084
4175
|
var executeHook = async (name, commands = [], args = []) => {
|
|
4085
|
-
(0,
|
|
4176
|
+
(0, import_core10.log)(import_chalk4.default.white(`Running ${name} hook...`));
|
|
4086
4177
|
for (const command of commands) {
|
|
4087
4178
|
try {
|
|
4088
|
-
if ((0,
|
|
4179
|
+
if ((0, import_core10.isString)(command)) {
|
|
4089
4180
|
await executeCommand(command, args);
|
|
4090
|
-
} else if ((0,
|
|
4181
|
+
} else if ((0, import_core10.isFunction)(command)) {
|
|
4091
4182
|
await command(args);
|
|
4092
|
-
} else if ((0,
|
|
4183
|
+
} else if ((0, import_core10.isObject)(command)) {
|
|
4093
4184
|
await executeObjectCommand(command, args);
|
|
4094
4185
|
}
|
|
4095
4186
|
} catch (e) {
|
|
4096
|
-
(0,
|
|
4187
|
+
(0, import_core10.logError)(e, `Failed to run ${name} hook`);
|
|
4097
4188
|
}
|
|
4098
4189
|
}
|
|
4099
4190
|
};
|
|
@@ -4105,9 +4196,9 @@ async function executeObjectCommand(command, args) {
|
|
|
4105
4196
|
if (command.injectGeneratedDirsAndFiles === false) {
|
|
4106
4197
|
args = [];
|
|
4107
4198
|
}
|
|
4108
|
-
if ((0,
|
|
4199
|
+
if ((0, import_core10.isString)(command.command)) {
|
|
4109
4200
|
await executeCommand(command.command, args);
|
|
4110
|
-
} else if ((0,
|
|
4201
|
+
} else if ((0, import_core10.isFunction)(command.command)) {
|
|
4111
4202
|
await command.command();
|
|
4112
4203
|
}
|
|
4113
4204
|
}
|
|
@@ -4118,7 +4209,7 @@ var getHeader = (option, info) => {
|
|
|
4118
4209
|
return "";
|
|
4119
4210
|
}
|
|
4120
4211
|
const header = option(info);
|
|
4121
|
-
return Array.isArray(header) ? (0,
|
|
4212
|
+
return Array.isArray(header) ? (0, import_core11.jsDoc)({ description: header }) : header;
|
|
4122
4213
|
};
|
|
4123
4214
|
var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
4124
4215
|
var _a, _b;
|
|
@@ -4127,7 +4218,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4127
4218
|
const projectTitle = projectName || info.title;
|
|
4128
4219
|
const specsName = Object.keys(schemas).reduce(
|
|
4129
4220
|
(acc, specKey) => {
|
|
4130
|
-
const basePath =
|
|
4221
|
+
const basePath = import_core11.upath.getSpecName(specKey, target);
|
|
4131
4222
|
const name = basePath.slice(1).split("/").join("-");
|
|
4132
4223
|
acc[specKey] = name;
|
|
4133
4224
|
return acc;
|
|
@@ -4140,8 +4231,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4140
4231
|
const fileExtension = ["tags", "tags-split", "split"].includes(output.mode) ? ".ts" : (_a = output.fileExtension) != null ? _a : ".ts";
|
|
4141
4232
|
await Promise.all(
|
|
4142
4233
|
Object.entries(schemas).map(([specKey, schemas2]) => {
|
|
4143
|
-
const schemaPath = !(0,
|
|
4144
|
-
return (0,
|
|
4234
|
+
const schemaPath = !(0, import_core11.isRootKey)(specKey, target) ? import_core11.upath.join(rootSchemaPath, specsName[specKey]) : rootSchemaPath;
|
|
4235
|
+
return (0, import_core11.writeSchemas)({
|
|
4145
4236
|
schemaPath,
|
|
4146
4237
|
schemas: schemas2,
|
|
4147
4238
|
target,
|
|
@@ -4149,7 +4240,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4149
4240
|
fileExtension,
|
|
4150
4241
|
specsName,
|
|
4151
4242
|
specKey,
|
|
4152
|
-
isRootKey: (0,
|
|
4243
|
+
isRootKey: (0, import_core11.isRootKey)(specKey, target),
|
|
4153
4244
|
header,
|
|
4154
4245
|
indexFiles: output.indexFiles
|
|
4155
4246
|
});
|
|
@@ -4171,20 +4262,20 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4171
4262
|
if (output.workspace) {
|
|
4172
4263
|
const workspacePath = output.workspace;
|
|
4173
4264
|
const imports = implementationPaths.filter(
|
|
4174
|
-
(path) => !output.mock || !path.endsWith(`.${(0,
|
|
4265
|
+
(path) => !output.mock || !path.endsWith(`.${(0, import_core11.getMockFileExtensionByTypeName)(output.mock)}.ts`)
|
|
4175
4266
|
).map(
|
|
4176
|
-
(path) =>
|
|
4267
|
+
(path) => import_core11.upath.relativeSafe(
|
|
4177
4268
|
workspacePath,
|
|
4178
|
-
(0,
|
|
4269
|
+
(0, import_core11.getFileInfo)(path).pathWithoutExtension
|
|
4179
4270
|
)
|
|
4180
4271
|
);
|
|
4181
4272
|
if (output.schemas) {
|
|
4182
4273
|
imports.push(
|
|
4183
|
-
|
|
4274
|
+
import_core11.upath.relativeSafe(workspacePath, (0, import_core11.getFileInfo)(output.schemas).dirname)
|
|
4184
4275
|
);
|
|
4185
4276
|
}
|
|
4186
4277
|
if (output.indexFiles) {
|
|
4187
|
-
const indexFile =
|
|
4278
|
+
const indexFile = import_core11.upath.join(workspacePath, "/index.ts");
|
|
4188
4279
|
if (await import_fs_extra5.default.pathExists(indexFile)) {
|
|
4189
4280
|
const data = await import_fs_extra5.default.readFile(indexFile, "utf8");
|
|
4190
4281
|
const importsNotDeclared = imports.filter((imp) => !data.includes(imp));
|
|
@@ -4214,7 +4305,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4214
4305
|
];
|
|
4215
4306
|
}
|
|
4216
4307
|
const paths = [
|
|
4217
|
-
...output.schemas ? [(0,
|
|
4308
|
+
...output.schemas ? [(0, import_core11.getFileInfo)(output.schemas).dirname] : [],
|
|
4218
4309
|
...implementationPaths
|
|
4219
4310
|
];
|
|
4220
4311
|
if (options.hooks.afterAllFilesWrite) {
|
|
@@ -4228,8 +4319,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4228
4319
|
try {
|
|
4229
4320
|
await (0, import_execa2.default)("prettier", ["--write", ...paths]);
|
|
4230
4321
|
} catch {
|
|
4231
|
-
(0,
|
|
4232
|
-
|
|
4322
|
+
(0, import_core11.log)(
|
|
4323
|
+
import_chalk5.default.yellow(
|
|
4233
4324
|
`\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Prettier not found`
|
|
4234
4325
|
)
|
|
4235
4326
|
);
|
|
@@ -4240,7 +4331,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4240
4331
|
await (0, import_execa2.default)("biome", ["check", "--write", ...paths]);
|
|
4241
4332
|
} catch (e) {
|
|
4242
4333
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}biome not found`;
|
|
4243
|
-
(0,
|
|
4334
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4244
4335
|
}
|
|
4245
4336
|
}
|
|
4246
4337
|
if (output.docs) {
|
|
@@ -4279,22 +4370,22 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4279
4370
|
}
|
|
4280
4371
|
} catch (e) {
|
|
4281
4372
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Unable to generate docs`;
|
|
4282
|
-
(0,
|
|
4373
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4283
4374
|
}
|
|
4284
4375
|
}
|
|
4285
|
-
(0,
|
|
4376
|
+
(0, import_core11.createSuccessMessage)(projectTitle);
|
|
4286
4377
|
};
|
|
4287
4378
|
var getWriteMode = (mode) => {
|
|
4288
4379
|
switch (mode) {
|
|
4289
|
-
case
|
|
4290
|
-
return
|
|
4291
|
-
case
|
|
4292
|
-
return
|
|
4293
|
-
case
|
|
4294
|
-
return
|
|
4295
|
-
case
|
|
4380
|
+
case import_core11.OutputMode.SPLIT:
|
|
4381
|
+
return import_core11.writeSplitMode;
|
|
4382
|
+
case import_core11.OutputMode.TAGS:
|
|
4383
|
+
return import_core11.writeTagsMode;
|
|
4384
|
+
case import_core11.OutputMode.TAGS_SPLIT:
|
|
4385
|
+
return import_core11.writeSplitTagsMode;
|
|
4386
|
+
case import_core11.OutputMode.SINGLE:
|
|
4296
4387
|
default:
|
|
4297
|
-
return
|
|
4388
|
+
return import_core11.writeSingleMode;
|
|
4298
4389
|
}
|
|
4299
4390
|
};
|
|
4300
4391
|
|
|
@@ -4303,18 +4394,18 @@ var generateSpec = async (workspace, options, projectName) => {
|
|
|
4303
4394
|
if (options.output.clean) {
|
|
4304
4395
|
const extraPatterns = Array.isArray(options.output.clean) ? options.output.clean : [];
|
|
4305
4396
|
if (options.output.target) {
|
|
4306
|
-
await (0,
|
|
4397
|
+
await (0, import_core12.removeFiles)(
|
|
4307
4398
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4308
|
-
(0,
|
|
4399
|
+
(0, import_core12.getFileInfo)(options.output.target).dirname
|
|
4309
4400
|
);
|
|
4310
4401
|
}
|
|
4311
4402
|
if (options.output.schemas) {
|
|
4312
|
-
await (0,
|
|
4403
|
+
await (0, import_core12.removeFiles)(
|
|
4313
4404
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4314
|
-
(0,
|
|
4405
|
+
(0, import_core12.getFileInfo)(options.output.schemas).dirname
|
|
4315
4406
|
);
|
|
4316
4407
|
}
|
|
4317
|
-
(0,
|
|
4408
|
+
(0, import_core12.log)(`${projectName ? `${projectName}: ` : ""}Cleaning output folder`);
|
|
4318
4409
|
}
|
|
4319
4410
|
const writeSpecBuilder = await importSpecs(workspace, options);
|
|
4320
4411
|
await writeSpecs(writeSpecBuilder, workspace, options, projectName);
|
|
@@ -4326,24 +4417,24 @@ var generateSpecs = async (config, workspace, projectName) => {
|
|
|
4326
4417
|
try {
|
|
4327
4418
|
await generateSpec(workspace, options, projectName);
|
|
4328
4419
|
} catch (e) {
|
|
4329
|
-
(0,
|
|
4420
|
+
(0, import_core12.logError)(e, projectName);
|
|
4330
4421
|
process.exit(1);
|
|
4331
4422
|
}
|
|
4332
4423
|
} else {
|
|
4333
|
-
(0,
|
|
4424
|
+
(0, import_core12.logError)("Project not found");
|
|
4334
4425
|
process.exit(1);
|
|
4335
4426
|
}
|
|
4336
4427
|
return;
|
|
4337
4428
|
}
|
|
4338
4429
|
let hasErrors;
|
|
4339
|
-
const accumulate = await (0,
|
|
4430
|
+
const accumulate = await (0, import_core12.asyncReduce)(
|
|
4340
4431
|
Object.entries(config),
|
|
4341
4432
|
async (acc, [projectName2, options]) => {
|
|
4342
4433
|
try {
|
|
4343
4434
|
acc.push(await generateSpec(workspace, options, projectName2));
|
|
4344
4435
|
} catch (e) {
|
|
4345
4436
|
hasErrors = true;
|
|
4346
|
-
(0,
|
|
4437
|
+
(0, import_core12.logError)(e, projectName2);
|
|
4347
4438
|
}
|
|
4348
4439
|
return acc;
|
|
4349
4440
|
},
|
|
@@ -4357,15 +4448,15 @@ var generateConfig = async (configFile, options) => {
|
|
|
4357
4448
|
path,
|
|
4358
4449
|
file: configExternal,
|
|
4359
4450
|
error
|
|
4360
|
-
} = await (0,
|
|
4451
|
+
} = await (0, import_core12.loadFile)(configFile, {
|
|
4361
4452
|
defaultFileName: "orval.config"
|
|
4362
4453
|
});
|
|
4363
4454
|
if (!configExternal) {
|
|
4364
4455
|
throw `failed to load from ${path} => ${error}`;
|
|
4365
4456
|
}
|
|
4366
|
-
const workspace =
|
|
4367
|
-
const config = await ((0,
|
|
4368
|
-
const normalizedConfig = await (0,
|
|
4457
|
+
const workspace = import_core12.upath.dirname(path);
|
|
4458
|
+
const config = await ((0, import_core12.isFunction)(configExternal) ? configExternal() : configExternal);
|
|
4459
|
+
const normalizedConfig = await (0, import_core12.asyncReduce)(
|
|
4369
4460
|
Object.entries(config),
|
|
4370
4461
|
async (acc, [key, value]) => {
|
|
4371
4462
|
acc[key] = await normalizeOptions(value, workspace, options);
|
|
@@ -4375,7 +4466,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4375
4466
|
);
|
|
4376
4467
|
const fileToWatch = Object.entries(normalizedConfig).filter(
|
|
4377
4468
|
([project]) => (options == null ? void 0 : options.projectName) === void 0 || project === (options == null ? void 0 : options.projectName)
|
|
4378
|
-
).map(([, { input }]) => input.target).filter((target) => (0,
|
|
4469
|
+
).map(([, { input }]) => input.target).filter((target) => (0, import_core12.isString)(target));
|
|
4379
4470
|
if ((options == null ? void 0 : options.watch) && fileToWatch.length) {
|
|
4380
4471
|
startWatcher(
|
|
4381
4472
|
options == null ? void 0 : options.watch,
|
|
@@ -4390,7 +4481,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4390
4481
|
// src/index.ts
|
|
4391
4482
|
__reExport(src_exports, require("@orval/core"), module.exports);
|
|
4392
4483
|
var generate = async (optionsExport, workspace = process.cwd(), options) => {
|
|
4393
|
-
if (!optionsExport || (0,
|
|
4484
|
+
if (!optionsExport || (0, import_core13.isString)(optionsExport)) {
|
|
4394
4485
|
return generateConfig(optionsExport, options);
|
|
4395
4486
|
}
|
|
4396
4487
|
const normalizedOptions = await normalizeOptions(
|
|
@@ -4405,7 +4496,7 @@ var generate = async (optionsExport, workspace = process.cwd(), options) => {
|
|
|
4405
4496
|
try {
|
|
4406
4497
|
await generateSpec(workspace, normalizedOptions);
|
|
4407
4498
|
} catch (e) {
|
|
4408
|
-
(0,
|
|
4499
|
+
(0, import_core13.logError)(e, options == null ? void 0 : options.projectName);
|
|
4409
4500
|
}
|
|
4410
4501
|
},
|
|
4411
4502
|
normalizedOptions.input.target
|
|
@@ -4414,7 +4505,7 @@ var generate = async (optionsExport, workspace = process.cwd(), options) => {
|
|
|
4414
4505
|
try {
|
|
4415
4506
|
return await generateSpec(workspace, normalizedOptions);
|
|
4416
4507
|
} catch (e) {
|
|
4417
|
-
(0,
|
|
4508
|
+
(0, import_core13.logError)(e, options == null ? void 0 : options.projectName);
|
|
4418
4509
|
}
|
|
4419
4510
|
}
|
|
4420
4511
|
};
|