@rexeus/typeweaver-hono 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/dist/LICENSE +1 -1
- package/dist/NOTICE +1 -1
- package/dist/templates/HonoRouter.ejs +3 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -32,7 +32,8 @@ npm install @rexeus/typeweaver-core
|
|
|
32
32
|
npx typeweaver generate --input ./api/definition --output ./api/generated --plugins hono
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
More on the CLI in
|
|
35
|
+
More on the CLI in
|
|
36
|
+
[@rexeus/typeweaver](https://github.com/rexeus/typeweaver/tree/main/packages/cli/README.md#️-cli).
|
|
36
37
|
|
|
37
38
|
## 📂 Generated Output
|
|
38
39
|
|
|
@@ -107,21 +108,23 @@ serve({ fetch: app.fetch, port: 3000 }, () => {
|
|
|
107
108
|
|
|
108
109
|
`TypeweaverHonoOptions<RequestHandlers>`
|
|
109
110
|
|
|
110
|
-
- `requestHandlers`: object implementing the generated `<ResourceName>ApiHandler`
|
|
111
|
+
- `requestHandlers`: object implementing the generated `<ResourceName>ApiHandler` type
|
|
111
112
|
- `validateRequests` (default: `true`): enable/disable request validation
|
|
112
|
-
- `handleValidationErrors`: `true` | `false` | `(err, c) => IHttpResponse
|
|
113
|
+
- `handleValidationErrors`: `true` | `false` | `(err, c) => IHttpResponse | Promise<IHttpResponse>`,
|
|
113
114
|
- If `true` (default), returns `400 Bad Request` with validation issues in the body
|
|
114
|
-
- If `false`,
|
|
115
|
+
- If `false`, disables this handler (errors fall through to the unknown error handler)
|
|
115
116
|
- If function, calls the function with the error and context, expects an `IHttpResponse` to
|
|
116
117
|
return, so you can customize the response in the way you want
|
|
117
|
-
- `handleHttpResponseErrors`: `true` | `false` |
|
|
118
|
+
- `handleHttpResponseErrors`: `true` | `false` |
|
|
119
|
+
`(err, c) => IHttpResponse | Promise<IHttpResponse>`
|
|
118
120
|
- If `true` (default), returns thrown `HttpResponse` as-is, they will be sent as the response
|
|
119
|
-
- If `false`,
|
|
121
|
+
- If `false`, disables this handler (errors fall through to the unknown error handler)
|
|
120
122
|
- If function, calls the function with the error and context, expects an `IHttpResponse` to
|
|
121
123
|
return, so you can customize the response in the way you want
|
|
122
|
-
- `handleUnknownErrors`: `true` | `false` | `(err, c) => IHttpResponse
|
|
124
|
+
- `handleUnknownErrors`: `true` | `false` | `(err, c) => IHttpResponse | Promise<IHttpResponse>`
|
|
123
125
|
- If `true` (default), returns `500 Internal Server Error` with a generic message
|
|
124
|
-
- If `false`,
|
|
126
|
+
- If `false`, disables this handler (errors propagate to Hono's error handling, e.g. via
|
|
127
|
+
`app.onError`)
|
|
125
128
|
- If function, calls the function with the error and context, expects an `IHttpResponse` to
|
|
126
129
|
return, so you can customize the response in the way you want
|
|
127
130
|
|
|
@@ -130,4 +133,4 @@ object.
|
|
|
130
133
|
|
|
131
134
|
## 📄 License
|
|
132
135
|
|
|
133
|
-
Apache 2.0 © Dennis Wentzien
|
|
136
|
+
Apache 2.0 © Dennis Wentzien 2026
|
package/dist/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2026 Dennis Wentzien
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/dist/NOTICE
CHANGED
|
@@ -14,14 +14,14 @@ import { <%- operation.className %>RequestValidator } from "./<%- operation.clas
|
|
|
14
14
|
import type { <%- operation.className %>Response } from "./<%- operation.className %>Response";
|
|
15
15
|
<% } %>
|
|
16
16
|
|
|
17
|
-
export type <%- pascalCaseEntityName %>ApiHandler = {
|
|
17
|
+
export type Hono<%- pascalCaseEntityName %>ApiHandler = {
|
|
18
18
|
<% for (const operation of operations) { %>
|
|
19
19
|
<%- operation.handlerName %>: HonoRequestHandler<I<%- operation.className %>Request, <%- operation.className %>Response>;
|
|
20
20
|
<% } %>
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export class <%- pascalCaseEntityName %>Hono extends TypeweaverHono
|
|
24
|
-
public constructor(options: TypeweaverHonoOptions
|
|
23
|
+
export class <%- pascalCaseEntityName %>Hono extends TypeweaverHono<Hono<%- pascalCaseEntityName %>ApiHandler> {
|
|
24
|
+
public constructor(options: TypeweaverHonoOptions<Hono<%- pascalCaseEntityName %>ApiHandler>) {
|
|
25
25
|
super(options);
|
|
26
26
|
this.setupRoutes();
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexeus/typeweaver-hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Generates Hono routers and handlers straight from your API definitions. Powered by Typeweaver 🧵✨",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"homepage": "https://github.com/rexeus/typeweaver#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"hono": "^4.11.0",
|
|
50
|
-
"@rexeus/typeweaver-core": "^0.
|
|
51
|
-
"@rexeus/typeweaver-gen": "^0.
|
|
50
|
+
"@rexeus/typeweaver-core": "^0.5.1",
|
|
51
|
+
"@rexeus/typeweaver-gen": "^0.5.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"hono": "^4.11.3",
|
|
55
55
|
"test-utils": "file:../test-utils",
|
|
56
|
-
"@rexeus/typeweaver-
|
|
57
|
-
"@rexeus/typeweaver-
|
|
56
|
+
"@rexeus/typeweaver-gen": "^0.5.1",
|
|
57
|
+
"@rexeus/typeweaver-core": "^0.5.1"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"case": "^1.6.3"
|