@orval/hono 7.15.0 → 8.0.0-rc.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/index.js +69 -111
- package/dist/index.js.map +1 -1
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
let __orval_core = require("@orval/core");
|
|
26
|
-
__orval_core = __toESM(__orval_core);
|
|
27
|
-
let __orval_zod = require("@orval/zod");
|
|
28
|
-
__orval_zod = __toESM(__orval_zod);
|
|
29
|
-
let fs_extra = require("fs-extra");
|
|
30
|
-
fs_extra = __toESM(fs_extra);
|
|
31
|
-
require("openapi3-ts/oas30");
|
|
1
|
+
import { camel, generateMutatorImports, getFileInfo, getOrvalGeneratedTypes, getParamsInPath, jsDoc, kebab, pascal, sanitize, upath } from "@orval/core";
|
|
2
|
+
import { generateZod } from "@orval/zod";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import "openapi3-ts/oas30";
|
|
32
5
|
|
|
33
6
|
//#region src/route.ts
|
|
34
7
|
const hasParam = (path) => /[^{]*{[\w*_-]*}.*/.test(path);
|
|
@@ -36,7 +9,7 @@ const getRoutePath = (path) => {
|
|
|
36
9
|
const matches = /([^{]*){?([\w*_-]*)}?(.*)/.exec(path);
|
|
37
10
|
if (!matches?.length) return path;
|
|
38
11
|
const prev = matches[1];
|
|
39
|
-
const param =
|
|
12
|
+
const param = sanitize(matches[2], {
|
|
40
13
|
es5keyword: true,
|
|
41
14
|
underscore: true,
|
|
42
15
|
dash: true,
|
|
@@ -55,7 +28,7 @@ const getRoute = (route) => {
|
|
|
55
28
|
|
|
56
29
|
//#endregion
|
|
57
30
|
//#region src/index.ts
|
|
58
|
-
const ZVALIDATOR_SOURCE =
|
|
31
|
+
const ZVALIDATOR_SOURCE = fs.readFileSync(upath.join(import.meta.dirname, "zValidator.ts")).toString("utf8");
|
|
59
32
|
const HONO_DEPENDENCIES = [{
|
|
60
33
|
exports: [
|
|
61
34
|
{
|
|
@@ -82,26 +55,26 @@ const HONO_DEPENDENCIES = [{
|
|
|
82
55
|
* extensionless to conform with the rest of orval.
|
|
83
56
|
*/
|
|
84
57
|
const generateModuleSpecifier = (from, to) => {
|
|
85
|
-
if (to.startsWith(".") ||
|
|
58
|
+
if (to.startsWith(".") || upath.isAbsolute(to)) {
|
|
86
59
|
let ret;
|
|
87
|
-
ret =
|
|
60
|
+
ret = upath.relativeSafe(upath.dirname(from), to);
|
|
88
61
|
ret = ret.replace(/\.ts$/, "");
|
|
89
|
-
ret = ret.replaceAll(
|
|
62
|
+
ret = ret.replaceAll(upath.separator, "/");
|
|
90
63
|
return ret;
|
|
91
64
|
}
|
|
92
65
|
return to;
|
|
93
66
|
};
|
|
94
67
|
const getHonoDependencies = () => HONO_DEPENDENCIES;
|
|
95
68
|
const getHonoHeader = ({ verbOptions, output, tag, clientImplementation }) => {
|
|
96
|
-
const targetInfo =
|
|
69
|
+
const targetInfo = getFileInfo(output.target);
|
|
97
70
|
let handlers;
|
|
98
71
|
const importHandlers = Object.values(verbOptions).filter((verbOption) => clientImplementation.includes(`${verbOption.operationName}Handlers`));
|
|
99
72
|
if (output.override.hono.handlers) {
|
|
100
|
-
const handlerFileInfo =
|
|
73
|
+
const handlerFileInfo = getFileInfo(output.override.hono.handlers);
|
|
101
74
|
handlers = importHandlers.map((verbOption) => {
|
|
102
75
|
const isTagMode = output.mode === "tags" || output.mode === "tags-split";
|
|
103
|
-
const tag$1 =
|
|
104
|
-
const handlersPath =
|
|
76
|
+
const tag$1 = kebab(verbOption.tags[0] ?? "default");
|
|
77
|
+
const handlersPath = upath.relativeSafe(upath.join(targetInfo.dirname, isTagMode ? tag$1 : ""), upath.join(handlerFileInfo.dirname, `./${verbOption.operationName}`));
|
|
105
78
|
return `import { ${verbOption.operationName}Handlers } from '${handlersPath}';`;
|
|
106
79
|
}).join("\n");
|
|
107
80
|
} else handlers = `import {\n${importHandlers.map((verbOption) => ` ${verbOption.operationName}Handlers`).join(`, \n`)}\n} from './${tag ?? targetInfo.filename}.handlers';`;
|
|
@@ -159,7 +132,7 @@ const getZvalidatorImports = (verbOptions, importPath, isHonoValidator) => {
|
|
|
159
132
|
if (params.length > 0) specifiers.push(`${operationName}Params`);
|
|
160
133
|
if (queryParams) specifiers.push(`${operationName}QueryParams`);
|
|
161
134
|
if (body.definition) specifiers.push(`${operationName}Body`);
|
|
162
|
-
if (!isHonoValidator && response.originalSchema?.["200"]?.content?.["application/json"] !=
|
|
135
|
+
if (!isHonoValidator && response.originalSchema?.["200"]?.content?.["application/json"] != void 0) specifiers.push(`${operationName}Response`);
|
|
163
136
|
}
|
|
164
137
|
return specifiers.length === 0 ? "" : `import {\n${specifiers.join(",\n")}\n} from '${importPath}'`;
|
|
165
138
|
};
|
|
@@ -172,13 +145,13 @@ const getVerbOptionGroupByTag = (verbOptions) => {
|
|
|
172
145
|
}, {});
|
|
173
146
|
};
|
|
174
147
|
const generateHandlerFile = async ({ verbs, path, validatorModule, zodModule, contextModule }) => {
|
|
175
|
-
const validator = validatorModule === "@hono/zod-validator" ? "hono" : validatorModule !=
|
|
176
|
-
if (
|
|
177
|
-
const rawFile = await
|
|
148
|
+
const validator = validatorModule === "@hono/zod-validator" ? "hono" : validatorModule != void 0;
|
|
149
|
+
if (fs.existsSync(path)) {
|
|
150
|
+
const rawFile = await fs.readFile(path, "utf8");
|
|
178
151
|
let content = rawFile;
|
|
179
152
|
content += Object.values(verbs).reduce((acc, verbOption) => {
|
|
180
153
|
const handlerName = `${verbOption.operationName}Handlers`;
|
|
181
|
-
const contextTypeName = `${
|
|
154
|
+
const contextTypeName = `${pascal(verbOption.operationName)}Context`;
|
|
182
155
|
if (!rawFile.includes(handlerName)) acc += getHonoHandlers({
|
|
183
156
|
handlerName,
|
|
184
157
|
contextTypeName,
|
|
@@ -191,30 +164,30 @@ const generateHandlerFile = async ({ verbs, path, validatorModule, zodModule, co
|
|
|
191
164
|
}
|
|
192
165
|
const [handlerCode, hasZValidator] = getHonoHandlers(...Object.values(verbs).map((verbOption) => ({
|
|
193
166
|
handlerName: `${verbOption.operationName}Handlers`,
|
|
194
|
-
contextTypeName: `${
|
|
167
|
+
contextTypeName: `${pascal(verbOption.operationName)}Context`,
|
|
195
168
|
verbOption,
|
|
196
169
|
validator
|
|
197
170
|
})));
|
|
198
171
|
const imports = ["import { createFactory } from 'hono/factory';"];
|
|
199
|
-
if (hasZValidator && validatorModule !=
|
|
200
|
-
imports.push(`import { ${Object.values(verbs).map((verb) => `${
|
|
172
|
+
if (hasZValidator && validatorModule != void 0) imports.push(`import { zValidator } from '${generateModuleSpecifier(path, validatorModule)}';`);
|
|
173
|
+
imports.push(`import { ${Object.values(verbs).map((verb) => `${pascal(verb.operationName)}Context`).join(",\n")} } from '${generateModuleSpecifier(path, contextModule)}';`);
|
|
201
174
|
if (hasZValidator) imports.push(getZvalidatorImports(Object.values(verbs), generateModuleSpecifier(path, zodModule), validatorModule === "@hono/zod-validator"));
|
|
202
175
|
return `${imports.filter((imp) => imp !== "").join("\n")}
|
|
203
176
|
|
|
204
177
|
const factory = createFactory();${handlerCode}`;
|
|
205
178
|
};
|
|
206
179
|
const generateHandlerFiles = async (verbOptions, output, validatorModule) => {
|
|
207
|
-
const { extension, dirname, filename } =
|
|
180
|
+
const { extension, dirname, filename } = getFileInfo(output.target);
|
|
208
181
|
if (output.override.hono.handlers) return Promise.all(Object.values(verbOptions).map(async (verbOption) => {
|
|
209
|
-
const tag =
|
|
210
|
-
const path =
|
|
182
|
+
const tag = kebab(verbOption.tags[0] ?? "default");
|
|
183
|
+
const path = upath.join(output.override.hono.handlers ?? "", `./${verbOption.operationName}` + extension);
|
|
211
184
|
return {
|
|
212
185
|
content: await generateHandlerFile({
|
|
213
186
|
path,
|
|
214
187
|
verbs: [verbOption],
|
|
215
188
|
validatorModule,
|
|
216
|
-
zodModule: output.mode === "tags" ?
|
|
217
|
-
contextModule: output.mode === "tags" ?
|
|
189
|
+
zodModule: output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.zod`) : upath.join(dirname, tag, tag + ".zod"),
|
|
190
|
+
contextModule: output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.context`) : upath.join(dirname, tag, tag + ".context")
|
|
218
191
|
}),
|
|
219
192
|
path
|
|
220
193
|
};
|
|
@@ -222,48 +195,47 @@ const generateHandlerFiles = async (verbOptions, output, validatorModule) => {
|
|
|
222
195
|
if (output.mode === "tags" || output.mode === "tags-split") {
|
|
223
196
|
const groupByTags = getVerbOptionGroupByTag(verbOptions);
|
|
224
197
|
return Promise.all(Object.entries(groupByTags).map(async ([tag, verbs]) => {
|
|
225
|
-
const handlerPath$1 = output.mode === "tags" ?
|
|
198
|
+
const handlerPath$1 = output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.handlers${extension}`) : upath.join(dirname, tag, tag + ".handlers" + extension);
|
|
226
199
|
return {
|
|
227
200
|
content: await generateHandlerFile({
|
|
228
201
|
path: handlerPath$1,
|
|
229
202
|
verbs,
|
|
230
203
|
validatorModule,
|
|
231
|
-
zodModule: output.mode === "tags" ?
|
|
232
|
-
contextModule: output.mode === "tags" ?
|
|
204
|
+
zodModule: output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.zod`) : upath.join(dirname, tag, tag + ".zod"),
|
|
205
|
+
contextModule: output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.context`) : upath.join(dirname, tag, tag + ".context")
|
|
233
206
|
}),
|
|
234
207
|
path: handlerPath$1
|
|
235
208
|
};
|
|
236
209
|
}));
|
|
237
210
|
}
|
|
238
|
-
const handlerPath =
|
|
211
|
+
const handlerPath = upath.join(dirname, `${filename}.handlers${extension}`);
|
|
239
212
|
return [{
|
|
240
213
|
content: await generateHandlerFile({
|
|
241
214
|
path: handlerPath,
|
|
242
215
|
verbs: Object.values(verbOptions),
|
|
243
216
|
validatorModule,
|
|
244
|
-
zodModule:
|
|
245
|
-
contextModule:
|
|
217
|
+
zodModule: upath.join(dirname, `${filename}.zod`),
|
|
218
|
+
contextModule: upath.join(dirname, `${filename}.context`)
|
|
246
219
|
}),
|
|
247
220
|
path: handlerPath
|
|
248
221
|
}];
|
|
249
222
|
};
|
|
250
223
|
const getContext = (verbOption) => {
|
|
251
224
|
let paramType = "";
|
|
252
|
-
if (verbOption.params.length > 0) paramType = `param: {\n ${
|
|
253
|
-
const param = verbOption.params.find((p) => p.name ===
|
|
225
|
+
if (verbOption.params.length > 0) paramType = `param: {\n ${getParamsInPath(verbOption.pathRoute).map((name) => {
|
|
226
|
+
const param = verbOption.params.find((p) => p.name === sanitize(camel(name), { es5keyword: true }));
|
|
254
227
|
const definition = param?.definition.split(":")[1];
|
|
255
|
-
|
|
256
|
-
return { definition: `${name}${required ? "" : "?"}:${definition}` };
|
|
228
|
+
return { definition: `${name}${param?.required ?? false ? "" : "?"}:${definition}` };
|
|
257
229
|
}).map((property) => property.definition).join(",\n ")},\n },`;
|
|
258
230
|
const queryType = verbOption.queryParams ? `query: ${verbOption.queryParams?.schema.name},` : "";
|
|
259
231
|
const bodyType = verbOption.body.definition ? `json: ${verbOption.body.definition},` : "";
|
|
260
232
|
const hasIn = !!paramType || !!queryType || !!bodyType;
|
|
261
|
-
return `export type ${
|
|
233
|
+
return `export type ${pascal(verbOption.operationName)}Context<E extends Env = any> = Context<E, '${getRoute(verbOption.pathRoute)}'${hasIn ? `, { in: { ${paramType}${queryType}${bodyType} }, out: { ${paramType}${queryType}${bodyType} } }` : ""}>`;
|
|
262
234
|
};
|
|
263
235
|
const getHeader = (option, info) => {
|
|
264
236
|
if (!option) return "";
|
|
265
237
|
const header = option(info);
|
|
266
|
-
return Array.isArray(header) ?
|
|
238
|
+
return Array.isArray(header) ? jsDoc({ description: header }) : header;
|
|
267
239
|
};
|
|
268
240
|
const generateContextFile = ({ path, verbs, schemaModule }) => {
|
|
269
241
|
let content = `import type { Context, Env } from 'hono';\n\n`;
|
|
@@ -276,7 +248,7 @@ const generateContextFile = ({ path, verbs, schemaModule }) => {
|
|
|
276
248
|
return imports;
|
|
277
249
|
}).map((imp) => imp.name).filter((imp) => contexts.some((context) => context.includes(imp))));
|
|
278
250
|
if (contexts.some((context) => context.includes("NonReadonly<"))) {
|
|
279
|
-
content +=
|
|
251
|
+
content += getOrvalGeneratedTypes();
|
|
280
252
|
content += "\n";
|
|
281
253
|
}
|
|
282
254
|
if (imps.size > 0) content += `import type {\n${[...imps].toSorted().join(",\n ")}\n} from '${generateModuleSpecifier(path, schemaModule)}';\n\n`;
|
|
@@ -285,40 +257,38 @@ const generateContextFile = ({ path, verbs, schemaModule }) => {
|
|
|
285
257
|
};
|
|
286
258
|
const generateContextFiles = (verbOptions, output, context, schemaModule) => {
|
|
287
259
|
const header = getHeader(output.override.header, context.specs[context.specKey].info);
|
|
288
|
-
const { extension, dirname, filename } =
|
|
260
|
+
const { extension, dirname, filename } = getFileInfo(output.target);
|
|
289
261
|
if (output.mode === "tags" || output.mode === "tags-split") {
|
|
290
262
|
const groupByTags = getVerbOptionGroupByTag(verbOptions);
|
|
291
263
|
return Object.entries(groupByTags).map(([tag, verbs]) => {
|
|
292
|
-
const path$1 = output.mode === "tags" ?
|
|
293
|
-
const code$1 = generateContextFile({
|
|
294
|
-
verbs,
|
|
295
|
-
path: path$1,
|
|
296
|
-
schemaModule
|
|
297
|
-
});
|
|
264
|
+
const path$1 = output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.context${extension}`) : upath.join(dirname, tag, tag + ".context" + extension);
|
|
298
265
|
return {
|
|
299
|
-
content: `${header}${
|
|
266
|
+
content: `${header}${generateContextFile({
|
|
267
|
+
verbs,
|
|
268
|
+
path: path$1,
|
|
269
|
+
schemaModule
|
|
270
|
+
})}`,
|
|
300
271
|
path: path$1
|
|
301
272
|
};
|
|
302
273
|
});
|
|
303
274
|
}
|
|
304
|
-
const path =
|
|
305
|
-
const code = generateContextFile({
|
|
306
|
-
verbs: Object.values(verbOptions),
|
|
307
|
-
path,
|
|
308
|
-
schemaModule
|
|
309
|
-
});
|
|
275
|
+
const path = upath.join(dirname, `${filename}.context${extension}`);
|
|
310
276
|
return [{
|
|
311
|
-
content: `${header}${
|
|
277
|
+
content: `${header}${generateContextFile({
|
|
278
|
+
verbs: Object.values(verbOptions),
|
|
279
|
+
path,
|
|
280
|
+
schemaModule
|
|
281
|
+
})}`,
|
|
312
282
|
path
|
|
313
283
|
}];
|
|
314
284
|
};
|
|
315
285
|
const generateZodFiles = async (verbOptions, output, context) => {
|
|
316
|
-
const { extension, dirname, filename } =
|
|
286
|
+
const { extension, dirname, filename } = getFileInfo(output.target);
|
|
317
287
|
const header = getHeader(output.override.header, context.specs[context.specKey].info);
|
|
318
288
|
if (output.mode === "tags" || output.mode === "tags-split") {
|
|
319
289
|
const groupByTags = getVerbOptionGroupByTag(verbOptions);
|
|
320
290
|
const builderContexts = await Promise.all(Object.entries(groupByTags).map(async ([tag, verbs]) => {
|
|
321
|
-
const zods$1 = await Promise.all(verbs.map((verbOption) =>
|
|
291
|
+
const zods$1 = await Promise.all(verbs.map((verbOption) => generateZod(verbOption, {
|
|
322
292
|
route: verbOption.route,
|
|
323
293
|
pathRoute: verbOption.pathRoute,
|
|
324
294
|
override: output.override,
|
|
@@ -334,9 +304,8 @@ const generateZodFiles = async (verbOptions, output, context) => {
|
|
|
334
304
|
for (const mutator of z.mutators ?? []) acc[mutator.name] = mutator;
|
|
335
305
|
return acc;
|
|
336
306
|
}, {});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const zodPath$1 = output.mode === "tags" ? __orval_core.upath.join(dirname, `${(0, __orval_core.kebab)(tag)}.zod${extension}`) : __orval_core.upath.join(dirname, tag, tag + ".zod" + extension);
|
|
307
|
+
let content$1 = `${header}import { z as zod } from 'zod';\n${generateMutatorImports({ mutators: Object.values(allMutators$1) })}\n`;
|
|
308
|
+
const zodPath$1 = output.mode === "tags" ? upath.join(dirname, `${kebab(tag)}.zod${extension}`) : upath.join(dirname, tag, tag + ".zod" + extension);
|
|
340
309
|
content$1 += zods$1.map((zod) => zod.implementation).join("\n");
|
|
341
310
|
return {
|
|
342
311
|
content: content$1,
|
|
@@ -345,7 +314,7 @@ const generateZodFiles = async (verbOptions, output, context) => {
|
|
|
345
314
|
}));
|
|
346
315
|
return Promise.all(builderContexts.filter((context$1) => context$1.content !== ""));
|
|
347
316
|
}
|
|
348
|
-
const zods = await Promise.all(Object.values(verbOptions).map((verbOption) =>
|
|
317
|
+
const zods = await Promise.all(Object.values(verbOptions).map((verbOption) => generateZod(verbOption, {
|
|
349
318
|
route: verbOption.route,
|
|
350
319
|
pathRoute: verbOption.pathRoute,
|
|
351
320
|
override: output.override,
|
|
@@ -357,9 +326,8 @@ const generateZodFiles = async (verbOptions, output, context) => {
|
|
|
357
326
|
for (const mutator of z.mutators ?? []) acc[mutator.name] = mutator;
|
|
358
327
|
return acc;
|
|
359
328
|
}, {});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const zodPath = __orval_core.upath.join(dirname, `${filename}.zod${extension}`);
|
|
329
|
+
let content = `${header}import { z as zod } from 'zod';\n${generateMutatorImports({ mutators: Object.values(allMutators) })}\n`;
|
|
330
|
+
const zodPath = upath.join(dirname, `${filename}.zod${extension}`);
|
|
363
331
|
content += zods.map((zod) => zod.implementation).join("\n");
|
|
364
332
|
return [{
|
|
365
333
|
content,
|
|
@@ -370,8 +338,8 @@ const generateZvalidator = (output, context) => {
|
|
|
370
338
|
const header = getHeader(output.override.header, context.specs[context.specKey].info);
|
|
371
339
|
let validatorPath = output.override.hono.validatorOutputPath;
|
|
372
340
|
if (!output.override.hono.validatorOutputPath) {
|
|
373
|
-
const { extension, dirname, filename } =
|
|
374
|
-
validatorPath =
|
|
341
|
+
const { extension, dirname, filename } = getFileInfo(output.target);
|
|
342
|
+
validatorPath = upath.join(dirname, `${filename}.validator${extension}`);
|
|
375
343
|
}
|
|
376
344
|
return {
|
|
377
345
|
content: `${header}${ZVALIDATOR_SOURCE}`,
|
|
@@ -379,8 +347,8 @@ const generateZvalidator = (output, context) => {
|
|
|
379
347
|
};
|
|
380
348
|
};
|
|
381
349
|
const generateCompositeRoutes = async (verbOptions, output, context) => {
|
|
382
|
-
const targetInfo =
|
|
383
|
-
const compositeRouteInfo =
|
|
350
|
+
const targetInfo = getFileInfo(output.target);
|
|
351
|
+
const compositeRouteInfo = getFileInfo(output.override.hono.compositeRoute);
|
|
384
352
|
const header = getHeader(output.override.header, context.specs[context.specKey].info);
|
|
385
353
|
const routes = Object.values(verbOptions).map((verbOption) => {
|
|
386
354
|
return generateHonoRoute(verbOption, verbOption.pathRoute);
|
|
@@ -388,18 +356,14 @@ const generateCompositeRoutes = async (verbOptions, output, context) => {
|
|
|
388
356
|
const importHandlers = Object.values(verbOptions);
|
|
389
357
|
let ImportHandlersImplementation;
|
|
390
358
|
if (output.override.hono.handlers) {
|
|
391
|
-
const handlerFileInfo =
|
|
359
|
+
const handlerFileInfo = getFileInfo(output.override.hono.handlers);
|
|
392
360
|
ImportHandlersImplementation = importHandlers.map((verbOption) => verbOption.operationName).map((operationName) => {
|
|
393
|
-
|
|
394
|
-
const handlersPath = generateModuleSpecifier(compositeRouteInfo.path, __orval_core.upath.join(handlerFileInfo.dirname ?? "", `./${operationName}`));
|
|
395
|
-
return `import { ${importHandlerName} } from '${handlersPath}';`;
|
|
361
|
+
return `import { ${`${operationName}Handlers`} } from '${generateModuleSpecifier(compositeRouteInfo.path, upath.join(handlerFileInfo.dirname ?? "", `./${operationName}`))}';`;
|
|
396
362
|
}).join("\n");
|
|
397
363
|
} else {
|
|
398
|
-
const tags = importHandlers.map((verbOption) =>
|
|
364
|
+
const tags = importHandlers.map((verbOption) => kebab(verbOption.tags[0] ?? "default"));
|
|
399
365
|
ImportHandlersImplementation = tags.filter((t, i) => tags.indexOf(t) === i).map((tag) => {
|
|
400
|
-
|
|
401
|
-
const handlersPath = generateModuleSpecifier(compositeRouteInfo.path, __orval_core.upath.join(targetInfo.dirname ?? "", tag));
|
|
402
|
-
return `import {\n${importHandlerNames}\n} from '${handlersPath}/${tag}.handlers';`;
|
|
366
|
+
return `import {\n${importHandlers.filter((verbOption) => verbOption.tags[0] === tag).map((verbOption) => ` ${verbOption.operationName}Handlers`).join(`, \n`)}\n} from '${generateModuleSpecifier(compositeRouteInfo.path, upath.join(targetInfo.dirname ?? "", tag))}/${tag}.handlers';`;
|
|
403
367
|
}).join("\n");
|
|
404
368
|
}
|
|
405
369
|
return [{
|
|
@@ -415,10 +379,10 @@ export default app
|
|
|
415
379
|
}];
|
|
416
380
|
};
|
|
417
381
|
const generateExtraFiles = async (verbOptions, output, context) => {
|
|
418
|
-
const { path, pathWithoutExtension } =
|
|
382
|
+
const { path, pathWithoutExtension } = getFileInfo(output.target);
|
|
419
383
|
const validator = generateZvalidator(output, context);
|
|
420
384
|
let schemaModule;
|
|
421
|
-
if (output.schemas !=
|
|
385
|
+
if (output.schemas != void 0) schemaModule = getFileInfo(output.schemas).dirname;
|
|
422
386
|
else if (output.mode === "single") schemaModule = path;
|
|
423
387
|
else schemaModule = `${pathWithoutExtension}.schemas`;
|
|
424
388
|
const [handlers, contexts, zods, compositeRoutes] = await Promise.all([
|
|
@@ -446,11 +410,5 @@ const builder = () => () => honoClientBuilder;
|
|
|
446
410
|
var src_default = builder;
|
|
447
411
|
|
|
448
412
|
//#endregion
|
|
449
|
-
|
|
450
|
-
exports.default = src_default;
|
|
451
|
-
exports.generateExtraFiles = generateExtraFiles;
|
|
452
|
-
exports.generateHono = generateHono;
|
|
453
|
-
exports.getHonoDependencies = getHonoDependencies;
|
|
454
|
-
exports.getHonoFooter = getHonoFooter;
|
|
455
|
-
exports.getHonoHeader = getHonoHeader;
|
|
413
|
+
export { builder, src_default as default, generateExtraFiles, generateHono, getHonoDependencies, getHonoFooter, getHonoHeader };
|
|
456
414
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fs","upath","HONO_DEPENDENCIES: GeneratorDependency[]","ret: string","getHonoHeader: ClientHeaderBuilder","handlers: string","tag","getHonoFooter: ClientFooterBuilder","generateHono: ClientBuilder","opts","handlerPath","imports: GeneratorImport[]","path","code","zods","allMutators","mutatorsImports","content","zodPath","context","ImportHandlersImplementation: string","generateExtraFiles: ClientExtraFilesBuilder","schemaModule: string","honoClientBuilder: ClientGeneratorsBuilder"],"sources":["../src/route.ts","../src/index.ts"],"sourcesContent":["import { sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(matches[2], {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}\\:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRoute = (route: string) => {\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, '');\n};\n","import {\n camel,\n type ClientBuilder,\n type ClientExtraFilesBuilder,\n type ClientFooterBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ContextSpecs,\n generateMutatorImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorMutator,\n type GeneratorVerbOptions,\n getFileInfo,\n getOrvalGeneratedTypes,\n getParamsInPath,\n jsDoc,\n kebab,\n type NormalizedMutator,\n type NormalizedOutputOptions,\n pascal,\n sanitize,\n upath,\n} from '@orval/core';\nimport { generateZod } from '@orval/zod';\nimport fs from 'fs-extra';\nimport { type InfoObject } from 'openapi3-ts/oas30';\n\nimport { getRoute } from './route';\n\nconst ZVALIDATOR_SOURCE = fs\n .readFileSync(upath.join(__dirname, 'zValidator.ts'))\n .toString('utf8');\n\nconst HONO_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'Hono',\n values: true,\n },\n {\n name: 'Context',\n },\n {\n name: 'Env',\n },\n ],\n dependency: 'hono',\n },\n];\n\n/**\n * generateModuleSpecifier generates the specifier that _from_ would use to\n * import _to_. This is syntactical and does not validate the paths.\n *\n * @param from The filesystem path to the importer.\n * @param to If a filesystem path, it and _from_ must be use the same frame of\n * reference, such as process.cwd() or both be absolute. If only one is\n * absolute, the other must be relative to process.cwd().\n *\n * Otherwise, treated as a package name and returned directly.\n *\n * @return A module specifier that can be used at _from_ to import _to_. It is\n * extensionless to conform with the rest of orval.\n */\nconst generateModuleSpecifier = (from: string, to: string) => {\n if (to.startsWith('.') || upath.isAbsolute(to)) {\n // One of \"/foo/bar\", \"./foo/bar\", \"../foo/bar\", etc.\n let ret: string;\n ret = upath.relativeSafe(upath.dirname(from), to);\n ret = ret.replace(/\\.ts$/, '');\n ret = ret.replaceAll(upath.separator, '/');\n return ret;\n }\n\n // Not a relative or absolute file path. Import as-is.\n return to;\n};\n\nexport const getHonoDependencies = () => HONO_DEPENDENCIES;\n\nexport const getHonoHeader: ClientHeaderBuilder = ({\n verbOptions,\n output,\n tag,\n clientImplementation,\n}) => {\n const targetInfo = getFileInfo(output.target);\n\n let handlers: string;\n\n const importHandlers = Object.values(verbOptions).filter((verbOption) =>\n clientImplementation.includes(`${verbOption.operationName}Handlers`),\n );\n\n if (output.override.hono.handlers) {\n const handlerFileInfo = getFileInfo(output.override.hono.handlers);\n handlers = importHandlers\n .map((verbOption) => {\n const isTagMode =\n output.mode === 'tags' || output.mode === 'tags-split';\n const tag = kebab(verbOption.tags[0] ?? 'default');\n\n const handlersPath = upath.relativeSafe(\n upath.join(targetInfo.dirname, isTagMode ? tag : ''),\n upath.join(handlerFileInfo.dirname, `./${verbOption.operationName}`),\n );\n\n return `import { ${verbOption.operationName}Handlers } from '${handlersPath}';`;\n })\n .join('\\n');\n } else {\n const importHandlerNames = importHandlers\n .map((verbOption) => ` ${verbOption.operationName}Handlers`)\n .join(`, \\n`);\n\n handlers = `import {\\n${importHandlerNames}\\n} from './${tag ?? targetInfo.filename}.handlers';`;\n }\n\n return `${handlers}\\n\\n\nconst app = new Hono()\\n\\n`;\n};\n\nexport const getHonoFooter: ClientFooterBuilder = () => 'export default app';\n\nconst generateHonoRoute = (\n { operationName, verb }: GeneratorVerbOptions,\n pathRoute: string,\n) => {\n const path = getRoute(pathRoute);\n\n return `\napp.${verb.toLowerCase()}('${path}',...${operationName}Handlers)`;\n};\n\nexport const generateHono: ClientBuilder = (verbOptions, options) => {\n if (options.override.hono.compositeRoute) {\n return {\n implementation: '',\n imports: [],\n };\n }\n\n const routeImplementation = generateHonoRoute(verbOptions, options.pathRoute);\n\n return {\n implementation: routeImplementation ? `${routeImplementation}\\n\\n` : '',\n imports: [\n ...verbOptions.params.flatMap((param) => param.imports),\n ...verbOptions.body.imports,\n ...(verbOptions.queryParams\n ? [\n {\n name: verbOptions.queryParams.schema.name,\n },\n ]\n : []),\n ],\n };\n};\n\n/**\n * getHonoHandlers generates TypeScript code for the given verbs and reports\n * whether the code requires zValidator.\n */\nconst getHonoHandlers = (\n ...opts: Array<{\n handlerName: string;\n contextTypeName: string;\n verbOption: GeneratorVerbOptions;\n validator: boolean | 'hono' | NormalizedMutator;\n }>\n): [\n /** The combined TypeScript handler code snippets. */\n handlerCode: string,\n /** Whether any of the handler code snippets requires importing zValidator. */\n hasZValidator: boolean,\n] =>\n opts.reduce<[string, boolean]>(\n ([code, hasZValidator], opts) => {\n const { handlerName, contextTypeName, verbOption, validator } = opts;\n\n let currentValidator = '';\n\n if (validator) {\n if (verbOption.headers) {\n currentValidator += `zValidator('header', ${verbOption.operationName}Header),\\n`;\n }\n if (verbOption.params.length > 0) {\n currentValidator += `zValidator('param', ${verbOption.operationName}Params),\\n`;\n }\n if (verbOption.queryParams) {\n currentValidator += `zValidator('query', ${verbOption.operationName}QueryParams),\\n`;\n }\n if (verbOption.body.definition) {\n currentValidator += `zValidator('json', ${verbOption.operationName}Body),\\n`;\n }\n if (\n validator !== 'hono' &&\n verbOption.response.originalSchema?.['200']?.content?.[\n 'application/json'\n ]\n ) {\n currentValidator += `zValidator('response', ${verbOption.operationName}Response),\\n`;\n }\n }\n\n code += `\nexport const ${handlerName} = factory.createHandlers(\n${currentValidator}async (c: ${contextTypeName}) => {\n\n },\n);`;\n hasZValidator ||= currentValidator !== '';\n\n return [code, hasZValidator];\n },\n ['', false],\n );\n\nconst getZvalidatorImports = (\n verbOptions: GeneratorVerbOptions[],\n importPath: string,\n isHonoValidator: boolean,\n) => {\n const specifiers = [];\n\n for (const {\n operationName,\n headers,\n params,\n queryParams,\n body,\n response,\n } of verbOptions) {\n if (headers) {\n specifiers.push(`${operationName}Header`);\n }\n\n if (params.length > 0) {\n specifiers.push(`${operationName}Params`);\n }\n\n if (queryParams) {\n specifiers.push(`${operationName}QueryParams`);\n }\n\n if (body.definition) {\n specifiers.push(`${operationName}Body`);\n }\n\n if (\n !isHonoValidator &&\n response.originalSchema?.['200']?.content?.['application/json'] != null\n ) {\n specifiers.push(`${operationName}Response`);\n }\n }\n\n return specifiers.length === 0\n ? ''\n : `import {\\n${specifiers.join(',\\n')}\\n} from '${importPath}'`;\n};\n\nconst getVerbOptionGroupByTag = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n) => {\n return Object.values(verbOptions).reduce<\n Record<string, GeneratorVerbOptions[]>\n >((acc, value) => {\n const tag = value.tags[0];\n if (!acc[tag]) {\n acc[tag] = [];\n }\n acc[tag].push(value);\n return acc;\n }, {});\n};\n\nconst generateHandlerFile = async ({\n verbs,\n path,\n validatorModule,\n zodModule,\n contextModule,\n}: {\n verbs: GeneratorVerbOptions[];\n path: string;\n validatorModule?: string;\n zodModule: string;\n contextModule: string;\n}) => {\n const validator =\n validatorModule === '@hono/zod-validator'\n ? ('hono' as const)\n : validatorModule != null;\n\n const isExist = fs.existsSync(path);\n\n if (isExist) {\n const rawFile = await fs.readFile(path, 'utf8');\n let content = rawFile;\n\n content += Object.values(verbs).reduce((acc, verbOption) => {\n const handlerName = `${verbOption.operationName}Handlers`;\n const contextTypeName = `${pascal(verbOption.operationName)}Context`;\n\n if (!rawFile.includes(handlerName)) {\n acc += getHonoHandlers({\n handlerName,\n contextTypeName,\n verbOption,\n validator,\n })[0];\n }\n\n return acc;\n }, '');\n\n return content;\n }\n\n const [handlerCode, hasZValidator] = getHonoHandlers(\n ...Object.values(verbs).map((verbOption) => ({\n handlerName: `${verbOption.operationName}Handlers`,\n contextTypeName: `${pascal(verbOption.operationName)}Context`,\n verbOption,\n validator,\n })),\n );\n\n const imports = [\"import { createFactory } from 'hono/factory';\"];\n\n if (hasZValidator && validatorModule != null) {\n imports.push(\n `import { zValidator } from '${generateModuleSpecifier(path, validatorModule)}';`,\n );\n }\n\n imports.push(\n `import { ${Object.values(verbs)\n .map((verb) => `${pascal(verb.operationName)}Context`)\n .join(',\\n')} } from '${generateModuleSpecifier(path, contextModule)}';`,\n );\n\n if (hasZValidator) {\n imports.push(\n getZvalidatorImports(\n Object.values(verbs),\n generateModuleSpecifier(path, zodModule),\n validatorModule === '@hono/zod-validator',\n ),\n );\n }\n\n return `${imports.filter((imp) => imp !== '').join('\\n')}\n\nconst factory = createFactory();${handlerCode}`;\n};\n\nconst generateHandlerFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n validatorModule: string,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n // This function _does not control_ where the .zod and .context modules land.\n // That determination is made elsewhere and this function must implement the\n // same conventions.\n\n if (output.override.hono.handlers) {\n // One file per operation in the user-provided directory.\n return Promise.all(\n Object.values(verbOptions).map(async (verbOption) => {\n const tag = kebab(verbOption.tags[0] ?? 'default');\n\n const path = upath.join(\n output.override.hono.handlers ?? '',\n `./${verbOption.operationName}` + extension,\n );\n\n return {\n content: await generateHandlerFile({\n path,\n verbs: [verbOption],\n validatorModule,\n zodModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod`)\n : upath.join(dirname, tag, tag + '.zod'),\n contextModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context`)\n : upath.join(dirname, tag, tag + '.context'),\n }),\n path,\n };\n }),\n );\n }\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n // One file per operation _tag_ under dirname.\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n return Promise.all(\n Object.entries(groupByTags).map(async ([tag, verbs]) => {\n const handlerPath =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.handlers${extension}`)\n : upath.join(dirname, tag, tag + '.handlers' + extension);\n\n return {\n content: await generateHandlerFile({\n path: handlerPath,\n verbs,\n validatorModule,\n zodModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod`)\n : upath.join(dirname, tag, tag + '.zod'),\n contextModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context`)\n : upath.join(dirname, tag, tag + '.context'),\n }),\n path: handlerPath,\n };\n }),\n );\n }\n\n // One file with all operations.\n const handlerPath = upath.join(dirname, `${filename}.handlers${extension}`);\n\n return [\n {\n content: await generateHandlerFile({\n path: handlerPath,\n verbs: Object.values(verbOptions),\n validatorModule,\n zodModule: upath.join(dirname, `${filename}.zod`),\n contextModule: upath.join(dirname, `${filename}.context`),\n }),\n path: handlerPath,\n },\n ];\n};\n\nconst getContext = (verbOption: GeneratorVerbOptions) => {\n let paramType = '';\n if (verbOption.params.length > 0) {\n const params = getParamsInPath(verbOption.pathRoute).map((name) => {\n const param = verbOption.params.find(\n (p) => p.name === sanitize(camel(name), { es5keyword: true }),\n );\n const definition = param?.definition.split(':')[1];\n const required = param?.required ?? false;\n return {\n definition: `${name}${required ? '' : '?'}:${definition}`,\n };\n });\n paramType = `param: {\\n ${params\n .map((property) => property.definition)\n .join(',\\n ')},\\n },`;\n }\n\n const queryType = verbOption.queryParams\n ? `query: ${verbOption.queryParams?.schema.name},`\n : '';\n const bodyType = verbOption.body.definition\n ? `json: ${verbOption.body.definition},`\n : '';\n const hasIn = !!paramType || !!queryType || !!bodyType;\n\n return `export type ${pascal(\n verbOption.operationName,\n )}Context<E extends Env = any> = Context<E, '${getRoute(\n verbOption.pathRoute,\n )}'${\n hasIn\n ? `, { in: { ${paramType}${queryType}${bodyType} }, out: { ${paramType}${queryType}${bodyType} } }`\n : ''\n }>`;\n};\n\nconst getHeader = (\n option: false | ((info: InfoObject) => string | string[]),\n info: InfoObject,\n): string => {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n};\n\nconst generateContextFile = ({\n path,\n verbs,\n schemaModule,\n}: {\n path: string;\n verbs: GeneratorVerbOptions[];\n schemaModule: string;\n}) => {\n let content = `import type { Context, Env } from 'hono';\\n\\n`;\n\n const contexts = verbs.map((verb) => getContext(verb));\n\n const imps = new Set(\n verbs\n .flatMap((verb) => {\n const imports: GeneratorImport[] = [];\n if (verb.params.length > 0) {\n imports.push(...verb.params.flatMap((param) => param.imports));\n }\n\n if (verb.queryParams) {\n imports.push({\n name: verb.queryParams.schema.name,\n });\n }\n\n if (verb.body.definition) {\n imports.push(...verb.body.imports);\n }\n\n return imports;\n })\n .map((imp) => imp.name)\n .filter((imp) => contexts.some((context) => context.includes(imp))),\n );\n\n if (contexts.some((context) => context.includes('NonReadonly<'))) {\n content += getOrvalGeneratedTypes();\n content += '\\n';\n }\n\n if (imps.size > 0) {\n content += `import type {\\n${[...imps]\n .toSorted()\n .join(\n ',\\n ',\n )}\\n} from '${generateModuleSpecifier(path, schemaModule)}';\\n\\n`;\n }\n\n content += contexts.join('\\n');\n\n return content;\n};\n\nconst generateContextFiles = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n schemaModule: string,\n) => {\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n return Object.entries(groupByTags).map(([tag, verbs]) => {\n const path =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context${extension}`)\n : upath.join(dirname, tag, tag + '.context' + extension);\n const code = generateContextFile({\n verbs,\n path,\n schemaModule: schemaModule,\n });\n return { content: `${header}${code}`, path };\n });\n }\n\n const path = upath.join(dirname, `${filename}.context${extension}`);\n const code = generateContextFile({\n verbs: Object.values(verbOptions),\n path,\n schemaModule: schemaModule,\n });\n\n return [\n {\n content: `${header}${code}`,\n path,\n },\n ];\n};\n\nconst generateZodFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n const builderContexts = await Promise.all(\n Object.entries(groupByTags).map(async ([tag, verbs]) => {\n const zods = await Promise.all(\n verbs.map((verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target!,\n },\n output.client,\n ),\n ),\n );\n\n if (zods.every((z) => z.implementation === '')) {\n return {\n content: '',\n path: '',\n };\n }\n\n const allMutators = zods.reduce(\n (acc, z) => {\n for (const mutator of z.mutators ?? []) {\n acc[mutator.name] = mutator;\n }\n return acc;\n },\n {} as Record<string, GeneratorMutator>,\n );\n\n const mutatorsImports = generateMutatorImports({\n mutators: Object.values(allMutators),\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod${extension}`)\n : upath.join(dirname, tag, tag + '.zod' + extension);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return {\n content,\n path: zodPath,\n };\n }),\n );\n\n return Promise.all(\n builderContexts.filter((context) => context.content !== ''),\n );\n }\n\n const zods = await Promise.all(\n Object.values(verbOptions).map((verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target!,\n },\n output.client,\n ),\n ),\n );\n\n const allMutators = zods.reduce(\n (acc, z) => {\n for (const mutator of z.mutators ?? []) {\n acc[mutator.name] = mutator;\n }\n return acc;\n },\n {} as Record<string, GeneratorMutator>,\n );\n\n const mutatorsImports = generateMutatorImports({\n mutators: Object.values(allMutators),\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath = upath.join(dirname, `${filename}.zod${extension}`);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return [\n {\n content,\n path: zodPath,\n },\n ];\n};\n\nconst generateZvalidator = (\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n let validatorPath = output.override.hono.validatorOutputPath;\n if (!output.override.hono.validatorOutputPath) {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n validatorPath = upath.join(dirname, `${filename}.validator${extension}`);\n }\n\n return {\n content: `${header}${ZVALIDATOR_SOURCE}`,\n path: validatorPath,\n };\n};\n\nconst generateCompositeRoutes = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const targetInfo = getFileInfo(output.target);\n const compositeRouteInfo = getFileInfo(output.override.hono.compositeRoute);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n const routes = Object.values(verbOptions)\n .map((verbOption) => {\n return generateHonoRoute(verbOption, verbOption.pathRoute);\n })\n .join(';');\n\n const importHandlers = Object.values(verbOptions);\n\n let ImportHandlersImplementation: string;\n if (output.override.hono.handlers) {\n const handlerFileInfo = getFileInfo(output.override.hono.handlers);\n const operationNames = importHandlers.map(\n (verbOption) => verbOption.operationName,\n );\n\n ImportHandlersImplementation = operationNames\n .map((operationName) => {\n const importHandlerName = `${operationName}Handlers`;\n\n const handlersPath = generateModuleSpecifier(\n compositeRouteInfo.path,\n upath.join(handlerFileInfo.dirname ?? '', `./${operationName}`),\n );\n\n return `import { ${importHandlerName} } from '${handlersPath}';`;\n })\n .join('\\n');\n } else {\n const tags = importHandlers.map((verbOption) =>\n kebab(verbOption.tags[0] ?? 'default'),\n );\n const uniqueTags = tags.filter((t, i) => tags.indexOf(t) === i);\n\n ImportHandlersImplementation = uniqueTags\n .map((tag) => {\n const importHandlerNames = importHandlers\n .filter((verbOption) => verbOption.tags[0] === tag)\n .map((verbOption) => ` ${verbOption.operationName}Handlers`)\n .join(`, \\n`);\n\n const handlersPath = generateModuleSpecifier(\n compositeRouteInfo.path,\n upath.join(targetInfo.dirname ?? '', tag),\n );\n\n return `import {\\n${importHandlerNames}\\n} from '${handlersPath}/${tag}.handlers';`;\n })\n .join('\\n');\n }\n\n const honoImport = `import { Hono } from 'hono';`;\n const honoInitialization = `\\nconst app = new Hono()`;\n const honoAppExport = `\\nexport default app`;\n\n const content = `${header}${honoImport}\n${ImportHandlersImplementation}\n${honoInitialization}\n${routes}\n${honoAppExport}\n`;\n\n return [\n {\n content,\n path: output.override.hono.compositeRoute || '',\n },\n ];\n};\n\nexport const generateExtraFiles: ClientExtraFilesBuilder = async (\n verbOptions,\n output,\n context,\n) => {\n const { path, pathWithoutExtension } = getFileInfo(output.target);\n const validator = generateZvalidator(output, context);\n let schemaModule: string;\n\n if (output.schemas != null) {\n schemaModule = getFileInfo(output.schemas).dirname;\n } else if (output.mode === 'single') {\n schemaModule = path;\n } else {\n schemaModule = `${pathWithoutExtension}.schemas`;\n }\n\n const [handlers, contexts, zods, compositeRoutes] = await Promise.all([\n generateHandlerFiles(verbOptions, output, validator.path),\n generateContextFiles(verbOptions, output, context, schemaModule),\n generateZodFiles(verbOptions, output, context),\n output.override.hono.compositeRoute\n ? generateCompositeRoutes(verbOptions, output, context)\n : [],\n ]);\n\n return [\n ...handlers,\n ...contexts,\n ...zods,\n ...(output.override.hono.validator &&\n output.override.hono.validator !== 'hono'\n ? [validator]\n : []),\n ...compositeRoutes,\n ];\n};\n\nconst honoClientBuilder: ClientGeneratorsBuilder = {\n client: generateHono,\n dependencies: getHonoDependencies,\n header: getHonoHeader,\n footer: getHonoFooter,\n extraFiles: generateExtraFiles,\n};\n\nexport const builder = () => () => honoClientBuilder;\n\nexport default builder;\n"],"mappings":";;;;;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OAAO;GAEf,MAAM,eAAe,wBACnB,mBAAmB,MACnBA,mBAAM,KAAK,WAAW,WAAW,IAAI,IAAI,CAC1C;AAED,UAAO,aAAa,mBAAmB,YAAY,aAAa,GAAG,IAAI;IACvE,CACD,KAAK,KAAK;;AAcf,QAAO,CACL;EACE,SATY,GAAG;EACnB,6BAA6B;;;EAE7B,OAAO;;;;EAOH,MAAM,OAAO,SAAS,KAAK,kBAAkB;EAC9C,CACF;;AAGH,MAAaoB,qBAA8C,OACzD,aACA,QACA,YACG;CACH,MAAM,EAAE,MAAM,uDAAqC,OAAO,OAAO;CACjE,MAAM,YAAY,mBAAmB,QAAQ,QAAQ;CACrD,IAAIC;AAEJ,KAAI,OAAO,WAAW,KACpB,8CAA2B,OAAO,QAAQ,CAAC;UAClC,OAAO,SAAS,SACzB,gBAAe;KAEf,gBAAe,GAAG,qBAAqB;CAGzC,MAAM,CAAC,UAAU,UAAU,MAAM,mBAAmB,MAAM,QAAQ,IAAI;EACpE,qBAAqB,aAAa,QAAQ,UAAU,KAAK;EACzD,qBAAqB,aAAa,QAAQ,SAAS,aAAa;EAChE,iBAAiB,aAAa,QAAQ,QAAQ;EAC9C,OAAO,SAAS,KAAK,iBACjB,wBAAwB,aAAa,QAAQ,QAAQ,GACrD,EAAE;EACP,CAAC;AAEF,QAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAI,OAAO,SAAS,KAAK,aACzB,OAAO,SAAS,KAAK,cAAc,SAC/B,CAAC,UAAU,GACX,EAAE;EACN,GAAG;EACJ;;AAGH,MAAMC,oBAA6C;CACjD,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAED,MAAa,sBAAsB;AAEnC,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["HONO_DEPENDENCIES: GeneratorDependency[]","ret: string","getHonoHeader: ClientHeaderBuilder","handlers: string","tag","getHonoFooter: ClientFooterBuilder","generateHono: ClientBuilder","opts","handlerPath","imports: GeneratorImport[]","path","zods","allMutators","content","zodPath","context","ImportHandlersImplementation: string","generateExtraFiles: ClientExtraFilesBuilder","schemaModule: string","honoClientBuilder: ClientGeneratorsBuilder"],"sources":["../src/route.ts","../src/index.ts"],"sourcesContent":["import { sanitize } from '@orval/core';\n\nconst hasParam = (path: string): boolean => /[^{]*{[\\w*_-]*}.*/.test(path);\n\nconst getRoutePath = (path: string): string => {\n const matches = /([^{]*){?([\\w*_-]*)}?(.*)/.exec(path);\n if (!matches?.length) return path; // impossible due to regexp grouping here, but for TS\n\n const prev = matches[1];\n const param = sanitize(matches[2], {\n es5keyword: true,\n underscore: true,\n dash: true,\n dot: true,\n });\n const next = hasParam(matches[3]) ? getRoutePath(matches[3]) : matches[3];\n\n return hasParam(path) ? `${prev}\\:${param}${next}` : `${prev}${param}${next}`;\n};\n\nexport const getRoute = (route: string) => {\n const splittedRoute = route.split('/');\n\n return splittedRoute.reduce((acc, path, i) => {\n if (!path && !i) {\n return acc;\n }\n\n if (!path.includes('{')) {\n return `${acc}/${path}`;\n }\n\n return `${acc}/${getRoutePath(path)}`;\n }, '');\n};\n","import {\n camel,\n type ClientBuilder,\n type ClientExtraFilesBuilder,\n type ClientFooterBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ContextSpecs,\n generateMutatorImports,\n type GeneratorDependency,\n type GeneratorImport,\n type GeneratorMutator,\n type GeneratorVerbOptions,\n getFileInfo,\n getOrvalGeneratedTypes,\n getParamsInPath,\n jsDoc,\n kebab,\n type NormalizedMutator,\n type NormalizedOutputOptions,\n pascal,\n sanitize,\n upath,\n} from '@orval/core';\nimport { generateZod } from '@orval/zod';\nimport fs from 'fs-extra';\nimport { type InfoObject } from 'openapi3-ts/oas30';\n\nimport { getRoute } from './route';\n\nconst ZVALIDATOR_SOURCE = fs\n .readFileSync(upath.join(import.meta.dirname, 'zValidator.ts'))\n .toString('utf8');\n\nconst HONO_DEPENDENCIES: GeneratorDependency[] = [\n {\n exports: [\n {\n name: 'Hono',\n values: true,\n },\n {\n name: 'Context',\n },\n {\n name: 'Env',\n },\n ],\n dependency: 'hono',\n },\n];\n\n/**\n * generateModuleSpecifier generates the specifier that _from_ would use to\n * import _to_. This is syntactical and does not validate the paths.\n *\n * @param from The filesystem path to the importer.\n * @param to If a filesystem path, it and _from_ must be use the same frame of\n * reference, such as process.cwd() or both be absolute. If only one is\n * absolute, the other must be relative to process.cwd().\n *\n * Otherwise, treated as a package name and returned directly.\n *\n * @return A module specifier that can be used at _from_ to import _to_. It is\n * extensionless to conform with the rest of orval.\n */\nconst generateModuleSpecifier = (from: string, to: string) => {\n if (to.startsWith('.') || upath.isAbsolute(to)) {\n // One of \"/foo/bar\", \"./foo/bar\", \"../foo/bar\", etc.\n let ret: string;\n ret = upath.relativeSafe(upath.dirname(from), to);\n ret = ret.replace(/\\.ts$/, '');\n ret = ret.replaceAll(upath.separator, '/');\n return ret;\n }\n\n // Not a relative or absolute file path. Import as-is.\n return to;\n};\n\nexport const getHonoDependencies = () => HONO_DEPENDENCIES;\n\nexport const getHonoHeader: ClientHeaderBuilder = ({\n verbOptions,\n output,\n tag,\n clientImplementation,\n}) => {\n const targetInfo = getFileInfo(output.target);\n\n let handlers: string;\n\n const importHandlers = Object.values(verbOptions).filter((verbOption) =>\n clientImplementation.includes(`${verbOption.operationName}Handlers`),\n );\n\n if (output.override.hono.handlers) {\n const handlerFileInfo = getFileInfo(output.override.hono.handlers);\n handlers = importHandlers\n .map((verbOption) => {\n const isTagMode =\n output.mode === 'tags' || output.mode === 'tags-split';\n const tag = kebab(verbOption.tags[0] ?? 'default');\n\n const handlersPath = upath.relativeSafe(\n upath.join(targetInfo.dirname, isTagMode ? tag : ''),\n upath.join(handlerFileInfo.dirname, `./${verbOption.operationName}`),\n );\n\n return `import { ${verbOption.operationName}Handlers } from '${handlersPath}';`;\n })\n .join('\\n');\n } else {\n const importHandlerNames = importHandlers\n .map((verbOption) => ` ${verbOption.operationName}Handlers`)\n .join(`, \\n`);\n\n handlers = `import {\\n${importHandlerNames}\\n} from './${tag ?? targetInfo.filename}.handlers';`;\n }\n\n return `${handlers}\\n\\n\nconst app = new Hono()\\n\\n`;\n};\n\nexport const getHonoFooter: ClientFooterBuilder = () => 'export default app';\n\nconst generateHonoRoute = (\n { operationName, verb }: GeneratorVerbOptions,\n pathRoute: string,\n) => {\n const path = getRoute(pathRoute);\n\n return `\napp.${verb.toLowerCase()}('${path}',...${operationName}Handlers)`;\n};\n\nexport const generateHono: ClientBuilder = (verbOptions, options) => {\n if (options.override.hono.compositeRoute) {\n return {\n implementation: '',\n imports: [],\n };\n }\n\n const routeImplementation = generateHonoRoute(verbOptions, options.pathRoute);\n\n return {\n implementation: routeImplementation ? `${routeImplementation}\\n\\n` : '',\n imports: [\n ...verbOptions.params.flatMap((param) => param.imports),\n ...verbOptions.body.imports,\n ...(verbOptions.queryParams\n ? [\n {\n name: verbOptions.queryParams.schema.name,\n },\n ]\n : []),\n ],\n };\n};\n\n/**\n * getHonoHandlers generates TypeScript code for the given verbs and reports\n * whether the code requires zValidator.\n */\nconst getHonoHandlers = (\n ...opts: {\n handlerName: string;\n contextTypeName: string;\n verbOption: GeneratorVerbOptions;\n validator: boolean | 'hono' | NormalizedMutator;\n }[]\n): [\n /** The combined TypeScript handler code snippets. */\n handlerCode: string,\n /** Whether any of the handler code snippets requires importing zValidator. */\n hasZValidator: boolean,\n] =>\n opts.reduce<[string, boolean]>(\n ([code, hasZValidator], opts) => {\n const { handlerName, contextTypeName, verbOption, validator } = opts;\n\n let currentValidator = '';\n\n if (validator) {\n if (verbOption.headers) {\n currentValidator += `zValidator('header', ${verbOption.operationName}Header),\\n`;\n }\n if (verbOption.params.length > 0) {\n currentValidator += `zValidator('param', ${verbOption.operationName}Params),\\n`;\n }\n if (verbOption.queryParams) {\n currentValidator += `zValidator('query', ${verbOption.operationName}QueryParams),\\n`;\n }\n if (verbOption.body.definition) {\n currentValidator += `zValidator('json', ${verbOption.operationName}Body),\\n`;\n }\n if (\n validator !== 'hono' &&\n verbOption.response.originalSchema?.['200']?.content?.[\n 'application/json'\n ]\n ) {\n currentValidator += `zValidator('response', ${verbOption.operationName}Response),\\n`;\n }\n }\n\n code += `\nexport const ${handlerName} = factory.createHandlers(\n${currentValidator}async (c: ${contextTypeName}) => {\n\n },\n);`;\n hasZValidator ||= currentValidator !== '';\n\n return [code, hasZValidator];\n },\n ['', false],\n );\n\nconst getZvalidatorImports = (\n verbOptions: GeneratorVerbOptions[],\n importPath: string,\n isHonoValidator: boolean,\n) => {\n const specifiers = [];\n\n for (const {\n operationName,\n headers,\n params,\n queryParams,\n body,\n response,\n } of verbOptions) {\n if (headers) {\n specifiers.push(`${operationName}Header`);\n }\n\n if (params.length > 0) {\n specifiers.push(`${operationName}Params`);\n }\n\n if (queryParams) {\n specifiers.push(`${operationName}QueryParams`);\n }\n\n if (body.definition) {\n specifiers.push(`${operationName}Body`);\n }\n\n if (\n !isHonoValidator &&\n response.originalSchema?.['200']?.content?.['application/json'] !=\n undefined\n ) {\n specifiers.push(`${operationName}Response`);\n }\n }\n\n return specifiers.length === 0\n ? ''\n : `import {\\n${specifiers.join(',\\n')}\\n} from '${importPath}'`;\n};\n\nconst getVerbOptionGroupByTag = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n) => {\n return Object.values(verbOptions).reduce<\n Record<string, GeneratorVerbOptions[]>\n >((acc, value) => {\n const tag = value.tags[0];\n if (!acc[tag]) {\n acc[tag] = [];\n }\n acc[tag].push(value);\n return acc;\n }, {});\n};\n\nconst generateHandlerFile = async ({\n verbs,\n path,\n validatorModule,\n zodModule,\n contextModule,\n}: {\n verbs: GeneratorVerbOptions[];\n path: string;\n validatorModule?: string;\n zodModule: string;\n contextModule: string;\n}) => {\n const validator =\n validatorModule === '@hono/zod-validator'\n ? ('hono' as const)\n : validatorModule != undefined;\n\n const isExist = fs.existsSync(path);\n\n if (isExist) {\n const rawFile = await fs.readFile(path, 'utf8');\n let content = rawFile;\n\n content += Object.values(verbs).reduce((acc, verbOption) => {\n const handlerName = `${verbOption.operationName}Handlers`;\n const contextTypeName = `${pascal(verbOption.operationName)}Context`;\n\n if (!rawFile.includes(handlerName)) {\n acc += getHonoHandlers({\n handlerName,\n contextTypeName,\n verbOption,\n validator,\n })[0];\n }\n\n return acc;\n }, '');\n\n return content;\n }\n\n const [handlerCode, hasZValidator] = getHonoHandlers(\n ...Object.values(verbs).map((verbOption) => ({\n handlerName: `${verbOption.operationName}Handlers`,\n contextTypeName: `${pascal(verbOption.operationName)}Context`,\n verbOption,\n validator,\n })),\n );\n\n const imports = [\"import { createFactory } from 'hono/factory';\"];\n\n if (hasZValidator && validatorModule != undefined) {\n imports.push(\n `import { zValidator } from '${generateModuleSpecifier(path, validatorModule)}';`,\n );\n }\n\n imports.push(\n `import { ${Object.values(verbs)\n .map((verb) => `${pascal(verb.operationName)}Context`)\n .join(',\\n')} } from '${generateModuleSpecifier(path, contextModule)}';`,\n );\n\n if (hasZValidator) {\n imports.push(\n getZvalidatorImports(\n Object.values(verbs),\n generateModuleSpecifier(path, zodModule),\n validatorModule === '@hono/zod-validator',\n ),\n );\n }\n\n return `${imports.filter((imp) => imp !== '').join('\\n')}\n\nconst factory = createFactory();${handlerCode}`;\n};\n\nconst generateHandlerFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n validatorModule: string,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n // This function _does not control_ where the .zod and .context modules land.\n // That determination is made elsewhere and this function must implement the\n // same conventions.\n\n if (output.override.hono.handlers) {\n // One file per operation in the user-provided directory.\n return Promise.all(\n Object.values(verbOptions).map(async (verbOption) => {\n const tag = kebab(verbOption.tags[0] ?? 'default');\n\n const path = upath.join(\n output.override.hono.handlers ?? '',\n `./${verbOption.operationName}` + extension,\n );\n\n return {\n content: await generateHandlerFile({\n path,\n verbs: [verbOption],\n validatorModule,\n zodModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod`)\n : upath.join(dirname, tag, tag + '.zod'),\n contextModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context`)\n : upath.join(dirname, tag, tag + '.context'),\n }),\n path,\n };\n }),\n );\n }\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n // One file per operation _tag_ under dirname.\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n return Promise.all(\n Object.entries(groupByTags).map(async ([tag, verbs]) => {\n const handlerPath =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.handlers${extension}`)\n : upath.join(dirname, tag, tag + '.handlers' + extension);\n\n return {\n content: await generateHandlerFile({\n path: handlerPath,\n verbs,\n validatorModule,\n zodModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod`)\n : upath.join(dirname, tag, tag + '.zod'),\n contextModule:\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context`)\n : upath.join(dirname, tag, tag + '.context'),\n }),\n path: handlerPath,\n };\n }),\n );\n }\n\n // One file with all operations.\n const handlerPath = upath.join(dirname, `${filename}.handlers${extension}`);\n\n return [\n {\n content: await generateHandlerFile({\n path: handlerPath,\n verbs: Object.values(verbOptions),\n validatorModule,\n zodModule: upath.join(dirname, `${filename}.zod`),\n contextModule: upath.join(dirname, `${filename}.context`),\n }),\n path: handlerPath,\n },\n ];\n};\n\nconst getContext = (verbOption: GeneratorVerbOptions) => {\n let paramType = '';\n if (verbOption.params.length > 0) {\n const params = getParamsInPath(verbOption.pathRoute).map((name) => {\n const param = verbOption.params.find(\n (p) => p.name === sanitize(camel(name), { es5keyword: true }),\n );\n const definition = param?.definition.split(':')[1];\n const required = param?.required ?? false;\n return {\n definition: `${name}${required ? '' : '?'}:${definition}`,\n };\n });\n paramType = `param: {\\n ${params\n .map((property) => property.definition)\n .join(',\\n ')},\\n },`;\n }\n\n const queryType = verbOption.queryParams\n ? `query: ${verbOption.queryParams?.schema.name},`\n : '';\n const bodyType = verbOption.body.definition\n ? `json: ${verbOption.body.definition},`\n : '';\n const hasIn = !!paramType || !!queryType || !!bodyType;\n\n return `export type ${pascal(\n verbOption.operationName,\n )}Context<E extends Env = any> = Context<E, '${getRoute(\n verbOption.pathRoute,\n )}'${\n hasIn\n ? `, { in: { ${paramType}${queryType}${bodyType} }, out: { ${paramType}${queryType}${bodyType} } }`\n : ''\n }>`;\n};\n\nconst getHeader = (\n option: false | ((info: InfoObject) => string | string[]),\n info: InfoObject,\n): string => {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n};\n\nconst generateContextFile = ({\n path,\n verbs,\n schemaModule,\n}: {\n path: string;\n verbs: GeneratorVerbOptions[];\n schemaModule: string;\n}) => {\n let content = `import type { Context, Env } from 'hono';\\n\\n`;\n\n const contexts = verbs.map((verb) => getContext(verb));\n\n const imps = new Set(\n verbs\n .flatMap((verb) => {\n const imports: GeneratorImport[] = [];\n if (verb.params.length > 0) {\n imports.push(...verb.params.flatMap((param) => param.imports));\n }\n\n if (verb.queryParams) {\n imports.push({\n name: verb.queryParams.schema.name,\n });\n }\n\n if (verb.body.definition) {\n imports.push(...verb.body.imports);\n }\n\n return imports;\n })\n .map((imp) => imp.name)\n .filter((imp) => contexts.some((context) => context.includes(imp))),\n );\n\n if (contexts.some((context) => context.includes('NonReadonly<'))) {\n content += getOrvalGeneratedTypes();\n content += '\\n';\n }\n\n if (imps.size > 0) {\n content += `import type {\\n${[...imps]\n .toSorted()\n .join(\n ',\\n ',\n )}\\n} from '${generateModuleSpecifier(path, schemaModule)}';\\n\\n`;\n }\n\n content += contexts.join('\\n');\n\n return content;\n};\n\nconst generateContextFiles = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n schemaModule: string,\n) => {\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n return Object.entries(groupByTags).map(([tag, verbs]) => {\n const path =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.context${extension}`)\n : upath.join(dirname, tag, tag + '.context' + extension);\n const code = generateContextFile({\n verbs,\n path,\n schemaModule: schemaModule,\n });\n return { content: `${header}${code}`, path };\n });\n }\n\n const path = upath.join(dirname, `${filename}.context${extension}`);\n const code = generateContextFile({\n verbs: Object.values(verbOptions),\n path,\n schemaModule: schemaModule,\n });\n\n return [\n {\n content: `${header}${code}`,\n path,\n },\n ];\n};\n\nconst generateZodFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n if (output.mode === 'tags' || output.mode === 'tags-split') {\n const groupByTags = getVerbOptionGroupByTag(verbOptions);\n\n const builderContexts = await Promise.all(\n Object.entries(groupByTags).map(async ([tag, verbs]) => {\n const zods = await Promise.all(\n verbs.map((verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target!,\n },\n output.client,\n ),\n ),\n );\n\n if (zods.every((z) => z.implementation === '')) {\n return {\n content: '',\n path: '',\n };\n }\n\n const allMutators = zods.reduce<Record<string, GeneratorMutator>>(\n (acc, z) => {\n for (const mutator of z.mutators ?? []) {\n acc[mutator.name] = mutator;\n }\n return acc;\n },\n {},\n );\n\n const mutatorsImports = generateMutatorImports({\n mutators: Object.values(allMutators),\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath =\n output.mode === 'tags'\n ? upath.join(dirname, `${kebab(tag)}.zod${extension}`)\n : upath.join(dirname, tag, tag + '.zod' + extension);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return {\n content,\n path: zodPath,\n };\n }),\n );\n\n return Promise.all(\n builderContexts.filter((context) => context.content !== ''),\n );\n }\n\n const zods = await Promise.all(\n Object.values(verbOptions).map((verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target!,\n },\n output.client,\n ),\n ),\n );\n\n const allMutators = zods.reduce<Record<string, GeneratorMutator>>(\n (acc, z) => {\n for (const mutator of z.mutators ?? []) {\n acc[mutator.name] = mutator;\n }\n return acc;\n },\n {},\n );\n\n const mutatorsImports = generateMutatorImports({\n mutators: Object.values(allMutators),\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath = upath.join(dirname, `${filename}.zod${extension}`);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return [\n {\n content,\n path: zodPath,\n },\n ];\n};\n\nconst generateZvalidator = (\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n let validatorPath = output.override.hono.validatorOutputPath;\n if (!output.override.hono.validatorOutputPath) {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n validatorPath = upath.join(dirname, `${filename}.validator${extension}`);\n }\n\n return {\n content: `${header}${ZVALIDATOR_SOURCE}`,\n path: validatorPath,\n };\n};\n\nconst generateCompositeRoutes = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const targetInfo = getFileInfo(output.target);\n const compositeRouteInfo = getFileInfo(output.override.hono.compositeRoute);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n const routes = Object.values(verbOptions)\n .map((verbOption) => {\n return generateHonoRoute(verbOption, verbOption.pathRoute);\n })\n .join(';');\n\n const importHandlers = Object.values(verbOptions);\n\n let ImportHandlersImplementation: string;\n if (output.override.hono.handlers) {\n const handlerFileInfo = getFileInfo(output.override.hono.handlers);\n const operationNames = importHandlers.map(\n (verbOption) => verbOption.operationName,\n );\n\n ImportHandlersImplementation = operationNames\n .map((operationName) => {\n const importHandlerName = `${operationName}Handlers`;\n\n const handlersPath = generateModuleSpecifier(\n compositeRouteInfo.path,\n upath.join(handlerFileInfo.dirname ?? '', `./${operationName}`),\n );\n\n return `import { ${importHandlerName} } from '${handlersPath}';`;\n })\n .join('\\n');\n } else {\n const tags = importHandlers.map((verbOption) =>\n kebab(verbOption.tags[0] ?? 'default'),\n );\n const uniqueTags = tags.filter((t, i) => tags.indexOf(t) === i);\n\n ImportHandlersImplementation = uniqueTags\n .map((tag) => {\n const importHandlerNames = importHandlers\n .filter((verbOption) => verbOption.tags[0] === tag)\n .map((verbOption) => ` ${verbOption.operationName}Handlers`)\n .join(`, \\n`);\n\n const handlersPath = generateModuleSpecifier(\n compositeRouteInfo.path,\n upath.join(targetInfo.dirname ?? '', tag),\n );\n\n return `import {\\n${importHandlerNames}\\n} from '${handlersPath}/${tag}.handlers';`;\n })\n .join('\\n');\n }\n\n const honoImport = `import { Hono } from 'hono';`;\n const honoInitialization = `\\nconst app = new Hono()`;\n const honoAppExport = `\\nexport default app`;\n\n const content = `${header}${honoImport}\n${ImportHandlersImplementation}\n${honoInitialization}\n${routes}\n${honoAppExport}\n`;\n\n return [\n {\n content,\n path: output.override.hono.compositeRoute || '',\n },\n ];\n};\n\nexport const generateExtraFiles: ClientExtraFilesBuilder = async (\n verbOptions,\n output,\n context,\n) => {\n const { path, pathWithoutExtension } = getFileInfo(output.target);\n const validator = generateZvalidator(output, context);\n let schemaModule: string;\n\n if (output.schemas != undefined) {\n schemaModule = getFileInfo(output.schemas).dirname;\n } else if (output.mode === 'single') {\n schemaModule = path;\n } else {\n schemaModule = `${pathWithoutExtension}.schemas`;\n }\n\n const [handlers, contexts, zods, compositeRoutes] = await Promise.all([\n generateHandlerFiles(verbOptions, output, validator.path),\n generateContextFiles(verbOptions, output, context, schemaModule),\n generateZodFiles(verbOptions, output, context),\n output.override.hono.compositeRoute\n ? generateCompositeRoutes(verbOptions, output, context)\n : [],\n ]);\n\n return [\n ...handlers,\n ...contexts,\n ...zods,\n ...(output.override.hono.validator &&\n output.override.hono.validator !== 'hono'\n ? [validator]\n : []),\n ...compositeRoutes,\n ];\n};\n\nconst honoClientBuilder: ClientGeneratorsBuilder = {\n client: generateHono,\n dependencies: getHonoDependencies,\n header: getHonoHeader,\n footer: getHonoFooter,\n extraFiles: generateExtraFiles,\n};\n\nexport const builder = () => () => honoClientBuilder;\n\nexport default builder;\n"],"mappings":";;;;;;AAEA,MAAM,YAAY,SAA0B,oBAAoB,KAAK,KAAK;AAE1E,MAAM,gBAAgB,SAAyB;CAC7C,MAAM,UAAU,4BAA4B,KAAK,KAAK;AACtD,KAAI,CAAC,SAAS,OAAQ,QAAO;CAE7B,MAAM,OAAO,QAAQ;CACrB,MAAM,QAAQ,SAAS,QAAQ,IAAI;EACjC,YAAY;EACZ,YAAY;EACZ,MAAM;EACN,KAAK;EACN,CAAC;CACF,MAAM,OAAO,SAAS,QAAQ,GAAG,GAAG,aAAa,QAAQ,GAAG,GAAG,QAAQ;AAEvE,QAAO,SAAS,KAAK,GAAG,GAAG,KAAK,IAAI,QAAQ,SAAS,GAAG,OAAO,QAAQ;;AAGzE,MAAa,YAAY,UAAkB;AAGzC,QAFsB,MAAM,MAAM,IAAI,CAEjB,QAAQ,KAAK,MAAM,MAAM;AAC5C,MAAI,CAAC,QAAQ,CAAC,EACZ,QAAO;AAGT,MAAI,CAAC,KAAK,SAAS,IAAI,CACrB,QAAO,GAAG,IAAI,GAAG;AAGnB,SAAO,GAAG,IAAI,GAAG,aAAa,KAAK;IAClC,GAAG;;;;;ACHR,MAAM,oBAAoB,GACvB,aAAa,MAAM,KAAK,OAAO,KAAK,SAAS,gBAAgB,CAAC,CAC9D,SAAS,OAAO;AAEnB,MAAMA,oBAA2C,CAC/C;CACE,SAAS;EACP;GACE,MAAM;GACN,QAAQ;GACT;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AAMC,oBAA6C;CACjD,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAED,MAAa,sBAAsB;AAEnC,kBAAe"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/hono",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"exports": {
|
|
6
|
-
"
|
|
7
|
+
"import": {
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"
|
|
9
|
+
"import": "./dist/index.js"
|
|
9
10
|
}
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
"nuke": "rimraf .turbo dist node_modules"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@orval/core": "
|
|
24
|
-
"@orval/zod": "
|
|
24
|
+
"@orval/core": "8.0.0-rc.0",
|
|
25
|
+
"@orval/zod": "8.0.0-rc.0",
|
|
25
26
|
"fs-extra": "^11.3.2",
|
|
26
27
|
"lodash.uniq": "^4.5.0",
|
|
27
28
|
"openapi3-ts": "4.5.0"
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
"@types/lodash.uniq": "^4.5.9",
|
|
33
34
|
"eslint": "^9.38.0",
|
|
34
35
|
"rimraf": "^6.0.1",
|
|
35
|
-
"tsdown": "^0.15.
|
|
36
|
+
"tsdown": "^0.15.9",
|
|
36
37
|
"typescript": "^5.9.3"
|
|
37
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"stableVersion": "7.15.0"
|
|
38
40
|
}
|