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/bin/orval.js
CHANGED
|
@@ -24,11 +24,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/bin/orval.ts
|
|
27
|
-
var
|
|
27
|
+
var import_core13 = require("@orval/core");
|
|
28
28
|
var import_cac = require("cac");
|
|
29
29
|
|
|
30
30
|
// src/generate.ts
|
|
31
|
-
var
|
|
31
|
+
var import_core12 = require("@orval/core");
|
|
32
32
|
|
|
33
33
|
// src/import-specs.ts
|
|
34
34
|
var import_swagger_parser = __toESM(require("@apidevtools/swagger-parser"));
|
|
@@ -2677,6 +2677,7 @@ var mock = __toESM(require("@orval/mock"));
|
|
|
2677
2677
|
var import_query = __toESM(require("@orval/query"));
|
|
2678
2678
|
var import_swr = __toESM(require("@orval/swr"));
|
|
2679
2679
|
var import_zod = __toESM(require("@orval/zod"));
|
|
2680
|
+
var import_mcp = __toESM(require("@orval/mcp"));
|
|
2680
2681
|
var DEFAULT_CLIENT = import_core.OutputClient.AXIOS;
|
|
2681
2682
|
var getGeneratorClient = (outputClient, output) => {
|
|
2682
2683
|
const GENERATOR_CLIENT = {
|
|
@@ -2689,7 +2690,8 @@ var getGeneratorClient = (outputClient, output) => {
|
|
|
2689
2690
|
swr: (0, import_swr.default)()(),
|
|
2690
2691
|
zod: (0, import_zod.default)()(),
|
|
2691
2692
|
hono: (0, import_hono.default)()(),
|
|
2692
|
-
fetch: (0, import_fetch.default)()()
|
|
2693
|
+
fetch: (0, import_fetch.default)()(),
|
|
2694
|
+
mcp: (0, import_mcp.default)()()
|
|
2693
2695
|
};
|
|
2694
2696
|
const generator = (0, import_core.isFunction)(outputClient) ? outputClient(GENERATOR_CLIENT) : GENERATOR_CLIENT[outputClient];
|
|
2695
2697
|
if (!generator) {
|
|
@@ -3228,15 +3230,15 @@ var importSpecs = async (workspace, options) => {
|
|
|
3228
3230
|
};
|
|
3229
3231
|
|
|
3230
3232
|
// src/utils/options.ts
|
|
3231
|
-
var
|
|
3233
|
+
var import_core8 = require("@orval/core");
|
|
3232
3234
|
var import_mock2 = require("@orval/mock");
|
|
3233
|
-
var
|
|
3235
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
3234
3236
|
|
|
3235
3237
|
// package.json
|
|
3236
3238
|
var package_default = {
|
|
3237
3239
|
name: "orval",
|
|
3238
3240
|
description: "A swagger client generator for typescript",
|
|
3239
|
-
version: "7.
|
|
3241
|
+
version: "7.9.0",
|
|
3240
3242
|
license: "MIT",
|
|
3241
3243
|
files: [
|
|
3242
3244
|
"dist"
|
|
@@ -3291,15 +3293,16 @@ var package_default = {
|
|
|
3291
3293
|
},
|
|
3292
3294
|
dependencies: {
|
|
3293
3295
|
"@apidevtools/swagger-parser": "^10.1.1",
|
|
3294
|
-
"@orval/angular": "7.
|
|
3295
|
-
"@orval/axios": "7.
|
|
3296
|
-
"@orval/core": "7.
|
|
3297
|
-
"@orval/fetch": "7.
|
|
3298
|
-
"@orval/hono": "7.
|
|
3299
|
-
"@orval/
|
|
3300
|
-
"@orval/
|
|
3301
|
-
"@orval/
|
|
3302
|
-
"@orval/
|
|
3296
|
+
"@orval/angular": "7.9.0",
|
|
3297
|
+
"@orval/axios": "7.9.0",
|
|
3298
|
+
"@orval/core": "7.9.0",
|
|
3299
|
+
"@orval/fetch": "7.9.0",
|
|
3300
|
+
"@orval/hono": "7.9.0",
|
|
3301
|
+
"@orval/mcp": "7.9.0",
|
|
3302
|
+
"@orval/mock": "7.9.0",
|
|
3303
|
+
"@orval/query": "7.9.0",
|
|
3304
|
+
"@orval/swr": "7.9.0",
|
|
3305
|
+
"@orval/zod": "7.9.0",
|
|
3303
3306
|
ajv: "^8.17.1",
|
|
3304
3307
|
cac: "^6.7.14",
|
|
3305
3308
|
chalk: "^4.1.2",
|
|
@@ -3470,6 +3473,8 @@ var githubResolver = {
|
|
|
3470
3473
|
};
|
|
3471
3474
|
|
|
3472
3475
|
// src/utils/package-json.ts
|
|
3476
|
+
var import_core6 = require("@orval/core");
|
|
3477
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
3473
3478
|
var import_find_up = __toESM(require("find-up"));
|
|
3474
3479
|
var import_fs_extra3 = __toESM(require("fs-extra"));
|
|
3475
3480
|
var loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
@@ -3479,26 +3484,88 @@ var loadPackageJson = async (packageJson, workspace = process.cwd()) => {
|
|
|
3479
3484
|
});
|
|
3480
3485
|
if (pkgPath) {
|
|
3481
3486
|
const pkg = await Promise.resolve().then(() => __toESM(require(pkgPath)));
|
|
3482
|
-
return pkg;
|
|
3487
|
+
return await maybeReplaceCatalog(pkg, workspace);
|
|
3483
3488
|
}
|
|
3484
3489
|
return;
|
|
3485
3490
|
}
|
|
3486
3491
|
const normalizedPath = normalizePath(packageJson, workspace);
|
|
3487
3492
|
if (import_fs_extra3.default.existsSync(normalizedPath)) {
|
|
3488
3493
|
const pkg = await Promise.resolve().then(() => __toESM(require(normalizedPath)));
|
|
3489
|
-
return pkg;
|
|
3494
|
+
return await maybeReplaceCatalog(pkg, workspace);
|
|
3490
3495
|
}
|
|
3491
3496
|
return;
|
|
3492
3497
|
};
|
|
3498
|
+
var maybeReplaceCatalog = async (pkg, workspace) => {
|
|
3499
|
+
var _a, _b, _c;
|
|
3500
|
+
if (![
|
|
3501
|
+
...Object.entries((_a = pkg.dependencies) != null ? _a : {}),
|
|
3502
|
+
...Object.entries((_b = pkg.devDependencies) != null ? _b : {}),
|
|
3503
|
+
...Object.entries((_c = pkg.peerDependencies) != null ? _c : {})
|
|
3504
|
+
].some(([key]) => key.startsWith("catalog:"))) {
|
|
3505
|
+
return pkg;
|
|
3506
|
+
}
|
|
3507
|
+
const filePath = await (0, import_find_up.default)("pnpm-workspace.yaml", { cwd: workspace });
|
|
3508
|
+
if (!filePath) {
|
|
3509
|
+
(0, import_core6.log)(
|
|
3510
|
+
`\u26A0\uFE0F ${import_chalk2.default.yellow("package.json contains pnpm catalog: in dependencies, but no pnpm-workspace.yaml was found.")}`
|
|
3511
|
+
);
|
|
3512
|
+
return pkg;
|
|
3513
|
+
}
|
|
3514
|
+
const file = await import_fs_extra3.default.readFile(filePath, "utf8");
|
|
3515
|
+
const pnpmWorkspaceFile = js_yaml_default.load(file);
|
|
3516
|
+
performSubstitution(pkg.dependencies, pnpmWorkspaceFile);
|
|
3517
|
+
performSubstitution(pkg.devDependencies, pnpmWorkspaceFile);
|
|
3518
|
+
performSubstitution(pkg.peerDependencies, pnpmWorkspaceFile);
|
|
3519
|
+
return pkg;
|
|
3520
|
+
};
|
|
3521
|
+
var performSubstitution = (dependencies, pnpmWorkspaceFile) => {
|
|
3522
|
+
var _a, _b;
|
|
3523
|
+
if (!dependencies) return;
|
|
3524
|
+
for (const [packageName, version] of Object.entries(dependencies)) {
|
|
3525
|
+
if (version === "catalog:" || version === "catalog:default") {
|
|
3526
|
+
if (!pnpmWorkspaceFile.catalog) {
|
|
3527
|
+
(0, import_core6.log)(
|
|
3528
|
+
`\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.`)}`
|
|
3529
|
+
);
|
|
3530
|
+
continue;
|
|
3531
|
+
}
|
|
3532
|
+
const sub = pnpmWorkspaceFile.catalog[packageName];
|
|
3533
|
+
if (!sub) {
|
|
3534
|
+
(0, import_core6.log)(
|
|
3535
|
+
`\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.`)}`
|
|
3536
|
+
);
|
|
3537
|
+
continue;
|
|
3538
|
+
}
|
|
3539
|
+
dependencies[packageName] = sub;
|
|
3540
|
+
} else if (version.startsWith("catalog:")) {
|
|
3541
|
+
const catalogName = version.substring("catalog:".length);
|
|
3542
|
+
const catalog = (_a = pnpmWorkspaceFile.catalogs) == null ? void 0 : _a[catalogName];
|
|
3543
|
+
if (!catalog) {
|
|
3544
|
+
(0, import_core6.log)(
|
|
3545
|
+
`\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(", ")})`)}`
|
|
3546
|
+
);
|
|
3547
|
+
continue;
|
|
3548
|
+
}
|
|
3549
|
+
const sub = catalog[packageName];
|
|
3550
|
+
if (!sub) {
|
|
3551
|
+
(0, import_core6.log)(
|
|
3552
|
+
`\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(", ")})`)}`
|
|
3553
|
+
);
|
|
3554
|
+
continue;
|
|
3555
|
+
}
|
|
3556
|
+
dependencies[packageName] = sub;
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
};
|
|
3493
3560
|
|
|
3494
3561
|
// src/utils/tsconfig.ts
|
|
3495
|
-
var
|
|
3562
|
+
var import_core7 = require("@orval/core");
|
|
3496
3563
|
var import_find_up2 = __toESM(require("find-up"));
|
|
3497
3564
|
var import_fs_extra4 = __toESM(require("fs-extra"));
|
|
3498
3565
|
var import_tsconfck = require("tsconfck");
|
|
3499
3566
|
var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
3500
3567
|
var _a, _b;
|
|
3501
|
-
if ((0,
|
|
3568
|
+
if ((0, import_core7.isUndefined)(tsconfig)) {
|
|
3502
3569
|
const configPath = await (0, import_find_up2.default)(["tsconfig.json", "jsconfig.json"], {
|
|
3503
3570
|
cwd: workspace
|
|
3504
3571
|
});
|
|
@@ -3508,7 +3575,7 @@ var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
|
3508
3575
|
}
|
|
3509
3576
|
return;
|
|
3510
3577
|
}
|
|
3511
|
-
if ((0,
|
|
3578
|
+
if ((0, import_core7.isString)(tsconfig)) {
|
|
3512
3579
|
const normalizedPath = normalizePath(tsconfig, workspace);
|
|
3513
3580
|
if (import_fs_extra4.default.existsSync(normalizedPath)) {
|
|
3514
3581
|
const config = await (0, import_tsconfck.parse)(normalizedPath);
|
|
@@ -3519,26 +3586,51 @@ var loadTsconfig = async (tsconfig, workspace = process.cwd()) => {
|
|
|
3519
3586
|
}
|
|
3520
3587
|
return;
|
|
3521
3588
|
}
|
|
3522
|
-
if ((0,
|
|
3589
|
+
if ((0, import_core7.isObject)(tsconfig)) {
|
|
3523
3590
|
return tsconfig;
|
|
3524
3591
|
}
|
|
3525
3592
|
return;
|
|
3526
3593
|
};
|
|
3527
3594
|
|
|
3528
3595
|
// src/utils/options.ts
|
|
3596
|
+
var createFormData = (workspace, formData) => {
|
|
3597
|
+
var _a;
|
|
3598
|
+
const defaultArrayHandling = import_core8.FormDataArrayHandling.SERIALIZE;
|
|
3599
|
+
if (formData === void 0)
|
|
3600
|
+
return { disabled: false, arrayHandling: defaultArrayHandling };
|
|
3601
|
+
if ((0, import_core8.isBoolean)(formData))
|
|
3602
|
+
return { disabled: !formData, arrayHandling: defaultArrayHandling };
|
|
3603
|
+
if ((0, import_core8.isString)(formData))
|
|
3604
|
+
return {
|
|
3605
|
+
disabled: false,
|
|
3606
|
+
mutator: normalizeMutator(workspace, formData),
|
|
3607
|
+
arrayHandling: defaultArrayHandling
|
|
3608
|
+
};
|
|
3609
|
+
if ("mutator" in formData || "arrayHandling" in formData)
|
|
3610
|
+
return {
|
|
3611
|
+
disabled: false,
|
|
3612
|
+
mutator: normalizeMutator(workspace, formData.mutator),
|
|
3613
|
+
arrayHandling: (_a = formData.arrayHandling) != null ? _a : defaultArrayHandling
|
|
3614
|
+
};
|
|
3615
|
+
return {
|
|
3616
|
+
disabled: false,
|
|
3617
|
+
mutator: normalizeMutator(workspace, formData),
|
|
3618
|
+
arrayHandling: defaultArrayHandling
|
|
3619
|
+
};
|
|
3620
|
+
};
|
|
3529
3621
|
var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOptions = {}) => {
|
|
3530
|
-
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
|
|
3531
|
-
const options = await ((0,
|
|
3622
|
+
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;
|
|
3623
|
+
const options = await ((0, import_core8.isFunction)(optionsExport) ? optionsExport() : optionsExport);
|
|
3532
3624
|
if (!options.input) {
|
|
3533
|
-
(0,
|
|
3625
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an input`));
|
|
3534
3626
|
process.exit(1);
|
|
3535
3627
|
}
|
|
3536
3628
|
if (!options.output) {
|
|
3537
|
-
(0,
|
|
3629
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an output`));
|
|
3538
3630
|
process.exit(1);
|
|
3539
3631
|
}
|
|
3540
|
-
const inputOptions = (0,
|
|
3541
|
-
const outputOptions = (0,
|
|
3632
|
+
const inputOptions = (0, import_core8.isString)(options.input) ? { target: options.input } : options.input;
|
|
3633
|
+
const outputOptions = (0, import_core8.isString)(options.output) ? { target: options.output } : options.output;
|
|
3542
3634
|
const outputWorkspace = normalizePath(
|
|
3543
3635
|
outputOptions.workspace || "",
|
|
3544
3636
|
workspace
|
|
@@ -3556,7 +3648,8 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3556
3648
|
let mock2;
|
|
3557
3649
|
if (typeof mockOption === "boolean" && mockOption) {
|
|
3558
3650
|
mock2 = import_mock2.DEFAULT_MOCK_OPTIONS;
|
|
3559
|
-
} else if ((0,
|
|
3651
|
+
} else if ((0, import_core8.isFunction)(mockOption)) {
|
|
3652
|
+
mock2 = mockOption;
|
|
3560
3653
|
} else if (!mockOption) {
|
|
3561
3654
|
mock2 = void 0;
|
|
3562
3655
|
} else {
|
|
@@ -3587,7 +3680,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3587
3680
|
)
|
|
3588
3681
|
},
|
|
3589
3682
|
converterOptions: (_d = inputOptions.converterOptions) != null ? _d : {},
|
|
3590
|
-
parserOptions: (0,
|
|
3683
|
+
parserOptions: (0, import_core8.mergeDeep)(
|
|
3591
3684
|
parserDefaultOptions,
|
|
3592
3685
|
(_e = inputOptions.parserOptions) != null ? _e : {}
|
|
3593
3686
|
),
|
|
@@ -3596,11 +3689,11 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3596
3689
|
output: {
|
|
3597
3690
|
target: globalOptions.output ? normalizePath(globalOptions.output, process.cwd()) : normalizePath(outputOptions.target, outputWorkspace),
|
|
3598
3691
|
schemas: normalizePath(outputOptions.schemas, outputWorkspace),
|
|
3599
|
-
namingConvention: outputOptions.namingConvention ||
|
|
3692
|
+
namingConvention: outputOptions.namingConvention || import_core8.NamingConvention.CAMEL_CASE,
|
|
3600
3693
|
fileExtension: outputOptions.fileExtension || defaultFileExtension,
|
|
3601
3694
|
workspace: outputOptions.workspace ? outputWorkspace : void 0,
|
|
3602
|
-
client: (_g = (_f = outputOptions.client) != null ? _f : client) != null ? _g :
|
|
3603
|
-
httpClient: (_i = (_h = outputOptions.httpClient) != null ? _h : httpClient) != null ? _i :
|
|
3695
|
+
client: (_g = (_f = outputOptions.client) != null ? _f : client) != null ? _g : import_core8.OutputClient.AXIOS_FUNCTIONS,
|
|
3696
|
+
httpClient: (_i = (_h = outputOptions.httpClient) != null ? _h : httpClient) != null ? _i : import_core8.OutputHttpClient.AXIOS,
|
|
3604
3697
|
mode: normalizeOutputMode((_j = outputOptions.mode) != null ? _j : mode),
|
|
3605
3698
|
mock: mock2,
|
|
3606
3699
|
clean: (_l = (_k = outputOptions.clean) != null ? _k : clean) != null ? _l : false,
|
|
@@ -3639,127 +3732,127 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3639
3732
|
outputWorkspace,
|
|
3640
3733
|
(_I = outputOptions.override) == null ? void 0 : _I.mutator
|
|
3641
3734
|
),
|
|
3642
|
-
formData: (
|
|
3735
|
+
formData: createFormData(
|
|
3643
3736
|
outputWorkspace,
|
|
3644
|
-
(
|
|
3645
|
-
)
|
|
3646
|
-
formUrlEncoded: (
|
|
3737
|
+
(_J = outputOptions.override) == null ? void 0 : _J.formData
|
|
3738
|
+
),
|
|
3739
|
+
formUrlEncoded: (_N = !(0, import_core8.isBoolean)((_K = outputOptions.override) == null ? void 0 : _K.formUrlEncoded) ? normalizeMutator(
|
|
3647
3740
|
outputWorkspace,
|
|
3648
|
-
(
|
|
3649
|
-
) : (
|
|
3741
|
+
(_L = outputOptions.override) == null ? void 0 : _L.formUrlEncoded
|
|
3742
|
+
) : (_M = outputOptions.override) == null ? void 0 : _M.formUrlEncoded) != null ? _N : true,
|
|
3650
3743
|
paramsSerializer: normalizeMutator(
|
|
3651
3744
|
outputWorkspace,
|
|
3652
|
-
(
|
|
3745
|
+
(_O = outputOptions.override) == null ? void 0 : _O.paramsSerializer
|
|
3653
3746
|
),
|
|
3654
|
-
header: ((
|
|
3655
|
-
requestOptions: (
|
|
3747
|
+
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,
|
|
3748
|
+
requestOptions: (_T = (_S = outputOptions.override) == null ? void 0 : _S.requestOptions) != null ? _T : true,
|
|
3656
3749
|
components: {
|
|
3657
3750
|
schemas: {
|
|
3658
|
-
suffix:
|
|
3659
|
-
itemSuffix: (
|
|
3660
|
-
...(
|
|
3751
|
+
suffix: import_core8.RefComponentSuffix.schemas,
|
|
3752
|
+
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",
|
|
3753
|
+
...(__ = (_Z = (_Y = outputOptions.override) == null ? void 0 : _Y.components) == null ? void 0 : _Z.schemas) != null ? __ : {}
|
|
3661
3754
|
},
|
|
3662
3755
|
responses: {
|
|
3663
|
-
suffix:
|
|
3664
|
-
...(
|
|
3756
|
+
suffix: import_core8.RefComponentSuffix.responses,
|
|
3757
|
+
...(_ba = (_aa = (_$ = outputOptions.override) == null ? void 0 : _$.components) == null ? void 0 : _aa.responses) != null ? _ba : {}
|
|
3665
3758
|
},
|
|
3666
3759
|
parameters: {
|
|
3667
|
-
suffix:
|
|
3668
|
-
...(
|
|
3760
|
+
suffix: import_core8.RefComponentSuffix.parameters,
|
|
3761
|
+
...(_ea = (_da = (_ca = outputOptions.override) == null ? void 0 : _ca.components) == null ? void 0 : _da.parameters) != null ? _ea : {}
|
|
3669
3762
|
},
|
|
3670
3763
|
requestBodies: {
|
|
3671
|
-
suffix:
|
|
3672
|
-
...(
|
|
3764
|
+
suffix: import_core8.RefComponentSuffix.requestBodies,
|
|
3765
|
+
...(_ha = (_ga = (_fa = outputOptions.override) == null ? void 0 : _fa.components) == null ? void 0 : _ga.requestBodies) != null ? _ha : {}
|
|
3673
3766
|
}
|
|
3674
3767
|
},
|
|
3675
|
-
hono: normalizeHonoOptions((
|
|
3768
|
+
hono: normalizeHonoOptions((_ia = outputOptions.override) == null ? void 0 : _ia.hono, workspace),
|
|
3676
3769
|
query: globalQueryOptions,
|
|
3677
3770
|
zod: {
|
|
3678
3771
|
strict: {
|
|
3679
|
-
param: (
|
|
3680
|
-
query: (
|
|
3681
|
-
header: (
|
|
3682
|
-
body: (
|
|
3683
|
-
response: (
|
|
3772
|
+
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,
|
|
3773
|
+
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,
|
|
3774
|
+
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,
|
|
3775
|
+
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,
|
|
3776
|
+
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
|
|
3684
3777
|
},
|
|
3685
3778
|
generate: {
|
|
3686
|
-
param: (
|
|
3687
|
-
query: (
|
|
3688
|
-
header: (
|
|
3689
|
-
body: (
|
|
3690
|
-
response: (
|
|
3779
|
+
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,
|
|
3780
|
+
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,
|
|
3781
|
+
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,
|
|
3782
|
+
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,
|
|
3783
|
+
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
|
|
3691
3784
|
},
|
|
3692
3785
|
coerce: {
|
|
3693
|
-
param: (
|
|
3694
|
-
query: (
|
|
3695
|
-
header: (
|
|
3696
|
-
body: (
|
|
3697
|
-
response: (
|
|
3786
|
+
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,
|
|
3787
|
+
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,
|
|
3788
|
+
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,
|
|
3789
|
+
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,
|
|
3790
|
+
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
|
|
3698
3791
|
},
|
|
3699
3792
|
preprocess: {
|
|
3700
|
-
...((
|
|
3793
|
+
...((_rb = (_qb = (_pb = outputOptions.override) == null ? void 0 : _pb.zod) == null ? void 0 : _qb.preprocess) == null ? void 0 : _rb.param) ? {
|
|
3701
3794
|
param: normalizeMutator(
|
|
3702
3795
|
workspace,
|
|
3703
3796
|
outputOptions.override.zod.preprocess.param
|
|
3704
3797
|
)
|
|
3705
3798
|
} : {},
|
|
3706
|
-
...((
|
|
3799
|
+
...((_ub = (_tb = (_sb = outputOptions.override) == null ? void 0 : _sb.zod) == null ? void 0 : _tb.preprocess) == null ? void 0 : _ub.query) ? {
|
|
3707
3800
|
query: normalizeMutator(
|
|
3708
3801
|
workspace,
|
|
3709
3802
|
outputOptions.override.zod.preprocess.query
|
|
3710
3803
|
)
|
|
3711
3804
|
} : {},
|
|
3712
|
-
...((
|
|
3805
|
+
...((_xb = (_wb = (_vb = outputOptions.override) == null ? void 0 : _vb.zod) == null ? void 0 : _wb.preprocess) == null ? void 0 : _xb.header) ? {
|
|
3713
3806
|
header: normalizeMutator(
|
|
3714
3807
|
workspace,
|
|
3715
3808
|
outputOptions.override.zod.preprocess.header
|
|
3716
3809
|
)
|
|
3717
3810
|
} : {},
|
|
3718
|
-
...((
|
|
3811
|
+
...((_Ab = (_zb = (_yb = outputOptions.override) == null ? void 0 : _yb.zod) == null ? void 0 : _zb.preprocess) == null ? void 0 : _Ab.body) ? {
|
|
3719
3812
|
body: normalizeMutator(
|
|
3720
3813
|
workspace,
|
|
3721
3814
|
outputOptions.override.zod.preprocess.body
|
|
3722
3815
|
)
|
|
3723
3816
|
} : {},
|
|
3724
|
-
...((
|
|
3817
|
+
...((_Db = (_Cb = (_Bb = outputOptions.override) == null ? void 0 : _Bb.zod) == null ? void 0 : _Cb.preprocess) == null ? void 0 : _Db.response) ? {
|
|
3725
3818
|
response: normalizeMutator(
|
|
3726
3819
|
workspace,
|
|
3727
3820
|
outputOptions.override.zod.preprocess.response
|
|
3728
3821
|
)
|
|
3729
3822
|
} : {}
|
|
3730
3823
|
},
|
|
3731
|
-
generateEachHttpStatus: (
|
|
3732
|
-
dateTimeOptions: (
|
|
3824
|
+
generateEachHttpStatus: (_Gb = (_Fb = (_Eb = outputOptions.override) == null ? void 0 : _Eb.zod) == null ? void 0 : _Fb.generateEachHttpStatus) != null ? _Gb : false,
|
|
3825
|
+
dateTimeOptions: (_Jb = (_Ib = (_Hb = outputOptions.override) == null ? void 0 : _Hb.zod) == null ? void 0 : _Ib.dateTimeOptions) != null ? _Jb : {}
|
|
3733
3826
|
},
|
|
3734
3827
|
swr: {
|
|
3735
|
-
...(
|
|
3828
|
+
...(_Lb = (_Kb = outputOptions.override) == null ? void 0 : _Kb.swr) != null ? _Lb : {}
|
|
3736
3829
|
},
|
|
3737
3830
|
angular: {
|
|
3738
|
-
provideIn: (
|
|
3831
|
+
provideIn: (_Ob = (_Nb = (_Mb = outputOptions.override) == null ? void 0 : _Mb.angular) == null ? void 0 : _Nb.provideIn) != null ? _Ob : "root"
|
|
3739
3832
|
},
|
|
3740
3833
|
fetch: {
|
|
3741
|
-
includeHttpResponseReturnType: (
|
|
3742
|
-
...(
|
|
3834
|
+
includeHttpResponseReturnType: (_Rb = (_Qb = (_Pb = outputOptions.override) == null ? void 0 : _Pb.fetch) == null ? void 0 : _Qb.includeHttpResponseReturnType) != null ? _Rb : true,
|
|
3835
|
+
...(_Tb = (_Sb = outputOptions.override) == null ? void 0 : _Sb.fetch) != null ? _Tb : {}
|
|
3743
3836
|
},
|
|
3744
|
-
useDates: ((
|
|
3745
|
-
useDeprecatedOperations: (
|
|
3746
|
-
|
|
3747
|
-
suppressReadonlyModifier: ((
|
|
3837
|
+
useDates: ((_Ub = outputOptions.override) == null ? void 0 : _Ub.useDates) || false,
|
|
3838
|
+
useDeprecatedOperations: (_Wb = (_Vb = outputOptions.override) == null ? void 0 : _Vb.useDeprecatedOperations) != null ? _Wb : true,
|
|
3839
|
+
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",
|
|
3840
|
+
suppressReadonlyModifier: ((_$b = outputOptions.override) == null ? void 0 : _$b.suppressReadonlyModifier) || false
|
|
3748
3841
|
},
|
|
3749
|
-
allParamsOptional: (
|
|
3750
|
-
urlEncodeParameters: (
|
|
3751
|
-
optionsParamRequired: (
|
|
3752
|
-
propertySortOrder: (
|
|
3842
|
+
allParamsOptional: (_ac = outputOptions.allParamsOptional) != null ? _ac : false,
|
|
3843
|
+
urlEncodeParameters: (_bc = outputOptions.urlEncodeParameters) != null ? _bc : false,
|
|
3844
|
+
optionsParamRequired: (_cc = outputOptions.optionsParamRequired) != null ? _cc : false,
|
|
3845
|
+
propertySortOrder: (_dc = outputOptions.propertySortOrder) != null ? _dc : import_core8.PropertySortOrder.SPECIFICATION
|
|
3753
3846
|
},
|
|
3754
3847
|
hooks: options.hooks ? normalizeHooks(options.hooks) : {}
|
|
3755
3848
|
};
|
|
3756
3849
|
if (!normalizedOptions.input.target) {
|
|
3757
|
-
(0,
|
|
3850
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an input target`));
|
|
3758
3851
|
process.exit(1);
|
|
3759
3852
|
}
|
|
3760
3853
|
if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) {
|
|
3761
|
-
(0,
|
|
3762
|
-
|
|
3854
|
+
(0, import_core8.createLogger)().error(
|
|
3855
|
+
import_chalk3.default.red(`Config require an output target or schemas`)
|
|
3763
3856
|
);
|
|
3764
3857
|
process.exit(1);
|
|
3765
3858
|
}
|
|
@@ -3771,36 +3864,36 @@ var parserDefaultOptions = {
|
|
|
3771
3864
|
};
|
|
3772
3865
|
var normalizeMutator = (workspace, mutator) => {
|
|
3773
3866
|
var _a;
|
|
3774
|
-
if ((0,
|
|
3867
|
+
if ((0, import_core8.isObject)(mutator)) {
|
|
3775
3868
|
if (!mutator.path) {
|
|
3776
|
-
(0,
|
|
3869
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Mutator need a path`));
|
|
3777
3870
|
process.exit(1);
|
|
3778
3871
|
}
|
|
3779
3872
|
return {
|
|
3780
3873
|
...mutator,
|
|
3781
|
-
path:
|
|
3874
|
+
path: import_core8.upath.resolve(workspace, mutator.path),
|
|
3782
3875
|
default: (_a = mutator.default || !mutator.name) != null ? _a : false
|
|
3783
3876
|
};
|
|
3784
3877
|
}
|
|
3785
|
-
if ((0,
|
|
3878
|
+
if ((0, import_core8.isString)(mutator)) {
|
|
3786
3879
|
return {
|
|
3787
|
-
path:
|
|
3880
|
+
path: import_core8.upath.resolve(workspace, mutator),
|
|
3788
3881
|
default: true
|
|
3789
3882
|
};
|
|
3790
3883
|
}
|
|
3791
3884
|
return mutator;
|
|
3792
3885
|
};
|
|
3793
3886
|
var normalizePathOrUrl = (path, workspace) => {
|
|
3794
|
-
if ((0,
|
|
3887
|
+
if ((0, import_core8.isString)(path) && !(0, import_core8.isUrl)(path)) {
|
|
3795
3888
|
return normalizePath(path, workspace);
|
|
3796
3889
|
}
|
|
3797
3890
|
return path;
|
|
3798
3891
|
};
|
|
3799
3892
|
var normalizePath = (path, workspace) => {
|
|
3800
|
-
if (!(0,
|
|
3893
|
+
if (!(0, import_core8.isString)(path)) {
|
|
3801
3894
|
return path;
|
|
3802
3895
|
}
|
|
3803
|
-
return
|
|
3896
|
+
return import_core8.upath.resolve(workspace, path);
|
|
3804
3897
|
};
|
|
3805
3898
|
var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
3806
3899
|
return Object.fromEntries(
|
|
@@ -3887,11 +3980,9 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3887
3980
|
} : {},
|
|
3888
3981
|
...transformer ? { transformer: normalizePath(transformer, workspace) } : {},
|
|
3889
3982
|
...mutator ? { mutator: normalizeMutator(workspace, mutator) } : {},
|
|
3890
|
-
...formData
|
|
3891
|
-
formData: !(0, import_core7.isBoolean)(formData) ? normalizeMutator(workspace, formData) : formData
|
|
3892
|
-
} : {},
|
|
3983
|
+
...createFormData(workspace, formData),
|
|
3893
3984
|
...formUrlEncoded ? {
|
|
3894
|
-
formUrlEncoded: !(0,
|
|
3985
|
+
formUrlEncoded: !(0, import_core8.isBoolean)(formUrlEncoded) ? normalizeMutator(workspace, formUrlEncoded) : formUrlEncoded
|
|
3895
3986
|
} : {},
|
|
3896
3987
|
...paramsSerializer ? {
|
|
3897
3988
|
paramsSerializer: normalizeMutator(
|
|
@@ -3907,18 +3998,18 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3907
3998
|
};
|
|
3908
3999
|
var normalizeOutputMode = (mode) => {
|
|
3909
4000
|
if (!mode) {
|
|
3910
|
-
return
|
|
4001
|
+
return import_core8.OutputMode.SINGLE;
|
|
3911
4002
|
}
|
|
3912
|
-
if (!Object.values(
|
|
3913
|
-
(0,
|
|
3914
|
-
return
|
|
4003
|
+
if (!Object.values(import_core8.OutputMode).includes(mode)) {
|
|
4004
|
+
(0, import_core8.createLogger)().warn(import_chalk3.default.yellow(`Unknown the provided mode => ${mode}`));
|
|
4005
|
+
return import_core8.OutputMode.SINGLE;
|
|
3915
4006
|
}
|
|
3916
4007
|
return mode;
|
|
3917
4008
|
};
|
|
3918
4009
|
var normalizeHooks = (hooks) => {
|
|
3919
4010
|
const keys = Object.keys(hooks);
|
|
3920
4011
|
return keys.reduce((acc, key) => {
|
|
3921
|
-
if ((0,
|
|
4012
|
+
if ((0, import_core8.isString)(hooks[key])) {
|
|
3922
4013
|
return {
|
|
3923
4014
|
...acc,
|
|
3924
4015
|
[key]: [hooks[key]]
|
|
@@ -3928,12 +4019,12 @@ var normalizeHooks = (hooks) => {
|
|
|
3928
4019
|
...acc,
|
|
3929
4020
|
[key]: hooks[key]
|
|
3930
4021
|
};
|
|
3931
|
-
} else if ((0,
|
|
4022
|
+
} else if ((0, import_core8.isFunction)(hooks[key])) {
|
|
3932
4023
|
return {
|
|
3933
4024
|
...acc,
|
|
3934
4025
|
[key]: [hooks[key]]
|
|
3935
4026
|
};
|
|
3936
|
-
} else if ((0,
|
|
4027
|
+
} else if ((0, import_core8.isObject)(hooks[key])) {
|
|
3937
4028
|
return {
|
|
3938
4029
|
...acc,
|
|
3939
4030
|
[key]: [hooks[key]]
|
|
@@ -3945,10 +4036,10 @@ var normalizeHooks = (hooks) => {
|
|
|
3945
4036
|
var normalizeHonoOptions = (hono2 = {}, workspace) => {
|
|
3946
4037
|
var _a, _b;
|
|
3947
4038
|
return {
|
|
3948
|
-
...hono2.handlers ? { handlers:
|
|
4039
|
+
...hono2.handlers ? { handlers: import_core8.upath.resolve(workspace, hono2.handlers) } : {},
|
|
3949
4040
|
compositeRoute: (_a = hono2.compositeRoute) != null ? _a : "",
|
|
3950
4041
|
validator: (_b = hono2.validator) != null ? _b : true,
|
|
3951
|
-
validatorOutputPath: hono2.validatorOutputPath ?
|
|
4042
|
+
validatorOutputPath: hono2.validatorOutputPath ? import_core8.upath.resolve(workspace, hono2.validatorOutputPath) : ""
|
|
3952
4043
|
};
|
|
3953
4044
|
};
|
|
3954
4045
|
var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions = {}) => {
|
|
@@ -3958,12 +4049,12 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
3958
4049
|
);
|
|
3959
4050
|
}
|
|
3960
4051
|
return {
|
|
3961
|
-
...!(0,
|
|
3962
|
-
...!(0,
|
|
3963
|
-
...!(0,
|
|
3964
|
-
...!(0,
|
|
3965
|
-
...!(0,
|
|
3966
|
-
...!(0,
|
|
4052
|
+
...!(0, import_core8.isUndefined)(queryOptions.usePrefetch) ? { usePrefetch: queryOptions.usePrefetch } : {},
|
|
4053
|
+
...!(0, import_core8.isUndefined)(queryOptions.useQuery) ? { useQuery: queryOptions.useQuery } : {},
|
|
4054
|
+
...!(0, import_core8.isUndefined)(queryOptions.useSuspenseQuery) ? { useSuspenseQuery: queryOptions.useSuspenseQuery } : {},
|
|
4055
|
+
...!(0, import_core8.isUndefined)(queryOptions.useMutation) ? { useMutation: queryOptions.useMutation } : {},
|
|
4056
|
+
...!(0, import_core8.isUndefined)(queryOptions.useInfinite) ? { useInfinite: queryOptions.useInfinite } : {},
|
|
4057
|
+
...!(0, import_core8.isUndefined)(queryOptions.useSuspenseInfiniteQuery) ? { useSuspenseInfiniteQuery: queryOptions.useSuspenseInfiniteQuery } : {},
|
|
3967
4058
|
...queryOptions.useInfiniteQueryParam ? { useInfiniteQueryParam: queryOptions.useInfiniteQueryParam } : {},
|
|
3968
4059
|
...queryOptions.options ? { options: queryOptions.options } : {},
|
|
3969
4060
|
...globalOptions.queryKey ? {
|
|
@@ -3990,30 +4081,30 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
3990
4081
|
queryOptions == null ? void 0 : queryOptions.mutationOptions
|
|
3991
4082
|
)
|
|
3992
4083
|
} : {},
|
|
3993
|
-
...!(0,
|
|
4084
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportQueryKey) ? {
|
|
3994
4085
|
shouldExportQueryKey: globalOptions.shouldExportQueryKey
|
|
3995
4086
|
} : {},
|
|
3996
|
-
...!(0,
|
|
3997
|
-
...!(0,
|
|
4087
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportQueryKey) ? { shouldExportQueryKey: queryOptions.shouldExportQueryKey } : {},
|
|
4088
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportHttpClient) ? {
|
|
3998
4089
|
shouldExportHttpClient: globalOptions.shouldExportHttpClient
|
|
3999
4090
|
} : {},
|
|
4000
|
-
...!(0,
|
|
4001
|
-
...!(0,
|
|
4091
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportHttpClient) ? { shouldExportHttpClient: queryOptions.shouldExportHttpClient } : {},
|
|
4092
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportMutatorHooks) ? {
|
|
4002
4093
|
shouldExportMutatorHooks: globalOptions.shouldExportMutatorHooks
|
|
4003
4094
|
} : {},
|
|
4004
|
-
...!(0,
|
|
4005
|
-
...!(0,
|
|
4095
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportMutatorHooks) ? { shouldExportMutatorHooks: queryOptions.shouldExportMutatorHooks } : {},
|
|
4096
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldSplitQueryKey) ? {
|
|
4006
4097
|
shouldSplitQueryKey: globalOptions.shouldSplitQueryKey
|
|
4007
4098
|
} : {},
|
|
4008
|
-
...!(0,
|
|
4009
|
-
...!(0,
|
|
4099
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldSplitQueryKey) ? { shouldSplitQueryKey: queryOptions.shouldSplitQueryKey } : {},
|
|
4100
|
+
...!(0, import_core8.isUndefined)(globalOptions.signal) ? {
|
|
4010
4101
|
signal: globalOptions.signal
|
|
4011
4102
|
} : {},
|
|
4012
|
-
...!(0,
|
|
4013
|
-
...!(0,
|
|
4103
|
+
...!(0, import_core8.isUndefined)(queryOptions.signal) ? { signal: queryOptions.signal } : {},
|
|
4104
|
+
...!(0, import_core8.isUndefined)(globalOptions.version) ? {
|
|
4014
4105
|
version: globalOptions.version
|
|
4015
4106
|
} : {},
|
|
4016
|
-
...!(0,
|
|
4107
|
+
...!(0, import_core8.isUndefined)(queryOptions.version) ? { version: queryOptions.version } : {}
|
|
4017
4108
|
};
|
|
4018
4109
|
};
|
|
4019
4110
|
var getDefaultFilesHeader = ({
|
|
@@ -4029,7 +4120,7 @@ var getDefaultFilesHeader = ({
|
|
|
4029
4120
|
];
|
|
4030
4121
|
|
|
4031
4122
|
// src/utils/watcher.ts
|
|
4032
|
-
var
|
|
4123
|
+
var import_core9 = require("@orval/core");
|
|
4033
4124
|
var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
4034
4125
|
if (!watchOptions) return;
|
|
4035
4126
|
const { watch } = await Promise.resolve().then(() => __toESM(require("chokidar")));
|
|
@@ -4037,7 +4128,7 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4037
4128
|
const watchPaths = typeof watchOptions === "boolean" ? defaultTarget : Array.isArray(watchOptions) ? watchOptions.filter(
|
|
4038
4129
|
(path) => typeof path === "string"
|
|
4039
4130
|
) : watchOptions;
|
|
4040
|
-
(0,
|
|
4131
|
+
(0, import_core9.log)(
|
|
4041
4132
|
`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`
|
|
4042
4133
|
);
|
|
4043
4134
|
const watcher = watch(watchPaths, {
|
|
@@ -4045,40 +4136,40 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4045
4136
|
ignored
|
|
4046
4137
|
});
|
|
4047
4138
|
watcher.on("all", async (type2, file) => {
|
|
4048
|
-
(0,
|
|
4139
|
+
(0, import_core9.log)(`Change detected: ${type2} ${file}`);
|
|
4049
4140
|
try {
|
|
4050
4141
|
await watchFn();
|
|
4051
4142
|
} catch (e) {
|
|
4052
|
-
(0,
|
|
4143
|
+
(0, import_core9.logError)(e);
|
|
4053
4144
|
}
|
|
4054
4145
|
});
|
|
4055
4146
|
};
|
|
4056
4147
|
|
|
4057
4148
|
// src/write-specs.ts
|
|
4058
|
-
var
|
|
4059
|
-
var
|
|
4149
|
+
var import_core11 = require("@orval/core");
|
|
4150
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
4060
4151
|
var import_execa2 = __toESM(require("execa"));
|
|
4061
4152
|
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
4062
4153
|
var import_lodash = __toESM(require("lodash.uniq"));
|
|
4063
4154
|
|
|
4064
4155
|
// src/utils/executeHook.ts
|
|
4065
|
-
var
|
|
4066
|
-
var
|
|
4156
|
+
var import_core10 = require("@orval/core");
|
|
4157
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
4067
4158
|
var import_execa = __toESM(require("execa"));
|
|
4068
4159
|
var import_string_argv = require("string-argv");
|
|
4069
4160
|
var executeHook = async (name, commands = [], args = []) => {
|
|
4070
|
-
(0,
|
|
4161
|
+
(0, import_core10.log)(import_chalk4.default.white(`Running ${name} hook...`));
|
|
4071
4162
|
for (const command of commands) {
|
|
4072
4163
|
try {
|
|
4073
|
-
if ((0,
|
|
4164
|
+
if ((0, import_core10.isString)(command)) {
|
|
4074
4165
|
await executeCommand(command, args);
|
|
4075
|
-
} else if ((0,
|
|
4166
|
+
} else if ((0, import_core10.isFunction)(command)) {
|
|
4076
4167
|
await command(args);
|
|
4077
|
-
} else if ((0,
|
|
4168
|
+
} else if ((0, import_core10.isObject)(command)) {
|
|
4078
4169
|
await executeObjectCommand(command, args);
|
|
4079
4170
|
}
|
|
4080
4171
|
} catch (e) {
|
|
4081
|
-
(0,
|
|
4172
|
+
(0, import_core10.logError)(e, `Failed to run ${name} hook`);
|
|
4082
4173
|
}
|
|
4083
4174
|
}
|
|
4084
4175
|
};
|
|
@@ -4090,9 +4181,9 @@ async function executeObjectCommand(command, args) {
|
|
|
4090
4181
|
if (command.injectGeneratedDirsAndFiles === false) {
|
|
4091
4182
|
args = [];
|
|
4092
4183
|
}
|
|
4093
|
-
if ((0,
|
|
4184
|
+
if ((0, import_core10.isString)(command.command)) {
|
|
4094
4185
|
await executeCommand(command.command, args);
|
|
4095
|
-
} else if ((0,
|
|
4186
|
+
} else if ((0, import_core10.isFunction)(command.command)) {
|
|
4096
4187
|
await command.command();
|
|
4097
4188
|
}
|
|
4098
4189
|
}
|
|
@@ -4103,7 +4194,7 @@ var getHeader = (option, info) => {
|
|
|
4103
4194
|
return "";
|
|
4104
4195
|
}
|
|
4105
4196
|
const header = option(info);
|
|
4106
|
-
return Array.isArray(header) ? (0,
|
|
4197
|
+
return Array.isArray(header) ? (0, import_core11.jsDoc)({ description: header }) : header;
|
|
4107
4198
|
};
|
|
4108
4199
|
var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
4109
4200
|
var _a, _b;
|
|
@@ -4112,7 +4203,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4112
4203
|
const projectTitle = projectName || info.title;
|
|
4113
4204
|
const specsName = Object.keys(schemas).reduce(
|
|
4114
4205
|
(acc, specKey) => {
|
|
4115
|
-
const basePath =
|
|
4206
|
+
const basePath = import_core11.upath.getSpecName(specKey, target);
|
|
4116
4207
|
const name = basePath.slice(1).split("/").join("-");
|
|
4117
4208
|
acc[specKey] = name;
|
|
4118
4209
|
return acc;
|
|
@@ -4125,8 +4216,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4125
4216
|
const fileExtension = ["tags", "tags-split", "split"].includes(output.mode) ? ".ts" : (_a = output.fileExtension) != null ? _a : ".ts";
|
|
4126
4217
|
await Promise.all(
|
|
4127
4218
|
Object.entries(schemas).map(([specKey, schemas2]) => {
|
|
4128
|
-
const schemaPath = !(0,
|
|
4129
|
-
return (0,
|
|
4219
|
+
const schemaPath = !(0, import_core11.isRootKey)(specKey, target) ? import_core11.upath.join(rootSchemaPath, specsName[specKey]) : rootSchemaPath;
|
|
4220
|
+
return (0, import_core11.writeSchemas)({
|
|
4130
4221
|
schemaPath,
|
|
4131
4222
|
schemas: schemas2,
|
|
4132
4223
|
target,
|
|
@@ -4134,7 +4225,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4134
4225
|
fileExtension,
|
|
4135
4226
|
specsName,
|
|
4136
4227
|
specKey,
|
|
4137
|
-
isRootKey: (0,
|
|
4228
|
+
isRootKey: (0, import_core11.isRootKey)(specKey, target),
|
|
4138
4229
|
header,
|
|
4139
4230
|
indexFiles: output.indexFiles
|
|
4140
4231
|
});
|
|
@@ -4156,20 +4247,20 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4156
4247
|
if (output.workspace) {
|
|
4157
4248
|
const workspacePath = output.workspace;
|
|
4158
4249
|
const imports = implementationPaths.filter(
|
|
4159
|
-
(path) => !output.mock || !path.endsWith(`.${(0,
|
|
4250
|
+
(path) => !output.mock || !path.endsWith(`.${(0, import_core11.getMockFileExtensionByTypeName)(output.mock)}.ts`)
|
|
4160
4251
|
).map(
|
|
4161
|
-
(path) =>
|
|
4252
|
+
(path) => import_core11.upath.relativeSafe(
|
|
4162
4253
|
workspacePath,
|
|
4163
|
-
(0,
|
|
4254
|
+
(0, import_core11.getFileInfo)(path).pathWithoutExtension
|
|
4164
4255
|
)
|
|
4165
4256
|
);
|
|
4166
4257
|
if (output.schemas) {
|
|
4167
4258
|
imports.push(
|
|
4168
|
-
|
|
4259
|
+
import_core11.upath.relativeSafe(workspacePath, (0, import_core11.getFileInfo)(output.schemas).dirname)
|
|
4169
4260
|
);
|
|
4170
4261
|
}
|
|
4171
4262
|
if (output.indexFiles) {
|
|
4172
|
-
const indexFile =
|
|
4263
|
+
const indexFile = import_core11.upath.join(workspacePath, "/index.ts");
|
|
4173
4264
|
if (await import_fs_extra5.default.pathExists(indexFile)) {
|
|
4174
4265
|
const data = await import_fs_extra5.default.readFile(indexFile, "utf8");
|
|
4175
4266
|
const importsNotDeclared = imports.filter((imp) => !data.includes(imp));
|
|
@@ -4199,7 +4290,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4199
4290
|
];
|
|
4200
4291
|
}
|
|
4201
4292
|
const paths = [
|
|
4202
|
-
...output.schemas ? [(0,
|
|
4293
|
+
...output.schemas ? [(0, import_core11.getFileInfo)(output.schemas).dirname] : [],
|
|
4203
4294
|
...implementationPaths
|
|
4204
4295
|
];
|
|
4205
4296
|
if (options.hooks.afterAllFilesWrite) {
|
|
@@ -4213,8 +4304,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4213
4304
|
try {
|
|
4214
4305
|
await (0, import_execa2.default)("prettier", ["--write", ...paths]);
|
|
4215
4306
|
} catch {
|
|
4216
|
-
(0,
|
|
4217
|
-
|
|
4307
|
+
(0, import_core11.log)(
|
|
4308
|
+
import_chalk5.default.yellow(
|
|
4218
4309
|
`\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Prettier not found`
|
|
4219
4310
|
)
|
|
4220
4311
|
);
|
|
@@ -4225,7 +4316,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4225
4316
|
await (0, import_execa2.default)("biome", ["check", "--write", ...paths]);
|
|
4226
4317
|
} catch (e) {
|
|
4227
4318
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}biome not found`;
|
|
4228
|
-
(0,
|
|
4319
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4229
4320
|
}
|
|
4230
4321
|
}
|
|
4231
4322
|
if (output.docs) {
|
|
@@ -4264,22 +4355,22 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4264
4355
|
}
|
|
4265
4356
|
} catch (e) {
|
|
4266
4357
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Unable to generate docs`;
|
|
4267
|
-
(0,
|
|
4358
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4268
4359
|
}
|
|
4269
4360
|
}
|
|
4270
|
-
(0,
|
|
4361
|
+
(0, import_core11.createSuccessMessage)(projectTitle);
|
|
4271
4362
|
};
|
|
4272
4363
|
var getWriteMode = (mode) => {
|
|
4273
4364
|
switch (mode) {
|
|
4274
|
-
case
|
|
4275
|
-
return
|
|
4276
|
-
case
|
|
4277
|
-
return
|
|
4278
|
-
case
|
|
4279
|
-
return
|
|
4280
|
-
case
|
|
4365
|
+
case import_core11.OutputMode.SPLIT:
|
|
4366
|
+
return import_core11.writeSplitMode;
|
|
4367
|
+
case import_core11.OutputMode.TAGS:
|
|
4368
|
+
return import_core11.writeTagsMode;
|
|
4369
|
+
case import_core11.OutputMode.TAGS_SPLIT:
|
|
4370
|
+
return import_core11.writeSplitTagsMode;
|
|
4371
|
+
case import_core11.OutputMode.SINGLE:
|
|
4281
4372
|
default:
|
|
4282
|
-
return
|
|
4373
|
+
return import_core11.writeSingleMode;
|
|
4283
4374
|
}
|
|
4284
4375
|
};
|
|
4285
4376
|
|
|
@@ -4288,18 +4379,18 @@ var generateSpec = async (workspace, options, projectName) => {
|
|
|
4288
4379
|
if (options.output.clean) {
|
|
4289
4380
|
const extraPatterns = Array.isArray(options.output.clean) ? options.output.clean : [];
|
|
4290
4381
|
if (options.output.target) {
|
|
4291
|
-
await (0,
|
|
4382
|
+
await (0, import_core12.removeFiles)(
|
|
4292
4383
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4293
|
-
(0,
|
|
4384
|
+
(0, import_core12.getFileInfo)(options.output.target).dirname
|
|
4294
4385
|
);
|
|
4295
4386
|
}
|
|
4296
4387
|
if (options.output.schemas) {
|
|
4297
|
-
await (0,
|
|
4388
|
+
await (0, import_core12.removeFiles)(
|
|
4298
4389
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4299
|
-
(0,
|
|
4390
|
+
(0, import_core12.getFileInfo)(options.output.schemas).dirname
|
|
4300
4391
|
);
|
|
4301
4392
|
}
|
|
4302
|
-
(0,
|
|
4393
|
+
(0, import_core12.log)(`${projectName ? `${projectName}: ` : ""}Cleaning output folder`);
|
|
4303
4394
|
}
|
|
4304
4395
|
const writeSpecBuilder = await importSpecs(workspace, options);
|
|
4305
4396
|
await writeSpecs(writeSpecBuilder, workspace, options, projectName);
|
|
@@ -4311,24 +4402,24 @@ var generateSpecs = async (config, workspace, projectName) => {
|
|
|
4311
4402
|
try {
|
|
4312
4403
|
await generateSpec(workspace, options, projectName);
|
|
4313
4404
|
} catch (e) {
|
|
4314
|
-
(0,
|
|
4405
|
+
(0, import_core12.logError)(e, projectName);
|
|
4315
4406
|
process.exit(1);
|
|
4316
4407
|
}
|
|
4317
4408
|
} else {
|
|
4318
|
-
(0,
|
|
4409
|
+
(0, import_core12.logError)("Project not found");
|
|
4319
4410
|
process.exit(1);
|
|
4320
4411
|
}
|
|
4321
4412
|
return;
|
|
4322
4413
|
}
|
|
4323
4414
|
let hasErrors;
|
|
4324
|
-
const accumulate = await (0,
|
|
4415
|
+
const accumulate = await (0, import_core12.asyncReduce)(
|
|
4325
4416
|
Object.entries(config),
|
|
4326
4417
|
async (acc, [projectName2, options]) => {
|
|
4327
4418
|
try {
|
|
4328
4419
|
acc.push(await generateSpec(workspace, options, projectName2));
|
|
4329
4420
|
} catch (e) {
|
|
4330
4421
|
hasErrors = true;
|
|
4331
|
-
(0,
|
|
4422
|
+
(0, import_core12.logError)(e, projectName2);
|
|
4332
4423
|
}
|
|
4333
4424
|
return acc;
|
|
4334
4425
|
},
|
|
@@ -4342,15 +4433,15 @@ var generateConfig = async (configFile, options) => {
|
|
|
4342
4433
|
path,
|
|
4343
4434
|
file: configExternal,
|
|
4344
4435
|
error
|
|
4345
|
-
} = await (0,
|
|
4436
|
+
} = await (0, import_core12.loadFile)(configFile, {
|
|
4346
4437
|
defaultFileName: "orval.config"
|
|
4347
4438
|
});
|
|
4348
4439
|
if (!configExternal) {
|
|
4349
4440
|
throw `failed to load from ${path} => ${error}`;
|
|
4350
4441
|
}
|
|
4351
|
-
const workspace =
|
|
4352
|
-
const config = await ((0,
|
|
4353
|
-
const normalizedConfig = await (0,
|
|
4442
|
+
const workspace = import_core12.upath.dirname(path);
|
|
4443
|
+
const config = await ((0, import_core12.isFunction)(configExternal) ? configExternal() : configExternal);
|
|
4444
|
+
const normalizedConfig = await (0, import_core12.asyncReduce)(
|
|
4354
4445
|
Object.entries(config),
|
|
4355
4446
|
async (acc, [key, value]) => {
|
|
4356
4447
|
acc[key] = await normalizeOptions(value, workspace, options);
|
|
@@ -4360,7 +4451,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4360
4451
|
);
|
|
4361
4452
|
const fileToWatch = Object.entries(normalizedConfig).filter(
|
|
4362
4453
|
([project]) => (options == null ? void 0 : options.projectName) === void 0 || project === (options == null ? void 0 : options.projectName)
|
|
4363
|
-
).map(([, { input }]) => input.target).filter((target) => (0,
|
|
4454
|
+
).map(([, { input }]) => input.target).filter((target) => (0, import_core12.isString)(target));
|
|
4364
4455
|
if ((options == null ? void 0 : options.watch) && fileToWatch.length) {
|
|
4365
4456
|
startWatcher(
|
|
4366
4457
|
options == null ? void 0 : options.watch,
|
|
@@ -4374,7 +4465,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4374
4465
|
|
|
4375
4466
|
// src/bin/orval.ts
|
|
4376
4467
|
var cli = (0, import_cac.cac)("orval");
|
|
4377
|
-
(0,
|
|
4468
|
+
(0, import_core13.startMessage)({
|
|
4378
4469
|
name: package_default.name,
|
|
4379
4470
|
version: package_default.version,
|
|
4380
4471
|
description: package_default.description
|
|
@@ -4390,7 +4481,7 @@ cli.command(
|
|
|
4390
4481
|
"-w, --watch [path]",
|
|
4391
4482
|
"Watch mode, if path is not specified, it watches the input target"
|
|
4392
4483
|
).option("--clean [path]", "Clean output directory").option("--prettier [path]", "Prettier generated files").option("--tslint [path]", "tslint generated files").option("--biome [path]", "biome generated files").option("--tsconfig [path]", "path to your tsconfig file").action(async (paths, cmd) => {
|
|
4393
|
-
if (!cmd.config && (0,
|
|
4484
|
+
if (!cmd.config && (0, import_core13.isString)(cmd.input) && (0, import_core13.isString)(cmd.output)) {
|
|
4394
4485
|
const normalizedOptions = await normalizeOptions({
|
|
4395
4486
|
input: cmd.input,
|
|
4396
4487
|
output: {
|
|
@@ -4412,7 +4503,7 @@ cli.command(
|
|
|
4412
4503
|
try {
|
|
4413
4504
|
await generateSpec(process.cwd(), normalizedOptions);
|
|
4414
4505
|
} catch (e) {
|
|
4415
|
-
(0,
|
|
4506
|
+
(0, import_core13.logError)(e);
|
|
4416
4507
|
}
|
|
4417
4508
|
},
|
|
4418
4509
|
normalizedOptions.input.target
|
|
@@ -4421,7 +4512,7 @@ cli.command(
|
|
|
4421
4512
|
try {
|
|
4422
4513
|
await generateSpec(process.cwd(), normalizedOptions);
|
|
4423
4514
|
} catch (e) {
|
|
4424
|
-
(0,
|
|
4515
|
+
(0, import_core13.logError)(e);
|
|
4425
4516
|
}
|
|
4426
4517
|
}
|
|
4427
4518
|
} else {
|