@wyrly/express 1.0.0 → 1.0.3
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/express/middleware.d.ts.map +1 -1
- package/esm/express/middleware.js +2 -1
- package/esm/express/mod.d.ts +1 -1
- package/esm/express/mod.d.ts.map +1 -1
- package/esm/express/mod.js +1 -1
- package/esm/express/types.d.ts +7 -8
- package/esm/express/types.d.ts.map +1 -1
- package/esm/express/types.js +4 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/express/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/express/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAejE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExpressRequestToken, ExpressResponseToken } from "./tokens.js";
|
|
2
|
+
import { asExpressRequestWithDI } from "./types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a DI scope per request and attaches it to `req.di`.
|
|
4
5
|
* Disposes the scope on response `finish` / `close`.
|
|
@@ -11,7 +12,7 @@ export function diMiddleware(container) {
|
|
|
11
12
|
const scope = container.createScope();
|
|
12
13
|
scope.set(ExpressRequestToken, req);
|
|
13
14
|
scope.set(ExpressResponseToken, res);
|
|
14
|
-
req.di = scope;
|
|
15
|
+
asExpressRequestWithDI(req).di = scope;
|
|
15
16
|
const disposeScope = () => {
|
|
16
17
|
void scope.dispose();
|
|
17
18
|
};
|
package/esm/express/mod.d.ts
CHANGED
package/esm/express/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/express/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/express/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
package/esm/express/mod.js
CHANGED
package/esm/express/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import type { Request } from "express";
|
|
1
2
|
import type { Scope } from "../core/mod.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
/** Express `Request` with the DI scope attached by `diMiddleware`. */
|
|
4
|
+
export type ExpressRequestWithDI = Request & {
|
|
5
|
+
di: Scope;
|
|
6
|
+
};
|
|
7
|
+
/** Narrow `req` after `diMiddleware` (use instead of casting when route generics block overlap). */
|
|
8
|
+
export declare function asExpressRequestWithDI(req: Request): ExpressRequestWithDI;
|
|
10
9
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/express/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/express/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,sEAAsE;AACtE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAE3D,oGAAoG;AACpG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAEzE"}
|
package/esm/express/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wyrly/express",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Wyrly DI adapter for Express",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
8
|
-
"directory": "
|
|
7
|
+
"url": "git+https://github.com/valid-lab/wyrly.git",
|
|
8
|
+
"directory": "packages/express"
|
|
9
9
|
},
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"module": "./esm/express/mod.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"express": "5",
|
|
21
21
|
"@deno/shim-deno": "~0.18.0",
|
|
22
|
-
"@wyrly/core": "^1.0.
|
|
22
|
+
"@wyrly/core": "^1.0.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"express": "^5.0.0"
|