orval 7.7.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 +273 -180
- package/dist/bin/orval.js.map +1 -1
- package/dist/index.js +273 -180
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
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",
|
|
@@ -3312,7 +3315,7 @@ var package_default = {
|
|
|
3312
3315
|
"openapi3-ts": "4.2.2",
|
|
3313
3316
|
"string-argv": "^0.3.2",
|
|
3314
3317
|
tsconfck: "^2.0.1",
|
|
3315
|
-
typedoc: "^0.
|
|
3318
|
+
typedoc: "^0.28.0",
|
|
3316
3319
|
"typedoc-plugin-markdown": "^4.4.2",
|
|
3317
3320
|
typescript: "^5.6.3"
|
|
3318
3321
|
}
|
|
@@ -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;
|
|
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,96 +3732,97 @@ 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: (
|
|
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 : {}
|
|
3732
3826
|
},
|
|
3733
3827
|
swr: {
|
|
3734
3828
|
...(_Lb = (_Kb = outputOptions.override) == null ? void 0 : _Kb.swr) != null ? _Lb : {}
|
|
@@ -3742,23 +3836,23 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
|
|
|
3742
3836
|
},
|
|
3743
3837
|
useDates: ((_Ub = outputOptions.override) == null ? void 0 : _Ub.useDates) || false,
|
|
3744
3838
|
useDeprecatedOperations: (_Wb = (_Vb = outputOptions.override) == null ? void 0 : _Vb.useDeprecatedOperations) != null ? _Wb : true,
|
|
3745
|
-
|
|
3746
|
-
suppressReadonlyModifier: ((
|
|
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
|
|
3747
3841
|
},
|
|
3748
|
-
allParamsOptional: (
|
|
3749
|
-
urlEncodeParameters: (
|
|
3750
|
-
optionsParamRequired: (
|
|
3751
|
-
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
|
|
3752
3846
|
},
|
|
3753
3847
|
hooks: options.hooks ? normalizeHooks(options.hooks) : {}
|
|
3754
3848
|
};
|
|
3755
3849
|
if (!normalizedOptions.input.target) {
|
|
3756
|
-
(0,
|
|
3850
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Config require an input target`));
|
|
3757
3851
|
process.exit(1);
|
|
3758
3852
|
}
|
|
3759
3853
|
if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) {
|
|
3760
|
-
(0,
|
|
3761
|
-
|
|
3854
|
+
(0, import_core8.createLogger)().error(
|
|
3855
|
+
import_chalk3.default.red(`Config require an output target or schemas`)
|
|
3762
3856
|
);
|
|
3763
3857
|
process.exit(1);
|
|
3764
3858
|
}
|
|
@@ -3770,36 +3864,36 @@ var parserDefaultOptions = {
|
|
|
3770
3864
|
};
|
|
3771
3865
|
var normalizeMutator = (workspace, mutator) => {
|
|
3772
3866
|
var _a;
|
|
3773
|
-
if ((0,
|
|
3867
|
+
if ((0, import_core8.isObject)(mutator)) {
|
|
3774
3868
|
if (!mutator.path) {
|
|
3775
|
-
(0,
|
|
3869
|
+
(0, import_core8.createLogger)().error(import_chalk3.default.red(`Mutator need a path`));
|
|
3776
3870
|
process.exit(1);
|
|
3777
3871
|
}
|
|
3778
3872
|
return {
|
|
3779
3873
|
...mutator,
|
|
3780
|
-
path:
|
|
3874
|
+
path: import_core8.upath.resolve(workspace, mutator.path),
|
|
3781
3875
|
default: (_a = mutator.default || !mutator.name) != null ? _a : false
|
|
3782
3876
|
};
|
|
3783
3877
|
}
|
|
3784
|
-
if ((0,
|
|
3878
|
+
if ((0, import_core8.isString)(mutator)) {
|
|
3785
3879
|
return {
|
|
3786
|
-
path:
|
|
3880
|
+
path: import_core8.upath.resolve(workspace, mutator),
|
|
3787
3881
|
default: true
|
|
3788
3882
|
};
|
|
3789
3883
|
}
|
|
3790
3884
|
return mutator;
|
|
3791
3885
|
};
|
|
3792
3886
|
var normalizePathOrUrl = (path, workspace) => {
|
|
3793
|
-
if ((0,
|
|
3887
|
+
if ((0, import_core8.isString)(path) && !(0, import_core8.isUrl)(path)) {
|
|
3794
3888
|
return normalizePath(path, workspace);
|
|
3795
3889
|
}
|
|
3796
3890
|
return path;
|
|
3797
3891
|
};
|
|
3798
3892
|
var normalizePath = (path, workspace) => {
|
|
3799
|
-
if (!(0,
|
|
3893
|
+
if (!(0, import_core8.isString)(path)) {
|
|
3800
3894
|
return path;
|
|
3801
3895
|
}
|
|
3802
|
-
return
|
|
3896
|
+
return import_core8.upath.resolve(workspace, path);
|
|
3803
3897
|
};
|
|
3804
3898
|
var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
3805
3899
|
return Object.fromEntries(
|
|
@@ -3817,7 +3911,7 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3817
3911
|
...rest
|
|
3818
3912
|
}
|
|
3819
3913
|
]) => {
|
|
3820
|
-
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;
|
|
3914
|
+
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;
|
|
3821
3915
|
return [
|
|
3822
3916
|
key,
|
|
3823
3917
|
{
|
|
@@ -3880,16 +3974,15 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3880
3974
|
)
|
|
3881
3975
|
} : {}
|
|
3882
3976
|
},
|
|
3883
|
-
generateEachHttpStatus: (_J = zod2 == null ? void 0 : zod2.generateEachHttpStatus) != null ? _J : false
|
|
3977
|
+
generateEachHttpStatus: (_J = zod2 == null ? void 0 : zod2.generateEachHttpStatus) != null ? _J : false,
|
|
3978
|
+
dateTimeOptions: (_K = zod2 == null ? void 0 : zod2.dateTimeOptions) != null ? _K : {}
|
|
3884
3979
|
}
|
|
3885
3980
|
} : {},
|
|
3886
3981
|
...transformer ? { transformer: normalizePath(transformer, workspace) } : {},
|
|
3887
3982
|
...mutator ? { mutator: normalizeMutator(workspace, mutator) } : {},
|
|
3888
|
-
...formData
|
|
3889
|
-
formData: !(0, import_core7.isBoolean)(formData) ? normalizeMutator(workspace, formData) : formData
|
|
3890
|
-
} : {},
|
|
3983
|
+
...createFormData(workspace, formData),
|
|
3891
3984
|
...formUrlEncoded ? {
|
|
3892
|
-
formUrlEncoded: !(0,
|
|
3985
|
+
formUrlEncoded: !(0, import_core8.isBoolean)(formUrlEncoded) ? normalizeMutator(workspace, formUrlEncoded) : formUrlEncoded
|
|
3893
3986
|
} : {},
|
|
3894
3987
|
...paramsSerializer ? {
|
|
3895
3988
|
paramsSerializer: normalizeMutator(
|
|
@@ -3905,18 +3998,18 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace, global) => {
|
|
|
3905
3998
|
};
|
|
3906
3999
|
var normalizeOutputMode = (mode) => {
|
|
3907
4000
|
if (!mode) {
|
|
3908
|
-
return
|
|
4001
|
+
return import_core8.OutputMode.SINGLE;
|
|
3909
4002
|
}
|
|
3910
|
-
if (!Object.values(
|
|
3911
|
-
(0,
|
|
3912
|
-
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;
|
|
3913
4006
|
}
|
|
3914
4007
|
return mode;
|
|
3915
4008
|
};
|
|
3916
4009
|
var normalizeHooks = (hooks) => {
|
|
3917
4010
|
const keys = Object.keys(hooks);
|
|
3918
4011
|
return keys.reduce((acc, key) => {
|
|
3919
|
-
if ((0,
|
|
4012
|
+
if ((0, import_core8.isString)(hooks[key])) {
|
|
3920
4013
|
return {
|
|
3921
4014
|
...acc,
|
|
3922
4015
|
[key]: [hooks[key]]
|
|
@@ -3926,12 +4019,12 @@ var normalizeHooks = (hooks) => {
|
|
|
3926
4019
|
...acc,
|
|
3927
4020
|
[key]: hooks[key]
|
|
3928
4021
|
};
|
|
3929
|
-
} else if ((0,
|
|
4022
|
+
} else if ((0, import_core8.isFunction)(hooks[key])) {
|
|
3930
4023
|
return {
|
|
3931
4024
|
...acc,
|
|
3932
4025
|
[key]: [hooks[key]]
|
|
3933
4026
|
};
|
|
3934
|
-
} else if ((0,
|
|
4027
|
+
} else if ((0, import_core8.isObject)(hooks[key])) {
|
|
3935
4028
|
return {
|
|
3936
4029
|
...acc,
|
|
3937
4030
|
[key]: [hooks[key]]
|
|
@@ -3943,10 +4036,10 @@ var normalizeHooks = (hooks) => {
|
|
|
3943
4036
|
var normalizeHonoOptions = (hono2 = {}, workspace) => {
|
|
3944
4037
|
var _a, _b;
|
|
3945
4038
|
return {
|
|
3946
|
-
...hono2.handlers ? { handlers:
|
|
4039
|
+
...hono2.handlers ? { handlers: import_core8.upath.resolve(workspace, hono2.handlers) } : {},
|
|
3947
4040
|
compositeRoute: (_a = hono2.compositeRoute) != null ? _a : "",
|
|
3948
4041
|
validator: (_b = hono2.validator) != null ? _b : true,
|
|
3949
|
-
validatorOutputPath: hono2.validatorOutputPath ?
|
|
4042
|
+
validatorOutputPath: hono2.validatorOutputPath ? import_core8.upath.resolve(workspace, hono2.validatorOutputPath) : ""
|
|
3950
4043
|
};
|
|
3951
4044
|
};
|
|
3952
4045
|
var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions = {}) => {
|
|
@@ -3956,12 +4049,12 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
3956
4049
|
);
|
|
3957
4050
|
}
|
|
3958
4051
|
return {
|
|
3959
|
-
...!(0,
|
|
3960
|
-
...!(0,
|
|
3961
|
-
...!(0,
|
|
3962
|
-
...!(0,
|
|
3963
|
-
...!(0,
|
|
3964
|
-
...!(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 } : {},
|
|
3965
4058
|
...queryOptions.useInfiniteQueryParam ? { useInfiniteQueryParam: queryOptions.useInfiniteQueryParam } : {},
|
|
3966
4059
|
...queryOptions.options ? { options: queryOptions.options } : {},
|
|
3967
4060
|
...globalOptions.queryKey ? {
|
|
@@ -3988,30 +4081,30 @@ var normalizeQueryOptions = (queryOptions = {}, outputWorkspace, globalOptions =
|
|
|
3988
4081
|
queryOptions == null ? void 0 : queryOptions.mutationOptions
|
|
3989
4082
|
)
|
|
3990
4083
|
} : {},
|
|
3991
|
-
...!(0,
|
|
4084
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportQueryKey) ? {
|
|
3992
4085
|
shouldExportQueryKey: globalOptions.shouldExportQueryKey
|
|
3993
4086
|
} : {},
|
|
3994
|
-
...!(0,
|
|
3995
|
-
...!(0,
|
|
4087
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportQueryKey) ? { shouldExportQueryKey: queryOptions.shouldExportQueryKey } : {},
|
|
4088
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportHttpClient) ? {
|
|
3996
4089
|
shouldExportHttpClient: globalOptions.shouldExportHttpClient
|
|
3997
4090
|
} : {},
|
|
3998
|
-
...!(0,
|
|
3999
|
-
...!(0,
|
|
4091
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportHttpClient) ? { shouldExportHttpClient: queryOptions.shouldExportHttpClient } : {},
|
|
4092
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldExportMutatorHooks) ? {
|
|
4000
4093
|
shouldExportMutatorHooks: globalOptions.shouldExportMutatorHooks
|
|
4001
4094
|
} : {},
|
|
4002
|
-
...!(0,
|
|
4003
|
-
...!(0,
|
|
4095
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldExportMutatorHooks) ? { shouldExportMutatorHooks: queryOptions.shouldExportMutatorHooks } : {},
|
|
4096
|
+
...!(0, import_core8.isUndefined)(globalOptions.shouldSplitQueryKey) ? {
|
|
4004
4097
|
shouldSplitQueryKey: globalOptions.shouldSplitQueryKey
|
|
4005
4098
|
} : {},
|
|
4006
|
-
...!(0,
|
|
4007
|
-
...!(0,
|
|
4099
|
+
...!(0, import_core8.isUndefined)(queryOptions.shouldSplitQueryKey) ? { shouldSplitQueryKey: queryOptions.shouldSplitQueryKey } : {},
|
|
4100
|
+
...!(0, import_core8.isUndefined)(globalOptions.signal) ? {
|
|
4008
4101
|
signal: globalOptions.signal
|
|
4009
4102
|
} : {},
|
|
4010
|
-
...!(0,
|
|
4011
|
-
...!(0,
|
|
4103
|
+
...!(0, import_core8.isUndefined)(queryOptions.signal) ? { signal: queryOptions.signal } : {},
|
|
4104
|
+
...!(0, import_core8.isUndefined)(globalOptions.version) ? {
|
|
4012
4105
|
version: globalOptions.version
|
|
4013
4106
|
} : {},
|
|
4014
|
-
...!(0,
|
|
4107
|
+
...!(0, import_core8.isUndefined)(queryOptions.version) ? { version: queryOptions.version } : {}
|
|
4015
4108
|
};
|
|
4016
4109
|
};
|
|
4017
4110
|
var getDefaultFilesHeader = ({
|
|
@@ -4027,7 +4120,7 @@ var getDefaultFilesHeader = ({
|
|
|
4027
4120
|
];
|
|
4028
4121
|
|
|
4029
4122
|
// src/utils/watcher.ts
|
|
4030
|
-
var
|
|
4123
|
+
var import_core9 = require("@orval/core");
|
|
4031
4124
|
var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
4032
4125
|
if (!watchOptions) return;
|
|
4033
4126
|
const { watch } = await Promise.resolve().then(() => __toESM(require("chokidar")));
|
|
@@ -4035,7 +4128,7 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4035
4128
|
const watchPaths = typeof watchOptions === "boolean" ? defaultTarget : Array.isArray(watchOptions) ? watchOptions.filter(
|
|
4036
4129
|
(path) => typeof path === "string"
|
|
4037
4130
|
) : watchOptions;
|
|
4038
|
-
(0,
|
|
4131
|
+
(0, import_core9.log)(
|
|
4039
4132
|
`Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => '"' + v + '"').join(" | ") : '"' + watchPaths + '"'}`
|
|
4040
4133
|
);
|
|
4041
4134
|
const watcher = watch(watchPaths, {
|
|
@@ -4043,40 +4136,40 @@ var startWatcher = async (watchOptions, watchFn, defaultTarget = ".") => {
|
|
|
4043
4136
|
ignored
|
|
4044
4137
|
});
|
|
4045
4138
|
watcher.on("all", async (type2, file) => {
|
|
4046
|
-
(0,
|
|
4139
|
+
(0, import_core9.log)(`Change detected: ${type2} ${file}`);
|
|
4047
4140
|
try {
|
|
4048
4141
|
await watchFn();
|
|
4049
4142
|
} catch (e) {
|
|
4050
|
-
(0,
|
|
4143
|
+
(0, import_core9.logError)(e);
|
|
4051
4144
|
}
|
|
4052
4145
|
});
|
|
4053
4146
|
};
|
|
4054
4147
|
|
|
4055
4148
|
// src/write-specs.ts
|
|
4056
|
-
var
|
|
4057
|
-
var
|
|
4149
|
+
var import_core11 = require("@orval/core");
|
|
4150
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
4058
4151
|
var import_execa2 = __toESM(require("execa"));
|
|
4059
4152
|
var import_fs_extra5 = __toESM(require("fs-extra"));
|
|
4060
4153
|
var import_lodash = __toESM(require("lodash.uniq"));
|
|
4061
4154
|
|
|
4062
4155
|
// src/utils/executeHook.ts
|
|
4063
|
-
var
|
|
4064
|
-
var
|
|
4156
|
+
var import_core10 = require("@orval/core");
|
|
4157
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
4065
4158
|
var import_execa = __toESM(require("execa"));
|
|
4066
4159
|
var import_string_argv = require("string-argv");
|
|
4067
4160
|
var executeHook = async (name, commands = [], args = []) => {
|
|
4068
|
-
(0,
|
|
4161
|
+
(0, import_core10.log)(import_chalk4.default.white(`Running ${name} hook...`));
|
|
4069
4162
|
for (const command of commands) {
|
|
4070
4163
|
try {
|
|
4071
|
-
if ((0,
|
|
4164
|
+
if ((0, import_core10.isString)(command)) {
|
|
4072
4165
|
await executeCommand(command, args);
|
|
4073
|
-
} else if ((0,
|
|
4166
|
+
} else if ((0, import_core10.isFunction)(command)) {
|
|
4074
4167
|
await command(args);
|
|
4075
|
-
} else if ((0,
|
|
4168
|
+
} else if ((0, import_core10.isObject)(command)) {
|
|
4076
4169
|
await executeObjectCommand(command, args);
|
|
4077
4170
|
}
|
|
4078
4171
|
} catch (e) {
|
|
4079
|
-
(0,
|
|
4172
|
+
(0, import_core10.logError)(e, `Failed to run ${name} hook`);
|
|
4080
4173
|
}
|
|
4081
4174
|
}
|
|
4082
4175
|
};
|
|
@@ -4088,9 +4181,9 @@ async function executeObjectCommand(command, args) {
|
|
|
4088
4181
|
if (command.injectGeneratedDirsAndFiles === false) {
|
|
4089
4182
|
args = [];
|
|
4090
4183
|
}
|
|
4091
|
-
if ((0,
|
|
4184
|
+
if ((0, import_core10.isString)(command.command)) {
|
|
4092
4185
|
await executeCommand(command.command, args);
|
|
4093
|
-
} else if ((0,
|
|
4186
|
+
} else if ((0, import_core10.isFunction)(command.command)) {
|
|
4094
4187
|
await command.command();
|
|
4095
4188
|
}
|
|
4096
4189
|
}
|
|
@@ -4101,7 +4194,7 @@ var getHeader = (option, info) => {
|
|
|
4101
4194
|
return "";
|
|
4102
4195
|
}
|
|
4103
4196
|
const header = option(info);
|
|
4104
|
-
return Array.isArray(header) ? (0,
|
|
4197
|
+
return Array.isArray(header) ? (0, import_core11.jsDoc)({ description: header }) : header;
|
|
4105
4198
|
};
|
|
4106
4199
|
var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
4107
4200
|
var _a, _b;
|
|
@@ -4110,7 +4203,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4110
4203
|
const projectTitle = projectName || info.title;
|
|
4111
4204
|
const specsName = Object.keys(schemas).reduce(
|
|
4112
4205
|
(acc, specKey) => {
|
|
4113
|
-
const basePath =
|
|
4206
|
+
const basePath = import_core11.upath.getSpecName(specKey, target);
|
|
4114
4207
|
const name = basePath.slice(1).split("/").join("-");
|
|
4115
4208
|
acc[specKey] = name;
|
|
4116
4209
|
return acc;
|
|
@@ -4123,8 +4216,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4123
4216
|
const fileExtension = ["tags", "tags-split", "split"].includes(output.mode) ? ".ts" : (_a = output.fileExtension) != null ? _a : ".ts";
|
|
4124
4217
|
await Promise.all(
|
|
4125
4218
|
Object.entries(schemas).map(([specKey, schemas2]) => {
|
|
4126
|
-
const schemaPath = !(0,
|
|
4127
|
-
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)({
|
|
4128
4221
|
schemaPath,
|
|
4129
4222
|
schemas: schemas2,
|
|
4130
4223
|
target,
|
|
@@ -4132,7 +4225,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4132
4225
|
fileExtension,
|
|
4133
4226
|
specsName,
|
|
4134
4227
|
specKey,
|
|
4135
|
-
isRootKey: (0,
|
|
4228
|
+
isRootKey: (0, import_core11.isRootKey)(specKey, target),
|
|
4136
4229
|
header,
|
|
4137
4230
|
indexFiles: output.indexFiles
|
|
4138
4231
|
});
|
|
@@ -4154,20 +4247,20 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4154
4247
|
if (output.workspace) {
|
|
4155
4248
|
const workspacePath = output.workspace;
|
|
4156
4249
|
const imports = implementationPaths.filter(
|
|
4157
|
-
(path) => !output.mock || !path.endsWith(`.${(0,
|
|
4250
|
+
(path) => !output.mock || !path.endsWith(`.${(0, import_core11.getMockFileExtensionByTypeName)(output.mock)}.ts`)
|
|
4158
4251
|
).map(
|
|
4159
|
-
(path) =>
|
|
4252
|
+
(path) => import_core11.upath.relativeSafe(
|
|
4160
4253
|
workspacePath,
|
|
4161
|
-
(0,
|
|
4254
|
+
(0, import_core11.getFileInfo)(path).pathWithoutExtension
|
|
4162
4255
|
)
|
|
4163
4256
|
);
|
|
4164
4257
|
if (output.schemas) {
|
|
4165
4258
|
imports.push(
|
|
4166
|
-
|
|
4259
|
+
import_core11.upath.relativeSafe(workspacePath, (0, import_core11.getFileInfo)(output.schemas).dirname)
|
|
4167
4260
|
);
|
|
4168
4261
|
}
|
|
4169
4262
|
if (output.indexFiles) {
|
|
4170
|
-
const indexFile =
|
|
4263
|
+
const indexFile = import_core11.upath.join(workspacePath, "/index.ts");
|
|
4171
4264
|
if (await import_fs_extra5.default.pathExists(indexFile)) {
|
|
4172
4265
|
const data = await import_fs_extra5.default.readFile(indexFile, "utf8");
|
|
4173
4266
|
const importsNotDeclared = imports.filter((imp) => !data.includes(imp));
|
|
@@ -4197,7 +4290,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4197
4290
|
];
|
|
4198
4291
|
}
|
|
4199
4292
|
const paths = [
|
|
4200
|
-
...output.schemas ? [(0,
|
|
4293
|
+
...output.schemas ? [(0, import_core11.getFileInfo)(output.schemas).dirname] : [],
|
|
4201
4294
|
...implementationPaths
|
|
4202
4295
|
];
|
|
4203
4296
|
if (options.hooks.afterAllFilesWrite) {
|
|
@@ -4211,8 +4304,8 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4211
4304
|
try {
|
|
4212
4305
|
await (0, import_execa2.default)("prettier", ["--write", ...paths]);
|
|
4213
4306
|
} catch {
|
|
4214
|
-
(0,
|
|
4215
|
-
|
|
4307
|
+
(0, import_core11.log)(
|
|
4308
|
+
import_chalk5.default.yellow(
|
|
4216
4309
|
`\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Prettier not found`
|
|
4217
4310
|
)
|
|
4218
4311
|
);
|
|
@@ -4223,7 +4316,7 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4223
4316
|
await (0, import_execa2.default)("biome", ["check", "--write", ...paths]);
|
|
4224
4317
|
} catch (e) {
|
|
4225
4318
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}biome not found`;
|
|
4226
|
-
(0,
|
|
4319
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4227
4320
|
}
|
|
4228
4321
|
}
|
|
4229
4322
|
if (output.docs) {
|
|
@@ -4262,22 +4355,22 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
|
|
|
4262
4355
|
}
|
|
4263
4356
|
} catch (e) {
|
|
4264
4357
|
const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}Unable to generate docs`;
|
|
4265
|
-
(0,
|
|
4358
|
+
(0, import_core11.log)(import_chalk5.default.yellow(message));
|
|
4266
4359
|
}
|
|
4267
4360
|
}
|
|
4268
|
-
(0,
|
|
4361
|
+
(0, import_core11.createSuccessMessage)(projectTitle);
|
|
4269
4362
|
};
|
|
4270
4363
|
var getWriteMode = (mode) => {
|
|
4271
4364
|
switch (mode) {
|
|
4272
|
-
case
|
|
4273
|
-
return
|
|
4274
|
-
case
|
|
4275
|
-
return
|
|
4276
|
-
case
|
|
4277
|
-
return
|
|
4278
|
-
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:
|
|
4279
4372
|
default:
|
|
4280
|
-
return
|
|
4373
|
+
return import_core11.writeSingleMode;
|
|
4281
4374
|
}
|
|
4282
4375
|
};
|
|
4283
4376
|
|
|
@@ -4286,18 +4379,18 @@ var generateSpec = async (workspace, options, projectName) => {
|
|
|
4286
4379
|
if (options.output.clean) {
|
|
4287
4380
|
const extraPatterns = Array.isArray(options.output.clean) ? options.output.clean : [];
|
|
4288
4381
|
if (options.output.target) {
|
|
4289
|
-
await (0,
|
|
4382
|
+
await (0, import_core12.removeFiles)(
|
|
4290
4383
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4291
|
-
(0,
|
|
4384
|
+
(0, import_core12.getFileInfo)(options.output.target).dirname
|
|
4292
4385
|
);
|
|
4293
4386
|
}
|
|
4294
4387
|
if (options.output.schemas) {
|
|
4295
|
-
await (0,
|
|
4388
|
+
await (0, import_core12.removeFiles)(
|
|
4296
4389
|
["**/*", "!**/*.d.ts", ...extraPatterns],
|
|
4297
|
-
(0,
|
|
4390
|
+
(0, import_core12.getFileInfo)(options.output.schemas).dirname
|
|
4298
4391
|
);
|
|
4299
4392
|
}
|
|
4300
|
-
(0,
|
|
4393
|
+
(0, import_core12.log)(`${projectName ? `${projectName}: ` : ""}Cleaning output folder`);
|
|
4301
4394
|
}
|
|
4302
4395
|
const writeSpecBuilder = await importSpecs(workspace, options);
|
|
4303
4396
|
await writeSpecs(writeSpecBuilder, workspace, options, projectName);
|
|
@@ -4309,24 +4402,24 @@ var generateSpecs = async (config, workspace, projectName) => {
|
|
|
4309
4402
|
try {
|
|
4310
4403
|
await generateSpec(workspace, options, projectName);
|
|
4311
4404
|
} catch (e) {
|
|
4312
|
-
(0,
|
|
4405
|
+
(0, import_core12.logError)(e, projectName);
|
|
4313
4406
|
process.exit(1);
|
|
4314
4407
|
}
|
|
4315
4408
|
} else {
|
|
4316
|
-
(0,
|
|
4409
|
+
(0, import_core12.logError)("Project not found");
|
|
4317
4410
|
process.exit(1);
|
|
4318
4411
|
}
|
|
4319
4412
|
return;
|
|
4320
4413
|
}
|
|
4321
4414
|
let hasErrors;
|
|
4322
|
-
const accumulate = await (0,
|
|
4415
|
+
const accumulate = await (0, import_core12.asyncReduce)(
|
|
4323
4416
|
Object.entries(config),
|
|
4324
4417
|
async (acc, [projectName2, options]) => {
|
|
4325
4418
|
try {
|
|
4326
4419
|
acc.push(await generateSpec(workspace, options, projectName2));
|
|
4327
4420
|
} catch (e) {
|
|
4328
4421
|
hasErrors = true;
|
|
4329
|
-
(0,
|
|
4422
|
+
(0, import_core12.logError)(e, projectName2);
|
|
4330
4423
|
}
|
|
4331
4424
|
return acc;
|
|
4332
4425
|
},
|
|
@@ -4340,15 +4433,15 @@ var generateConfig = async (configFile, options) => {
|
|
|
4340
4433
|
path,
|
|
4341
4434
|
file: configExternal,
|
|
4342
4435
|
error
|
|
4343
|
-
} = await (0,
|
|
4436
|
+
} = await (0, import_core12.loadFile)(configFile, {
|
|
4344
4437
|
defaultFileName: "orval.config"
|
|
4345
4438
|
});
|
|
4346
4439
|
if (!configExternal) {
|
|
4347
4440
|
throw `failed to load from ${path} => ${error}`;
|
|
4348
4441
|
}
|
|
4349
|
-
const workspace =
|
|
4350
|
-
const config = await ((0,
|
|
4351
|
-
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)(
|
|
4352
4445
|
Object.entries(config),
|
|
4353
4446
|
async (acc, [key, value]) => {
|
|
4354
4447
|
acc[key] = await normalizeOptions(value, workspace, options);
|
|
@@ -4358,7 +4451,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4358
4451
|
);
|
|
4359
4452
|
const fileToWatch = Object.entries(normalizedConfig).filter(
|
|
4360
4453
|
([project]) => (options == null ? void 0 : options.projectName) === void 0 || project === (options == null ? void 0 : options.projectName)
|
|
4361
|
-
).map(([, { input }]) => input.target).filter((target) => (0,
|
|
4454
|
+
).map(([, { input }]) => input.target).filter((target) => (0, import_core12.isString)(target));
|
|
4362
4455
|
if ((options == null ? void 0 : options.watch) && fileToWatch.length) {
|
|
4363
4456
|
startWatcher(
|
|
4364
4457
|
options == null ? void 0 : options.watch,
|
|
@@ -4372,7 +4465,7 @@ var generateConfig = async (configFile, options) => {
|
|
|
4372
4465
|
|
|
4373
4466
|
// src/bin/orval.ts
|
|
4374
4467
|
var cli = (0, import_cac.cac)("orval");
|
|
4375
|
-
(0,
|
|
4468
|
+
(0, import_core13.startMessage)({
|
|
4376
4469
|
name: package_default.name,
|
|
4377
4470
|
version: package_default.version,
|
|
4378
4471
|
description: package_default.description
|
|
@@ -4388,7 +4481,7 @@ cli.command(
|
|
|
4388
4481
|
"-w, --watch [path]",
|
|
4389
4482
|
"Watch mode, if path is not specified, it watches the input target"
|
|
4390
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) => {
|
|
4391
|
-
if (!cmd.config && (0,
|
|
4484
|
+
if (!cmd.config && (0, import_core13.isString)(cmd.input) && (0, import_core13.isString)(cmd.output)) {
|
|
4392
4485
|
const normalizedOptions = await normalizeOptions({
|
|
4393
4486
|
input: cmd.input,
|
|
4394
4487
|
output: {
|
|
@@ -4410,7 +4503,7 @@ cli.command(
|
|
|
4410
4503
|
try {
|
|
4411
4504
|
await generateSpec(process.cwd(), normalizedOptions);
|
|
4412
4505
|
} catch (e) {
|
|
4413
|
-
(0,
|
|
4506
|
+
(0, import_core13.logError)(e);
|
|
4414
4507
|
}
|
|
4415
4508
|
},
|
|
4416
4509
|
normalizedOptions.input.target
|
|
@@ -4419,7 +4512,7 @@ cli.command(
|
|
|
4419
4512
|
try {
|
|
4420
4513
|
await generateSpec(process.cwd(), normalizedOptions);
|
|
4421
4514
|
} catch (e) {
|
|
4422
|
-
(0,
|
|
4515
|
+
(0, import_core13.logError)(e);
|
|
4423
4516
|
}
|
|
4424
4517
|
}
|
|
4425
4518
|
} else {
|