@c9up/ream 0.2.5 → 0.2.7
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 +3 -9
- package/dist/HttpKernel.js +2 -2
- package/dist/HttpKernel.js.map +1 -1
- package/dist/Ignitor.d.ts +3 -3
- package/dist/Ignitor.d.ts.map +1 -1
- package/dist/Ignitor.js +50 -0
- package/dist/Ignitor.js.map +1 -1
- package/dist/bootstrap/hyper-server.js.map +1 -1
- package/dist/helpers/compose.d.ts +30 -0
- package/dist/helpers/compose.d.ts.map +1 -0
- package/dist/helpers/compose.js +27 -0
- package/dist/helpers/compose.js.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/is.d.ts +69 -16
- package/dist/helpers/is.d.ts.map +1 -1
- package/dist/helpers/is.js +80 -20
- package/dist/helpers/is.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/middleware/Pipeline.d.ts +9 -3
- package/dist/middleware/Pipeline.d.ts.map +1 -1
- package/dist/middleware/Pipeline.js +10 -4
- package/dist/middleware/Pipeline.js.map +1 -1
- package/dist/rpc/RpcRouter.js +2 -2
- package/dist/rpc/RpcRouter.js.map +1 -1
- package/dist/scheduler/Scheduler.d.ts.map +1 -1
- package/dist/scheduler/Scheduler.js +12 -4
- package/dist/scheduler/Scheduler.js.map +1 -1
- package/dist/services/app.d.ts +6 -0
- package/dist/services/app.d.ts.map +1 -1
- package/dist/services/app.js +8 -0
- package/dist/services/app.js.map +1 -1
- package/dist/services/config.d.ts +15 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +18 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/encryption.d.ts +23 -0
- package/dist/services/encryption.d.ts.map +1 -0
- package/dist/services/encryption.js +33 -0
- package/dist/services/encryption.js.map +1 -0
- package/dist/services/logger.d.ts +29 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/logger.js +40 -0
- package/dist/services/logger.js.map +1 -0
- package/dist/services/urlBuilder.d.ts +21 -0
- package/dist/services/urlBuilder.d.ts.map +1 -0
- package/dist/services/urlBuilder.js +34 -0
- package/dist/services/urlBuilder.js.map +1 -0
- package/dist/session/Session.js.map +1 -1
- package/dist/testing/ApiResponse.d.ts +44 -44
- package/dist/testing/ApiResponse.d.ts.map +1 -1
- package/dist/testing/ApiResponse.js +48 -48
- package/dist/testing/ApiResponse.js.map +1 -1
- package/dist/testing/RequestBuilder.d.ts +39 -39
- package/dist/testing/RequestBuilder.d.ts.map +1 -1
- package/dist/testing/RequestBuilder.js +49 -49
- package/dist/testing/RequestBuilder.js.map +1 -1
- package/dist/testing/TestClient.d.ts +23 -8
- package/dist/testing/TestClient.d.ts.map +1 -1
- package/dist/testing/TestClient.js +52 -11
- package/dist/testing/TestClient.js.map +1 -1
- package/dist/testing/testUtils.d.ts +62 -0
- package/dist/testing/testUtils.d.ts.map +1 -0
- package/dist/testing/testUtils.js +77 -0
- package/dist/testing/testUtils.js.map +1 -0
- package/events.win32-x64-msvc.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +21 -1
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/HttpKernel.ts +2 -2
- package/src/Ignitor.ts +59 -4
- package/src/bootstrap/hyper-server.ts +1 -1
- package/src/helpers/compose.ts +84 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/is.ts +88 -22
- package/src/index.ts +2 -2
- package/src/middleware/Pipeline.ts +10 -4
- package/src/rpc/RpcRouter.ts +2 -2
- package/src/scheduler/Scheduler.ts +10 -4
- package/src/services/app.ts +9 -0
- package/src/services/config.ts +24 -0
- package/src/services/encryption.ts +42 -0
- package/src/services/logger.ts +49 -0
- package/src/services/urlBuilder.ts +41 -0
- package/src/session/Session.ts +2 -2
- package/src/testing/ApiResponse.ts +52 -52
- package/src/testing/RequestBuilder.ts +55 -55
- package/src/testing/TestClient.ts +55 -13
- package/src/testing/testUtils.ts +90 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestClient.js","sourceRoot":"","sources":["../../src/testing/TestClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAIL,cAAc,GAGf,MAAM,qBAAqB,CAAA;AAE5B,4EAA4E;AAC5E,6EAA6E;AAC7E,OAAO,EAAE,WAAW,EAAqB,MAAM,qBAAqB,CAAA;AAcpE,MAAM,OAAO,UAAU;IACrB,KAAK,GAAG,CAAC,CAAA;IACT,QAAQ,GAAS,EAAE,CAAA;IACnB,OAAO,CAAgF;IACvF,KAAK,CAAqB;IAC1B,cAAc,CAAsB;IACpC,OAAO,CAAsB;IAE7B,YACE,MAAsF,EACtF,UAKI,EAAE;QAEN,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAA;QACrC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAA;IACrD,CAAC;IAED,OAAO,GAA+D,IAAI,CAAA;IAE1E,
|
|
1
|
+
{"version":3,"file":"TestClient.js","sourceRoot":"","sources":["../../src/testing/TestClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAIL,cAAc,GAGf,MAAM,qBAAqB,CAAA;AAE5B,4EAA4E;AAC5E,6EAA6E;AAC7E,OAAO,EAAE,WAAW,EAAqB,MAAM,qBAAqB,CAAA;AAcpE,MAAM,OAAO,UAAU;IACrB,KAAK,GAAG,CAAC,CAAA;IACT,QAAQ,GAAS,EAAE,CAAA;IACnB,OAAO,CAAgF;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AAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QACpC,IAAI,OAAO,KAAK,CAAC,CAAC;YAAE,MAAK;QACzB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACtF,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;YAAE,MAAK;QAC7C,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,IAAI,KAAK,CAAC;YAAE,MAAK;QACrB,IAAI,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;YACzB,MAAK;QACP,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QACnC,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAA,CAAC,wBAAwB;IAClD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities, in the shape AdonisJS gives them: `testUtils.httpServer()`
|
|
3
|
+
* starts the application's HTTP server for a test run and hands back the
|
|
4
|
+
* function that closes it.
|
|
5
|
+
*
|
|
6
|
+
* // tests/bootstrap.ts
|
|
7
|
+
* configureSuite(suite) {
|
|
8
|
+
* if (['functional', 'e2e'].includes(suite.name)) {
|
|
9
|
+
* return suite.setup(() => testUtils.httpServer().start())
|
|
10
|
+
* }
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* The point of the shape is WHERE the server starts. A suite that does not
|
|
14
|
+
* declare the hook never starts one, so a unit suite pays nothing — which is
|
|
15
|
+
* the same saving a lazily-booted client buys, obtained by scoping instead of
|
|
16
|
+
* by deferring, and obtained per SUITE rather than per file.
|
|
17
|
+
*
|
|
18
|
+
* `start()` returning its own teardown is what makes it a one-liner in a hook:
|
|
19
|
+
* a setup hook may return its undo, so there is no matching `teardown` to
|
|
20
|
+
* write and no way to forget it.
|
|
21
|
+
*/
|
|
22
|
+
import { TestClient } from './TestClient.js';
|
|
23
|
+
/** Boots the app on `port` and reports the port it bound plus how to stop it. */
|
|
24
|
+
export type BootServer = (port: number) => Promise<{
|
|
25
|
+
port: number;
|
|
26
|
+
close: () => Promise<void> | void;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* What `testUtils.httpServer()` returns — AdonisJS `HttpServerUtils`.
|
|
30
|
+
*/
|
|
31
|
+
export declare class HttpServerUtils {
|
|
32
|
+
#private;
|
|
33
|
+
constructor(boot: BootServer, onStarted: (client: TestClient) => void);
|
|
34
|
+
/**
|
|
35
|
+
* Start the server. Returns the function that closes it, so a setup hook can
|
|
36
|
+
* return this call directly.
|
|
37
|
+
*/
|
|
38
|
+
start(): Promise<() => Promise<void>>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The utilities themselves — AdonisJS `TestUtils`.
|
|
42
|
+
*
|
|
43
|
+
* Constructed with how to boot the app, because ream has no ambient
|
|
44
|
+
* application to reach for: the app is whatever the test bootstrap hands over.
|
|
45
|
+
* That is the one place this differs from AdonisJS, where `testUtils` is a
|
|
46
|
+
* service resolved from the container and already knows its app.
|
|
47
|
+
*/
|
|
48
|
+
export declare class TestUtils {
|
|
49
|
+
#private;
|
|
50
|
+
constructor(boot: BootServer);
|
|
51
|
+
/** Start/stop the HTTP server for a suite. */
|
|
52
|
+
httpServer(): HttpServerUtils;
|
|
53
|
+
/**
|
|
54
|
+
* The client for the server this run started, or `undefined` before
|
|
55
|
+
* `httpServer().start()`. A plugin reads it to put a client on the test
|
|
56
|
+
* context without booting a second server.
|
|
57
|
+
*/
|
|
58
|
+
client(): TestClient | undefined;
|
|
59
|
+
}
|
|
60
|
+
/** Build the utilities for an app booted by `boot`. */
|
|
61
|
+
export declare function createTestUtils(boot: BootServer): TestUtils;
|
|
62
|
+
//# sourceMappingURL=testUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../src/testing/testUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,CAAA;AAEjE;;GAEG;AACH,qBAAa,eAAe;;gBAId,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;IAKrE;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAM5C;AAED;;;;;;;GAOG;AACH,qBAAa,SAAS;;gBAIR,IAAI,EAAE,UAAU;IAI5B,8CAA8C;IAC9C,UAAU,IAAI,eAAe;IAM7B;;;;OAIG;IACH,MAAM,IAAI,UAAU,GAAG,SAAS;CAGjC;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAE3D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities, in the shape AdonisJS gives them: `testUtils.httpServer()`
|
|
3
|
+
* starts the application's HTTP server for a test run and hands back the
|
|
4
|
+
* function that closes it.
|
|
5
|
+
*
|
|
6
|
+
* // tests/bootstrap.ts
|
|
7
|
+
* configureSuite(suite) {
|
|
8
|
+
* if (['functional', 'e2e'].includes(suite.name)) {
|
|
9
|
+
* return suite.setup(() => testUtils.httpServer().start())
|
|
10
|
+
* }
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* The point of the shape is WHERE the server starts. A suite that does not
|
|
14
|
+
* declare the hook never starts one, so a unit suite pays nothing — which is
|
|
15
|
+
* the same saving a lazily-booted client buys, obtained by scoping instead of
|
|
16
|
+
* by deferring, and obtained per SUITE rather than per file.
|
|
17
|
+
*
|
|
18
|
+
* `start()` returning its own teardown is what makes it a one-liner in a hook:
|
|
19
|
+
* a setup hook may return its undo, so there is no matching `teardown` to
|
|
20
|
+
* write and no way to forget it.
|
|
21
|
+
*/
|
|
22
|
+
import { TestClient } from './TestClient.js';
|
|
23
|
+
/**
|
|
24
|
+
* What `testUtils.httpServer()` returns — AdonisJS `HttpServerUtils`.
|
|
25
|
+
*/
|
|
26
|
+
export class HttpServerUtils {
|
|
27
|
+
#boot;
|
|
28
|
+
#onStarted;
|
|
29
|
+
constructor(boot, onStarted) {
|
|
30
|
+
this.#boot = boot;
|
|
31
|
+
this.#onStarted = onStarted;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Start the server. Returns the function that closes it, so a setup hook can
|
|
35
|
+
* return this call directly.
|
|
36
|
+
*/
|
|
37
|
+
async start() {
|
|
38
|
+
const client = new TestClient(this.#boot);
|
|
39
|
+
await client.boot();
|
|
40
|
+
this.#onStarted(client);
|
|
41
|
+
return () => client.close();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The utilities themselves — AdonisJS `TestUtils`.
|
|
46
|
+
*
|
|
47
|
+
* Constructed with how to boot the app, because ream has no ambient
|
|
48
|
+
* application to reach for: the app is whatever the test bootstrap hands over.
|
|
49
|
+
* That is the one place this differs from AdonisJS, where `testUtils` is a
|
|
50
|
+
* service resolved from the container and already knows its app.
|
|
51
|
+
*/
|
|
52
|
+
export class TestUtils {
|
|
53
|
+
#boot;
|
|
54
|
+
#client;
|
|
55
|
+
constructor(boot) {
|
|
56
|
+
this.#boot = boot;
|
|
57
|
+
}
|
|
58
|
+
/** Start/stop the HTTP server for a suite. */
|
|
59
|
+
httpServer() {
|
|
60
|
+
return new HttpServerUtils(this.#boot, (client) => {
|
|
61
|
+
this.#client = client;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The client for the server this run started, or `undefined` before
|
|
66
|
+
* `httpServer().start()`. A plugin reads it to put a client on the test
|
|
67
|
+
* context without booting a second server.
|
|
68
|
+
*/
|
|
69
|
+
client() {
|
|
70
|
+
return this.#client;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Build the utilities for an app booted by `boot`. */
|
|
74
|
+
export function createTestUtils(boot) {
|
|
75
|
+
return new TestUtils(boot);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../../src/testing/testUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAO5C;;GAEG;AACH,MAAM,OAAO,eAAe;IACjB,KAAK,CAAY;IACjB,UAAU,CAA8B;IAEjD,YAAY,IAAgB,EAAE,SAAuC;QACnE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACzC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;QACnB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACvB,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,SAAS;IACX,KAAK,CAAY;IAC1B,OAAO,CAAwB;IAE/B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,8CAA8C;IAC9C,UAAU;QACR,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;YAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAED,uDAAuD;AACvD,MAAM,UAAU,eAAe,CAAC,IAAgB;IAC9C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC"}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/ream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Ream — Rust-powered Node.js application framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,6 +35,22 @@
|
|
|
35
35
|
"types": "./dist/services/app.d.ts",
|
|
36
36
|
"import": "./dist/services/app.js"
|
|
37
37
|
},
|
|
38
|
+
"./services/config": {
|
|
39
|
+
"types": "./dist/services/config.d.ts",
|
|
40
|
+
"import": "./dist/services/config.js"
|
|
41
|
+
},
|
|
42
|
+
"./services/encryption": {
|
|
43
|
+
"types": "./dist/services/encryption.d.ts",
|
|
44
|
+
"import": "./dist/services/encryption.js"
|
|
45
|
+
},
|
|
46
|
+
"./services/logger": {
|
|
47
|
+
"types": "./dist/services/logger.d.ts",
|
|
48
|
+
"import": "./dist/services/logger.js"
|
|
49
|
+
},
|
|
50
|
+
"./services/urlBuilder": {
|
|
51
|
+
"types": "./dist/services/urlBuilder.d.ts",
|
|
52
|
+
"import": "./dist/services/urlBuilder.js"
|
|
53
|
+
},
|
|
38
54
|
"./services/router": {
|
|
39
55
|
"types": "./dist/services/router.d.ts",
|
|
40
56
|
"import": "./dist/services/router.js"
|
|
@@ -79,6 +95,10 @@
|
|
|
79
95
|
"types": "./dist/testing/TestClient.d.ts",
|
|
80
96
|
"import": "./dist/testing/TestClient.js"
|
|
81
97
|
},
|
|
98
|
+
"./testing/utils": {
|
|
99
|
+
"types": "./dist/testing/testUtils.d.ts",
|
|
100
|
+
"import": "./dist/testing/testUtils.js"
|
|
101
|
+
},
|
|
82
102
|
"./bootstrap": {
|
|
83
103
|
"types": "./dist/bootstrap/hyper-server.d.ts",
|
|
84
104
|
"import": "./dist/bootstrap/hyper-server.js"
|
|
Binary file
|
package/src/HttpKernel.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
MiddlewareRegistry,
|
|
20
20
|
RuntimeValidator,
|
|
21
21
|
} from './middleware/Pipeline.js'
|
|
22
|
-
import {
|
|
22
|
+
import { composeMiddleware } from './middleware/Pipeline.js'
|
|
23
23
|
import type { AnyConstructor, RouteDefinition, Router } from './router/Router.js'
|
|
24
24
|
import type { CookieSigner } from './security/CookieSigner.js'
|
|
25
25
|
import type { SignedUrl } from './security/SignedUrl.js'
|
|
@@ -318,7 +318,7 @@ export function createHttpKernel(
|
|
|
318
318
|
// HttpContext ALS so HttpContext.get()/getOrFail() reach this request
|
|
319
319
|
// anywhere down the call stack (AdonisJS parity) — transparent to the
|
|
320
320
|
// pipeline itself.
|
|
321
|
-
const fullPipeline =
|
|
321
|
+
const fullPipeline = composeMiddleware([...serverMw, coreHandler])
|
|
322
322
|
await HttpContext.run(ctx, () => fullPipeline(ctx, async () => {}))
|
|
323
323
|
|
|
324
324
|
ctx.events?.emit('http:response', {
|
package/src/Ignitor.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { startHotReload } from './HotReload.js'
|
|
|
30
30
|
import type { HttpKernelRequest, HttpKernelResponse } from './HttpKernel.js'
|
|
31
31
|
import { createHttpKernel } from './HttpKernel.js'
|
|
32
32
|
import { ExceptionHandler } from './http/Exception.js'
|
|
33
|
-
import { HttpContext } from './http/HttpContext.js'
|
|
33
|
+
import { type ChildLoggerSource, HttpContext } from './http/HttpContext.js'
|
|
34
34
|
import type { MiddlewareFunction } from './middleware/Pipeline.js'
|
|
35
35
|
import { MiddlewareRegistry } from './middleware/Pipeline.js'
|
|
36
36
|
import { MigrationRegistry } from './migrations/MigrationRegistry.js'
|
|
@@ -41,6 +41,8 @@ import { CookieSigner } from './security/CookieSigner.js'
|
|
|
41
41
|
import { SignedUrl } from './security/SignedUrl.js'
|
|
42
42
|
import { Server } from './server/Server.js'
|
|
43
43
|
import { clearApp, setApp } from './services/app.js'
|
|
44
|
+
import { clearEncryption, setEncryption } from './services/encryption.js'
|
|
45
|
+
import { clearLogger, setLogger } from './services/logger.js'
|
|
44
46
|
import { clearRouter, setRouter } from './services/router.js'
|
|
45
47
|
import { clearServer, setServer } from './services/server.js'
|
|
46
48
|
import { registerSessionTemplateTags } from './session/templateTags.js'
|
|
@@ -102,7 +104,7 @@ export interface TestSuiteConfig {
|
|
|
102
104
|
name: string
|
|
103
105
|
/**
|
|
104
106
|
* The suite's files: a glob, several, or a callback returning their URLs
|
|
105
|
-
* (
|
|
107
|
+
* (helix `TestFiles`).
|
|
106
108
|
*/
|
|
107
109
|
files: string | string[] | (() => URL[] | Promise<URL[]>)
|
|
108
110
|
/** Per-test timeout for this suite, in ms. */
|
|
@@ -110,7 +112,7 @@ export interface TestSuiteConfig {
|
|
|
110
112
|
/** Extra attempts on failure for this suite. */
|
|
111
113
|
retries?: number
|
|
112
114
|
/**
|
|
113
|
-
* Configure the suite before it runs (
|
|
115
|
+
* Configure the suite before it runs (helix `TestSuite.configure`). Receives
|
|
114
116
|
* the same handle as the bootstrap's `configureSuite`, and runs after it.
|
|
115
117
|
*
|
|
116
118
|
* Costs an import of the rc file in every worker, since a function cannot
|
|
@@ -136,7 +138,7 @@ export interface TestSuiteHandle {
|
|
|
136
138
|
/**
|
|
137
139
|
* The `tests` block of the rc file — AdonisJS `adonisrc.ts` `tests`, field for
|
|
138
140
|
* field. The runner that consumes it is helix; ream reads the file, exactly as
|
|
139
|
-
* `@adonisjs/core` reads adonisrc and hands the suites to
|
|
141
|
+
* `@adonisjs/core` reads adonisrc and hands the suites to helix.
|
|
140
142
|
*/
|
|
141
143
|
export interface TestsConfig {
|
|
142
144
|
/** Named suites. `ream test` with no argument runs them all, in order. */
|
|
@@ -152,8 +154,34 @@ export interface TestsConfig {
|
|
|
152
154
|
bootstrap?: string
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Every option the `tests` block accepts.
|
|
159
|
+
*
|
|
160
|
+
* Kept beside the interface because it is the same list: TypeScript's
|
|
161
|
+
* excess-property check only fires on an object literal, so a key that reached
|
|
162
|
+
* `defineConfig` through a variable or a spread is invisible to it.
|
|
163
|
+
*/
|
|
164
|
+
const TESTS_OPTIONS = ['bootstrap', 'forceExit', 'suites', 'timeout'] as const
|
|
165
|
+
|
|
155
166
|
/** defineConfig helper — like AdonisJS defineConfig(). */
|
|
156
167
|
export function defineConfig(config: ReamrcConfig): ReamrcConfig {
|
|
168
|
+
// A key nobody reads is worse than a rejected one: an option that was
|
|
169
|
+
// renamed, removed between versions, or simply mistyped sits in the rc file
|
|
170
|
+
// doing nothing, and the run behaves as if it had never been written. Say so
|
|
171
|
+
// instead, and list what the block does accept — which is also the answer to
|
|
172
|
+
// "then where did my option go".
|
|
173
|
+
const unknown = Object.keys(config.tests ?? {}).filter(
|
|
174
|
+
(key) => !TESTS_OPTIONS.includes(key as (typeof TESTS_OPTIONS)[number]),
|
|
175
|
+
)
|
|
176
|
+
if (unknown.length > 0) {
|
|
177
|
+
throw new ReamError(
|
|
178
|
+
'E_REAMRC_UNKNOWN_OPTION',
|
|
179
|
+
`\`tests\` has no option named ${unknown.map((k) => `\`${k}\``).join(', ')}.`,
|
|
180
|
+
{
|
|
181
|
+
hint: `The \`tests\` block accepts: ${TESTS_OPTIONS.join(', ')}. An option removed between versions is gone from the rc file too — the runner is configured in the bootstrap module now.`,
|
|
182
|
+
},
|
|
183
|
+
)
|
|
184
|
+
}
|
|
157
185
|
return config
|
|
158
186
|
}
|
|
159
187
|
|
|
@@ -217,6 +245,17 @@ export class Ignitor {
|
|
|
217
245
|
/** Where each data package registers its migration runner. See `MigrationRegistry`. */
|
|
218
246
|
#migrations: MigrationRegistry
|
|
219
247
|
#errorBoundary: ErrorBoundary
|
|
248
|
+
/**
|
|
249
|
+
* The APP_KEY-backed signer, when there is one. Held so `stop()` can release
|
|
250
|
+
* the `services/encryption` locator against the exact instance it installed
|
|
251
|
+
* — an unguarded clear would tear down a newer Ignitor's binding.
|
|
252
|
+
*/
|
|
253
|
+
#signer?: CookieSigner
|
|
254
|
+
/**
|
|
255
|
+
* The bound logger, when a provider supplied one. Held so `stop()` releases
|
|
256
|
+
* the locator against the exact instance it installed.
|
|
257
|
+
*/
|
|
258
|
+
#logger?: ChildLoggerSource
|
|
220
259
|
#_httpServer?: HyperServerLike
|
|
221
260
|
#config: IgnitorConfig
|
|
222
261
|
#appRoot?: URL
|
|
@@ -302,6 +341,8 @@ export class Ignitor {
|
|
|
302
341
|
}
|
|
303
342
|
const signer = new CookieSigner(appKey)
|
|
304
343
|
this.#app.container.singleton('encryption', () => signer)
|
|
344
|
+
this.#signer = signer
|
|
345
|
+
setEncryption(signer)
|
|
305
346
|
// Signed-URL helper (same APP_KEY): the router signs via makeSignedUrl,
|
|
306
347
|
// HttpContext hands it to the request so hasValidSignature() can verify.
|
|
307
348
|
const signedUrl = new SignedUrl({ secret: appKey })
|
|
@@ -522,6 +563,15 @@ export class Ignitor {
|
|
|
522
563
|
|
|
523
564
|
async #phaseBoot(): Promise<void> {
|
|
524
565
|
await this.#app.boot()
|
|
566
|
+
// A provider is what binds `'logger'` — ream declares the contract and
|
|
567
|
+
// implements none — so the locator can only be filled once they have all
|
|
568
|
+
// booted. Absent is a normal state: `ctx.logger` falls back to console and
|
|
569
|
+
// `services/logger` says which package to install.
|
|
570
|
+
const container = this.#app.container
|
|
571
|
+
if (container.has('logger')) {
|
|
572
|
+
this.#logger = await container.resolve<ChildLoggerSource>('logger')
|
|
573
|
+
setLogger(this.#logger)
|
|
574
|
+
}
|
|
525
575
|
this.#phase = 'booted'
|
|
526
576
|
}
|
|
527
577
|
|
|
@@ -846,6 +896,11 @@ export class Ignitor {
|
|
|
846
896
|
clearApp(this.#app)
|
|
847
897
|
clearRouter(this.#router)
|
|
848
898
|
clearServer(this.#server)
|
|
899
|
+
// `signedUrl` is what the router was handed; the signer behind
|
|
900
|
+
// `services/encryption` is the same object, so releasing it here keeps the
|
|
901
|
+
// locator from outliving the app that built it.
|
|
902
|
+
if (this.#signer) clearEncryption(this.#signer)
|
|
903
|
+
if (this.#logger) clearLogger(this.#logger)
|
|
849
904
|
|
|
850
905
|
this.#phase = 'shutdown'
|
|
851
906
|
if (errors.length === 1) throw errors[0]
|
|
@@ -38,7 +38,7 @@ function isHyperServerNapi(value: unknown): value is HyperServerNapiModule {
|
|
|
38
38
|
typeof value === 'object' &&
|
|
39
39
|
value !== null &&
|
|
40
40
|
'HyperServer' in value &&
|
|
41
|
-
typeof
|
|
41
|
+
typeof value.HyperServer === 'function'
|
|
42
42
|
)
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose a class by applying mixins to it.
|
|
3
|
+
*
|
|
4
|
+
* class User extends compose(BaseModel, SoftDeletes, Sluggable) {}
|
|
5
|
+
*
|
|
6
|
+
* Each mixin is a function taking the class built so far and returning a
|
|
7
|
+
* subclass of it, so the chain is a plain left fold. Written out by hand that
|
|
8
|
+
* is `Sluggable(SoftDeletes(BaseModel))`, which reads inside-out and gets
|
|
9
|
+
* worse with every mixin — the whole point of the helper.
|
|
10
|
+
*
|
|
11
|
+
* The overloads exist so the RETURN type is the last mixin's, not the base
|
|
12
|
+
* class's: without them a composed class would lose every member the mixins
|
|
13
|
+
* added, statics included.
|
|
14
|
+
*
|
|
15
|
+
* Note there is no `Constructor` bound on `T`. The mixin's own parameter type
|
|
16
|
+
* already constrains what can be passed, and a bound would have to be written
|
|
17
|
+
* with `any` to admit a class with typed constructor arguments.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** A mixin: takes the class built so far, returns a subclass of it. */
|
|
21
|
+
type Mixin<T, R> = (superclass: T) => R
|
|
22
|
+
|
|
23
|
+
export function compose<T, A>(superclass: T, a: Mixin<T, A>): A
|
|
24
|
+
export function compose<T, A, B>(superclass: T, a: Mixin<T, A>, b: Mixin<A, B>): B
|
|
25
|
+
export function compose<T, A, B, C>(
|
|
26
|
+
superclass: T,
|
|
27
|
+
a: Mixin<T, A>,
|
|
28
|
+
b: Mixin<A, B>,
|
|
29
|
+
c: Mixin<B, C>,
|
|
30
|
+
): C
|
|
31
|
+
export function compose<T, A, B, C, D>(
|
|
32
|
+
superclass: T,
|
|
33
|
+
a: Mixin<T, A>,
|
|
34
|
+
b: Mixin<A, B>,
|
|
35
|
+
c: Mixin<B, C>,
|
|
36
|
+
d: Mixin<C, D>,
|
|
37
|
+
): D
|
|
38
|
+
export function compose<T, A, B, C, D, E>(
|
|
39
|
+
superclass: T,
|
|
40
|
+
a: Mixin<T, A>,
|
|
41
|
+
b: Mixin<A, B>,
|
|
42
|
+
c: Mixin<B, C>,
|
|
43
|
+
d: Mixin<C, D>,
|
|
44
|
+
e: Mixin<D, E>,
|
|
45
|
+
): E
|
|
46
|
+
export function compose<T, A, B, C, D, E, F>(
|
|
47
|
+
superclass: T,
|
|
48
|
+
a: Mixin<T, A>,
|
|
49
|
+
b: Mixin<A, B>,
|
|
50
|
+
c: Mixin<B, C>,
|
|
51
|
+
d: Mixin<C, D>,
|
|
52
|
+
e: Mixin<D, E>,
|
|
53
|
+
f: Mixin<E, F>,
|
|
54
|
+
): F
|
|
55
|
+
export function compose<T, A, B, C, D, E, F, G>(
|
|
56
|
+
superclass: T,
|
|
57
|
+
a: Mixin<T, A>,
|
|
58
|
+
b: Mixin<A, B>,
|
|
59
|
+
c: Mixin<B, C>,
|
|
60
|
+
d: Mixin<C, D>,
|
|
61
|
+
e: Mixin<D, E>,
|
|
62
|
+
f: Mixin<E, F>,
|
|
63
|
+
g: Mixin<F, G>,
|
|
64
|
+
): G
|
|
65
|
+
export function compose<T, A, B, C, D, E, F, G, H>(
|
|
66
|
+
superclass: T,
|
|
67
|
+
a: Mixin<T, A>,
|
|
68
|
+
b: Mixin<A, B>,
|
|
69
|
+
c: Mixin<B, C>,
|
|
70
|
+
d: Mixin<C, D>,
|
|
71
|
+
e: Mixin<D, E>,
|
|
72
|
+
f: Mixin<E, F>,
|
|
73
|
+
g: Mixin<F, G>,
|
|
74
|
+
h: Mixin<G, H>,
|
|
75
|
+
): H
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The single implementation. Its parameters are deliberately looser than the
|
|
79
|
+
* overloads above — a variadic fold cannot express "each mixin takes what the
|
|
80
|
+
* previous one returned" — and the overloads are what callers see.
|
|
81
|
+
*/
|
|
82
|
+
export function compose(superclass: unknown, ...mixins: Mixin<unknown, unknown>[]): unknown {
|
|
83
|
+
return mixins.reduce((applied, mixin) => mixin(applied), superclass)
|
|
84
|
+
}
|
package/src/helpers/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Secret } from '../env/Secret.js'
|
|
2
2
|
export { base64 } from './base64.js'
|
|
3
|
+
export { compose } from './compose.js'
|
|
3
4
|
export { defineStaticProperty } from './defineStaticProperty.js'
|
|
4
5
|
export { milliseconds, seconds } from './duration.js'
|
|
5
6
|
export type { ImportAllFilesOptions, ReadAllFilesOptions } from './fs.js'
|
package/src/helpers/is.ts
CHANGED
|
@@ -62,12 +62,7 @@ export function isArray<T = unknown>(v: unknown): v is T[] {
|
|
|
62
62
|
* @example isPromise(Promise.resolve()) // true
|
|
63
63
|
*/
|
|
64
64
|
export function isPromise<T = unknown>(v: unknown): v is Promise<T> {
|
|
65
|
-
return
|
|
66
|
-
v !== null &&
|
|
67
|
-
typeof v === 'object' &&
|
|
68
|
-
'then' in v &&
|
|
69
|
-
typeof (v as Record<string, unknown>).then === 'function'
|
|
70
|
-
)
|
|
65
|
+
return v !== null && typeof v === 'object' && 'then' in v && typeof v.then === 'function'
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
/**
|
|
@@ -140,23 +135,94 @@ export function isEmpty(v: unknown): boolean {
|
|
|
140
135
|
return false
|
|
141
136
|
}
|
|
142
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if value is a string with at least one character.
|
|
140
|
+
* @example isNonEmptyString('hi') // true; isNonEmptyString('') // false
|
|
141
|
+
*/
|
|
142
|
+
export function isNonEmptyString(v: unknown): v is string {
|
|
143
|
+
return typeof v === 'string' && v.length > 0
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Returns true if value is an array with at least one element.
|
|
148
|
+
* @example isNonEmptyArray([1]) // true; isNonEmptyArray([]) // false
|
|
149
|
+
*/
|
|
150
|
+
export function isNonEmptyArray<T = unknown>(v: unknown): v is [T, ...T[]] {
|
|
151
|
+
return Array.isArray(v) && v.length > 0
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Returns true if value is an integer. `Number.isInteger` already excludes NaN
|
|
156
|
+
* and the infinities.
|
|
157
|
+
* @example isInteger(42) // true; isInteger(4.2) // false
|
|
158
|
+
*/
|
|
159
|
+
export function isInteger(v: unknown): v is number {
|
|
160
|
+
return Number.isInteger(v)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Returns true if value is a number greater than zero. Zero is NOT positive
|
|
165
|
+
* here, matching `@sindresorhus/is`.
|
|
166
|
+
* @example isPositive(1) // true; isPositive(0) // false
|
|
167
|
+
*/
|
|
168
|
+
export function isPositive(v: unknown): v is number {
|
|
169
|
+
return typeof v === 'number' && !Number.isNaN(v) && v > 0
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns true if `key` is an OWN property of `value`.
|
|
174
|
+
*
|
|
175
|
+
* Own, not inherited: an inherited `toString` is not something the caller put
|
|
176
|
+
* there, and treating it as present is how a prototype member gets mistaken
|
|
177
|
+
* for data.
|
|
178
|
+
* @example hasProperty({ a: 1 }, 'a') // true; hasProperty({}, 'toString') // false
|
|
179
|
+
*/
|
|
180
|
+
export function hasProperty<K extends PropertyKey>(
|
|
181
|
+
value: unknown,
|
|
182
|
+
key: K,
|
|
183
|
+
): value is Record<K, unknown> {
|
|
184
|
+
return value !== null && typeof value === 'object' && Object.hasOwn(value, key)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The `is` namespace, keyed the way AdonisJS keys it.
|
|
189
|
+
*
|
|
190
|
+
* Adonis re-exports `@sindresorhus/is`, whose members read `is.string(v)`,
|
|
191
|
+
* `is.plainObject(v)`, `is.nonEmptyArray(v)`. This object used to mirror the
|
|
192
|
+
* function names instead — `is.isString(v)` — which stutters, and which turns
|
|
193
|
+
* `is.string(value)` ported from an Adonis app into "is.string is not a
|
|
194
|
+
* function" at runtime rather than a compile error.
|
|
195
|
+
*
|
|
196
|
+
* The standalone `isX` functions above keep their names: they read correctly
|
|
197
|
+
* on their own, and this object is the namespace form.
|
|
198
|
+
*/
|
|
143
199
|
const is = {
|
|
144
|
-
isString,
|
|
145
|
-
isNumber,
|
|
146
|
-
isBoolean,
|
|
147
|
-
isFunction,
|
|
148
|
-
isObject,
|
|
149
|
-
isPlainObject,
|
|
150
|
-
isArray,
|
|
151
|
-
isPromise,
|
|
152
|
-
isNull,
|
|
153
|
-
isUndefined,
|
|
154
|
-
isNullOrUndefined,
|
|
155
|
-
isBuffer,
|
|
156
|
-
isDate,
|
|
157
|
-
isRegExp,
|
|
158
|
-
isError,
|
|
159
|
-
|
|
200
|
+
string: isString,
|
|
201
|
+
number: isNumber,
|
|
202
|
+
boolean: isBoolean,
|
|
203
|
+
function: isFunction,
|
|
204
|
+
object: isObject,
|
|
205
|
+
plainObject: isPlainObject,
|
|
206
|
+
array: isArray,
|
|
207
|
+
promise: isPromise,
|
|
208
|
+
null: isNull,
|
|
209
|
+
undefined: isUndefined,
|
|
210
|
+
nullOrUndefined: isNullOrUndefined,
|
|
211
|
+
buffer: isBuffer,
|
|
212
|
+
date: isDate,
|
|
213
|
+
regExp: isRegExp,
|
|
214
|
+
error: isError,
|
|
215
|
+
nonEmptyString: isNonEmptyString,
|
|
216
|
+
nonEmptyArray: isNonEmptyArray,
|
|
217
|
+
integer: isInteger,
|
|
218
|
+
positive: isPositive,
|
|
219
|
+
hasProperty: hasProperty,
|
|
220
|
+
/**
|
|
221
|
+
* Named deviation: `@sindresorhus/is` has `emptyString` / `emptyArray` /
|
|
222
|
+
* `emptyObject` / `emptyMap` / `emptySet` but no umbrella. This is the
|
|
223
|
+
* umbrella, and the one member here that is not a type guard.
|
|
224
|
+
*/
|
|
225
|
+
empty: isEmpty,
|
|
160
226
|
}
|
|
161
227
|
|
|
162
228
|
export default is
|
package/src/index.ts
CHANGED
|
@@ -202,7 +202,7 @@ export {
|
|
|
202
202
|
// ─── Middleware ──────────────────────────────────────────────
|
|
203
203
|
|
|
204
204
|
export type { MiddlewareFunction } from './middleware/Pipeline.js'
|
|
205
|
-
export {
|
|
205
|
+
export { composeMiddleware, MiddlewareRegistry } from './middleware/Pipeline.js'
|
|
206
206
|
|
|
207
207
|
// ─── HttpKernel ─────────────────────────────────────────────
|
|
208
208
|
|
|
@@ -371,4 +371,4 @@ export {
|
|
|
371
371
|
StatsTracker,
|
|
372
372
|
} from './scheduler/index.js'
|
|
373
373
|
|
|
374
|
-
export const VERSION = '0.2.
|
|
374
|
+
export const VERSION = '0.2.7'
|
|
@@ -170,12 +170,18 @@ export class MiddlewareRegistry {
|
|
|
170
170
|
handler,
|
|
171
171
|
]
|
|
172
172
|
|
|
173
|
-
return
|
|
173
|
+
return composeMiddleware(stack)
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
/**
|
|
178
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Compose middleware into a single handler (onion pattern).
|
|
179
|
+
*
|
|
180
|
+
* NOT `compose` — that name means mixin composition in `helpers`, the way it
|
|
181
|
+
* does in AdonisJS, and the two were one import away from each other on the
|
|
182
|
+
* barrel.
|
|
183
|
+
*/
|
|
184
|
+
function composeMiddleware(middleware: MiddlewareFunction[]): MiddlewareFunction {
|
|
179
185
|
return async (ctx: HttpContext, finalNext: () => Promise<void>) => {
|
|
180
186
|
let index = -1
|
|
181
187
|
|
|
@@ -257,4 +263,4 @@ function createValidationMiddleware(validators: RuntimeValidator[]): MiddlewareF
|
|
|
257
263
|
}
|
|
258
264
|
}
|
|
259
265
|
|
|
260
|
-
export {
|
|
266
|
+
export { composeMiddleware }
|