@wyrly/hono 1.0.5 → 1.0.6
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/esm/hono/middleware.d.ts +2 -2
- package/esm/hono/middleware.d.ts.map +1 -1
- package/esm/hono/middleware.js +2 -1
- package/esm/hono/mod.d.ts +1 -0
- package/esm/hono/mod.d.ts.map +1 -1
- package/esm/hono/public_types.d.ts +7 -0
- package/esm/hono/public_types.d.ts.map +1 -0
- package/esm/hono/public_types.js +1 -0
- package/esm/hono/tokens.d.ts +2 -2
- package/esm/hono/tokens.d.ts.map +1 -1
- package/esm/hono/types.d.ts +2 -2
- package/esm/hono/types.d.ts.map +1 -1
- package/package.json +2 -2
package/esm/hono/middleware.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MiddlewareHandler } from "hono";
|
|
2
1
|
import type { Container } from "../core/mod.js";
|
|
2
|
+
import type { HonoMiddlewareHandler } from "./public_types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a DI scope per request and attaches it via `c.set("di", scope)`.
|
|
5
5
|
* Disposes the scope after `await next()` (including on handler error, via `finally`).
|
|
@@ -7,5 +7,5 @@ import type { Container } from "../core/mod.js";
|
|
|
7
7
|
* In the domain layer, avoid injecting `HonoContextToken` / `RequestToken` directly;
|
|
8
8
|
* map them to port tokens (e.g. `CurrentUser`) in the composition root instead.
|
|
9
9
|
*/
|
|
10
|
-
export declare function di(container: Container):
|
|
10
|
+
export declare function di(container: Container): HonoMiddlewareHandler;
|
|
11
11
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/hono/middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/hono/middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI/D;;;;;;GAMG;AACH,wBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,GAAG,qBAAqB,CAa9D"}
|
package/esm/hono/middleware.js
CHANGED
|
@@ -8,7 +8,7 @@ import { diVariableKey } from "./types.js";
|
|
|
8
8
|
* map them to port tokens (e.g. `CurrentUser`) in the composition root instead.
|
|
9
9
|
*/
|
|
10
10
|
export function di(container) {
|
|
11
|
-
|
|
11
|
+
const handler = async (c, next) => {
|
|
12
12
|
const scope = container.createScope();
|
|
13
13
|
scope.set(HonoContextToken, c);
|
|
14
14
|
scope.set(RequestToken, c.req.raw);
|
|
@@ -20,4 +20,5 @@ export function di(container) {
|
|
|
20
20
|
await scope.dispose();
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
return handler;
|
|
23
24
|
}
|
package/esm/hono/mod.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
21
21
|
export type { ClassProvider, ClassToken, Container, DependencyEdge, DependencyGraph, DependencyNode, ExistingProvider, FactoryProvider, InjectionToken, Lifetime, Locale, Provider, ProviderType, Scope, Token, ValidateOptions, ValidationIssue, ValidationResult, ValueProvider, } from "../core/mod.js";
|
|
22
|
+
export type { HonoContext, HonoMiddlewareHandler } from "./public_types.js";
|
|
22
23
|
export { di } from "./middleware.js";
|
|
23
24
|
export { HonoContextToken, RequestToken } from "./tokens.js";
|
|
24
25
|
export { diVariableKey, getDI, type HonoDIVariables } from "./types.js";
|
package/esm/hono/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/hono/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,KAAK,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/hono/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,KAAK,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context as HonoContextBase } from "hono";
|
|
2
|
+
/** Hono request context (package-public doc type). */
|
|
3
|
+
export interface HonoContext extends HonoContextBase {
|
|
4
|
+
}
|
|
5
|
+
/** Hono middleware signature used by `di()` (package-public doc type). */
|
|
6
|
+
export type HonoMiddlewareHandler = (c: HonoContext, next: () => Promise<void>) => Promise<void | Response>;
|
|
7
|
+
//# sourceMappingURL=public_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_types.d.ts","sourceRoot":"","sources":["../../src/hono/public_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvD,sDAAsD;AACtD,MAAM,WAAW,WAAY,SAAQ,eAAe;CAAG;AAEvD,0EAA0E;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAClC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KACtB,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/hono/tokens.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
1
|
import { type Token } from "../core/mod.js";
|
|
2
|
+
import type { HonoContext } from "./public_types.js";
|
|
3
3
|
/** Current Hono `Context` (resolvable only in request scope) */
|
|
4
|
-
export declare const HonoContextToken: Token<
|
|
4
|
+
export declare const HonoContextToken: Token<HonoContext>;
|
|
5
5
|
/** Current Web API `Request` (`c.req.raw`; resolvable only in request scope) */
|
|
6
6
|
export declare const RequestToken: Token<Request>;
|
|
7
7
|
//# sourceMappingURL=tokens.d.ts.map
|
package/esm/hono/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/hono/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/hono/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAqC,CAAC;AAEtF,gFAAgF;AAChF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,OAAO,CAA6B,CAAC"}
|
package/esm/hono/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Context } from "hono";
|
|
2
1
|
import type { Scope } from "../core/mod.js";
|
|
2
|
+
import type { HonoContext } from "./public_types.js";
|
|
3
3
|
/** Context variable key used by `di()` middleware. */
|
|
4
4
|
export declare const diVariableKey: "di";
|
|
5
5
|
/** Pass to `new Hono<{ Variables: HonoDIVariables }>()` for typed `getDI(c)`. */
|
|
@@ -7,5 +7,5 @@ export type HonoDIVariables = {
|
|
|
7
7
|
[diVariableKey]: Scope;
|
|
8
8
|
};
|
|
9
9
|
/** Read the request DI scope set by `di()` (use when `Variables` is not generic). */
|
|
10
|
-
export declare function getDI(c:
|
|
10
|
+
export declare function getDI(c: HonoContext): Scope;
|
|
11
11
|
//# sourceMappingURL=types.d.ts.map
|
package/esm/hono/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hono/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hono/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,sDAAsD;AACtD,eAAO,MAAM,aAAa,EAAG,IAAa,CAAC;AAE3C,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,KAAK,CAAC,CAAC,EAAE,WAAW,GAAG,KAAK,CAE3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyrly/hono",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Wyrly DI adapter for Hono — request scope via di() middleware",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wyrly",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"hono": "4",
|
|
38
|
-
"@wyrly/core": "^1.0.
|
|
38
|
+
"@wyrly/core": "^1.0.6"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"hono": "^4.0.0"
|