snow-flow 10.0.190 → 10.0.192
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/package.json +1 -1
- package/src/server/describe.ts +12 -7
package/package.json
CHANGED
package/src/server/describe.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { describeRoute, type DescribeRouteOptions } from "hono-openapi"
|
|
2
|
-
import
|
|
2
|
+
import { createMiddleware } from "hono/factory"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Typed wrapper around hono-openapi's `describeRoute` that preserves
|
|
6
6
|
* middleware type-chain compatibility.
|
|
7
7
|
*
|
|
8
|
-
* `describeRoute()` returns
|
|
9
|
-
* which causes overload-resolution failures in tsgo
|
|
8
|
+
* `describeRoute()` returns `MiddlewareHandler` with a fixed string path
|
|
9
|
+
* parameter, which causes overload-resolution failures in tsgo on Linux
|
|
10
10
|
* when combined with `validator()` middleware in a route handler chain.
|
|
11
11
|
*
|
|
12
|
-
* This wrapper
|
|
13
|
-
*
|
|
12
|
+
* This wrapper calls `describeRoute` internally but returns a properly
|
|
13
|
+
* typed middleware created via Hono's `createMiddleware`, which preserves
|
|
14
|
+
* generic type parameters through the handler chain.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export function describe(spec: DescribeRouteOptions) {
|
|
17
|
+
const original = describeRoute(spec)
|
|
18
|
+
return createMiddleware(async (c, next) => {
|
|
19
|
+
return original(c, next)
|
|
20
|
+
})
|
|
21
|
+
}
|