@c9up/ream 0.2.6 → 0.2.8
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/dist/HttpKernel.d.ts.map +1 -1
- package/dist/HttpKernel.js +10 -0
- package/dist/HttpKernel.js.map +1 -1
- package/dist/Ignitor.d.ts.map +1 -1
- package/dist/Ignitor.js +17 -0
- package/dist/Ignitor.js.map +1 -1
- package/dist/bootstrap/hyper-server.js.map +1 -1
- package/dist/debug.d.ts +22 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +23 -0
- package/dist/debug.js.map +1 -0
- package/dist/dumper/Dumper.d.ts +80 -0
- package/dist/dumper/Dumper.d.ts.map +1 -0
- package/dist/dumper/Dumper.js +129 -0
- package/dist/dumper/Dumper.js.map +1 -0
- package/dist/helpers/is.d.ts.map +1 -1
- package/dist/helpers/is.js +1 -4
- package/dist/helpers/is.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/middleware/Pipeline.d.ts.map +1 -1
- package/dist/middleware/Pipeline.js +7 -0
- package/dist/middleware/Pipeline.js.map +1 -1
- package/dist/repl/Repl.d.ts +88 -0
- package/dist/repl/Repl.d.ts.map +1 -0
- package/dist/repl/Repl.js +123 -0
- package/dist/repl/Repl.js.map +1 -0
- 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/dumper.d.ts +25 -0
- package/dist/services/dumper.d.ts.map +1 -0
- package/dist/services/dumper.js +27 -0
- package/dist/services/dumper.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/repl.d.ts +19 -0
- package/dist/services/repl.d.ts.map +1 -0
- package/dist/services/repl.js +19 -0
- package/dist/services/repl.js.map +1 -0
- package/dist/session/Session.js.map +1 -1
- package/dist/testing/TestClient.d.ts +18 -3
- package/dist/testing/TestClient.d.ts.map +1 -1
- package/dist/testing/TestClient.js +45 -4
- 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 +25 -1
- package/scheduler.win32-x64-msvc.node +0 -0
- package/src/HttpKernel.ts +27 -0
- package/src/Ignitor.ts +17 -1
- package/src/bootstrap/hyper-server.ts +1 -1
- package/src/debug.ts +25 -0
- package/src/dumper/Dumper.ts +164 -0
- package/src/helpers/is.ts +1 -6
- package/src/index.ts +1 -1
- package/src/middleware/Pipeline.ts +7 -0
- package/src/repl/Repl.ts +162 -0
- package/src/scheduler/Scheduler.ts +10 -4
- package/src/services/dumper.ts +30 -0
- package/src/services/logger.ts +49 -0
- package/src/services/repl.ts +21 -0
- package/src/session/Session.ts +2 -2
- package/src/testing/TestClient.ts +47 -5
- package/src/testing/testUtils.ts +90 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.js","sourceRoot":"","sources":["../../src/session/Session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAwC9D,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,OAAO,CACL,KAAK,IAAI,MAAM;QACf,
|
|
1
|
+
{"version":3,"file":"Session.js","sourceRoot":"","sources":["../../src/session/Session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,mBAA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C,CAAA;IACnE,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAA;QACvC,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,+BAA+B,CAAC,MAAM,CAAC,CAAA;QACnD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -43,15 +43,30 @@ export declare class TestClient {
|
|
|
43
43
|
/** Writes session values for `loginAs()` with a session-based guard. */
|
|
44
44
|
sessionSeeder?: SessionSeeder;
|
|
45
45
|
});
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Boot the application on a random port. Idempotent: a second call awaits the
|
|
48
|
+
* first rather than starting a second server.
|
|
49
|
+
*
|
|
50
|
+
* Optional — a request boots on its own. Call it when you need `port` before
|
|
51
|
+
* issuing one (an SSE or WebSocket connection opened with `fetch`).
|
|
52
|
+
*/
|
|
47
53
|
boot(): Promise<void>;
|
|
48
|
-
/**
|
|
54
|
+
/** Whether a server is currently running for this client. */
|
|
55
|
+
get booted(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Close the server. A no-op when nothing was ever started, so a teardown can
|
|
58
|
+
* call it unconditionally against a client whose file issued no request.
|
|
59
|
+
*/
|
|
49
60
|
close(): Promise<void>;
|
|
50
61
|
/**
|
|
51
62
|
* Ephemeral port the booted server bound to. Useful for long-lived
|
|
52
63
|
* connections (SSE / WebSocket) that the fluent buffered request
|
|
53
64
|
* surface can't model — open them with `fetch` against
|
|
54
|
-
* `http://127.0.0.1:${client.port}/...`.
|
|
65
|
+
* `http://127.0.0.1:${client.port}/...`.
|
|
66
|
+
*
|
|
67
|
+
* Returns 0 while no server is running. Requests boot on their own, so a
|
|
68
|
+
* client that has only been constructed has not bound a port yet — `await
|
|
69
|
+
* client.boot()` first when you need this before issuing one.
|
|
55
70
|
*/
|
|
56
71
|
get port(): number;
|
|
57
72
|
/** Set a default header for all requests. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestClient.d.ts","sourceRoot":"","sources":["../../src/testing/TestClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EAEf,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEpE;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,CAAA;AACvE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAEtD,qBAAa,UAAU;;gBASnB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,EACtF,OAAO,GAAE;QACP,IAAI,CAAC,EAAE,YAAY,CAAA;QACnB,MAAM,CAAC,EAAE,aAAa,CAAA;QACtB,wEAAwE;QACxE,aAAa,CAAC,EAAE,aAAa,CAAA;KACzB;
|
|
1
|
+
{"version":3,"file":"TestClient.d.ts","sourceRoot":"","sources":["../../src/testing/TestClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EAEf,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAA;AAI5B,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ionSeeder = options.sessionSeeder ?? null;
|
|
35
35
|
}
|
|
36
36
|
#server = null;
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* In flight or settled, so concurrent callers share one boot.
|
|
39
|
+
*
|
|
40
|
+
* Also what makes `boot()` optional: the first request awaits this, starting
|
|
41
|
+
* it if nobody has. A test file that never issues a request never starts a
|
|
42
|
+
* server — which is the difference between a unit file paying for one and
|
|
43
|
+
* not, and at ~400ms a file that is most of a campaign's time.
|
|
44
|
+
*/
|
|
45
|
+
#booting = null;
|
|
46
|
+
/**
|
|
47
|
+
* Boot the application on a random port. Idempotent: a second call awaits the
|
|
48
|
+
* first rather than starting a second server.
|
|
49
|
+
*
|
|
50
|
+
* Optional — a request boots on its own. Call it when you need `port` before
|
|
51
|
+
* issuing one (an SSE or WebSocket connection opened with `fetch`).
|
|
52
|
+
*/
|
|
38
53
|
async boot() {
|
|
54
|
+
this.#booting ??= this.#startServer();
|
|
55
|
+
return this.#booting;
|
|
56
|
+
}
|
|
57
|
+
async #startServer() {
|
|
39
58
|
this.#server = await this.#bootFn(0);
|
|
40
59
|
this.#port = this.#server.port;
|
|
41
60
|
}
|
|
42
|
-
/**
|
|
61
|
+
/** Whether a server is currently running for this client. */
|
|
62
|
+
get booted() {
|
|
63
|
+
return this.#server !== null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Close the server. A no-op when nothing was ever started, so a teardown can
|
|
67
|
+
* call it unconditionally against a client whose file issued no request.
|
|
68
|
+
*/
|
|
43
69
|
async close() {
|
|
70
|
+
// Awaited first: closing while a boot is in flight would otherwise leave
|
|
71
|
+
// the server that boot is about to assign running with nobody holding it.
|
|
72
|
+
if (this.#booting)
|
|
73
|
+
await this.#booting.catch(() => { });
|
|
74
|
+
this.#booting = null;
|
|
44
75
|
if (this.#server) {
|
|
45
76
|
await this.#server.close();
|
|
46
77
|
this.#server = null;
|
|
78
|
+
this.#port = 0;
|
|
47
79
|
}
|
|
48
80
|
}
|
|
49
81
|
/**
|
|
50
82
|
* Ephemeral port the booted server bound to. Useful for long-lived
|
|
51
83
|
* connections (SSE / WebSocket) that the fluent buffered request
|
|
52
84
|
* surface can't model — open them with `fetch` against
|
|
53
|
-
* `http://127.0.0.1:${client.port}/...`.
|
|
85
|
+
* `http://127.0.0.1:${client.port}/...`.
|
|
86
|
+
*
|
|
87
|
+
* Returns 0 while no server is running. Requests boot on their own, so a
|
|
88
|
+
* client that has only been constructed has not bound a port yet — `await
|
|
89
|
+
* client.boot()` first when you need this before issuing one.
|
|
54
90
|
*/
|
|
55
91
|
get port() {
|
|
56
92
|
return this.#port;
|
|
@@ -102,7 +138,12 @@ export class TestClient {
|
|
|
102
138
|
* `form()`. The lower-level `request()` (below) stays for raw control.
|
|
103
139
|
*/
|
|
104
140
|
fluent(method, path) {
|
|
105
|
-
const sender = (m, p, init) =>
|
|
141
|
+
const sender = async (m, p, init) => {
|
|
142
|
+
// Boots on the first request and no earlier. `#port` is read here rather
|
|
143
|
+
// than captured, so it is the port this boot bound to.
|
|
144
|
+
await this.boot();
|
|
145
|
+
return sendRequest(this.#port, m, p, { ...this.#headers, ...init.headers }, init.body.toString('utf8'), init.timeoutMs);
|
|
146
|
+
};
|
|
106
147
|
return new RequestBuilder(sender, method, path, this.#auth, this.#sessionSeeder);
|
|
107
148
|
}
|
|
108
149
|
/**
|
|
@@ -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;IA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A;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.8",
|
|
4
4
|
"description": "Ream — Rust-powered Node.js application framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,10 +39,30 @@
|
|
|
39
39
|
"types": "./dist/services/config.d.ts",
|
|
40
40
|
"import": "./dist/services/config.js"
|
|
41
41
|
},
|
|
42
|
+
"./services/dumper": {
|
|
43
|
+
"types": "./dist/services/dumper.d.ts",
|
|
44
|
+
"import": "./dist/services/dumper.js"
|
|
45
|
+
},
|
|
46
|
+
"./dumper": {
|
|
47
|
+
"types": "./dist/dumper/Dumper.d.ts",
|
|
48
|
+
"import": "./dist/dumper/Dumper.js"
|
|
49
|
+
},
|
|
50
|
+
"./services/repl": {
|
|
51
|
+
"types": "./dist/services/repl.d.ts",
|
|
52
|
+
"import": "./dist/services/repl.js"
|
|
53
|
+
},
|
|
54
|
+
"./repl": {
|
|
55
|
+
"types": "./dist/repl/Repl.d.ts",
|
|
56
|
+
"import": "./dist/repl/Repl.js"
|
|
57
|
+
},
|
|
42
58
|
"./services/encryption": {
|
|
43
59
|
"types": "./dist/services/encryption.d.ts",
|
|
44
60
|
"import": "./dist/services/encryption.js"
|
|
45
61
|
},
|
|
62
|
+
"./services/logger": {
|
|
63
|
+
"types": "./dist/services/logger.d.ts",
|
|
64
|
+
"import": "./dist/services/logger.js"
|
|
65
|
+
},
|
|
46
66
|
"./services/urlBuilder": {
|
|
47
67
|
"types": "./dist/services/urlBuilder.d.ts",
|
|
48
68
|
"import": "./dist/services/urlBuilder.js"
|
|
@@ -91,6 +111,10 @@
|
|
|
91
111
|
"types": "./dist/testing/TestClient.d.ts",
|
|
92
112
|
"import": "./dist/testing/TestClient.js"
|
|
93
113
|
},
|
|
114
|
+
"./testing/utils": {
|
|
115
|
+
"types": "./dist/testing/testUtils.d.ts",
|
|
116
|
+
"import": "./dist/testing/testUtils.js"
|
|
117
|
+
},
|
|
94
118
|
"./bootstrap": {
|
|
95
119
|
"types": "./dist/bootstrap/hyper-server.d.ts",
|
|
96
120
|
"import": "./dist/bootstrap/hyper-server.js"
|
|
Binary file
|
package/src/HttpKernel.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { Container } from './container/Container.js'
|
|
14
|
+
import { debugHttp } from './debug.js'
|
|
14
15
|
import type { Emitter } from './events/Emitter.js'
|
|
15
16
|
import { E_ROUTE_NOT_FOUND, ExceptionHandler } from './http/Exception.js'
|
|
16
17
|
import { type ChildLoggerSource, HttpContext } from './http/HttpContext.js'
|
|
@@ -157,6 +158,14 @@ export function createHttpKernel(
|
|
|
157
158
|
// only correct key; the previous PascalCase fallback was dead code.
|
|
158
159
|
const host = reqData.headers.host
|
|
159
160
|
const match = config.router.match(reqData.method, reqData.path, host)
|
|
161
|
+
if (debugHttp.enabled) {
|
|
162
|
+
debugHttp(
|
|
163
|
+
'%s %s -> %s',
|
|
164
|
+
reqData.method,
|
|
165
|
+
reqData.path,
|
|
166
|
+
match ? (match.route.name ?? match.route.path) : 'no match',
|
|
167
|
+
)
|
|
168
|
+
}
|
|
160
169
|
const routeInfo = match
|
|
161
170
|
? {
|
|
162
171
|
pattern: match.route.path,
|
|
@@ -327,6 +336,15 @@ export function createHttpKernel(
|
|
|
327
336
|
path: reqData.path,
|
|
328
337
|
status: ctx.response.getStatus(),
|
|
329
338
|
})
|
|
339
|
+
if (debugHttp.enabled) {
|
|
340
|
+
debugHttp(
|
|
341
|
+
'%s %s <- %d (%s)',
|
|
342
|
+
reqData.method,
|
|
343
|
+
reqData.path,
|
|
344
|
+
ctx.response.getStatus(),
|
|
345
|
+
correlationId,
|
|
346
|
+
)
|
|
347
|
+
}
|
|
330
348
|
const serialized = await serializeResponse(ctx)
|
|
331
349
|
// The body is built; anything registered with `response.onFinish()` runs
|
|
332
350
|
// now — after the answer is ready, before we hand it back.
|
|
@@ -374,6 +392,15 @@ export function createHttpKernel(
|
|
|
374
392
|
path: reqData.path,
|
|
375
393
|
status: ctx.response.getStatus(),
|
|
376
394
|
})
|
|
395
|
+
if (debugHttp.enabled) {
|
|
396
|
+
debugHttp(
|
|
397
|
+
'%s %s <- %d (%s)',
|
|
398
|
+
reqData.method,
|
|
399
|
+
reqData.path,
|
|
400
|
+
ctx.response.getStatus(),
|
|
401
|
+
correlationId,
|
|
402
|
+
)
|
|
403
|
+
}
|
|
377
404
|
const serialized = await serializeResponse(ctx)
|
|
378
405
|
// The body is built; anything registered with `response.onFinish()` runs
|
|
379
406
|
// now — after the answer is ready, before we hand it back.
|
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'
|
|
@@ -42,6 +42,7 @@ import { SignedUrl } from './security/SignedUrl.js'
|
|
|
42
42
|
import { Server } from './server/Server.js'
|
|
43
43
|
import { clearApp, setApp } from './services/app.js'
|
|
44
44
|
import { clearEncryption, setEncryption } from './services/encryption.js'
|
|
45
|
+
import { clearLogger, setLogger } from './services/logger.js'
|
|
45
46
|
import { clearRouter, setRouter } from './services/router.js'
|
|
46
47
|
import { clearServer, setServer } from './services/server.js'
|
|
47
48
|
import { registerSessionTemplateTags } from './session/templateTags.js'
|
|
@@ -250,6 +251,11 @@ export class Ignitor {
|
|
|
250
251
|
* — an unguarded clear would tear down a newer Ignitor's binding.
|
|
251
252
|
*/
|
|
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
|
|
253
259
|
#_httpServer?: HyperServerLike
|
|
254
260
|
#config: IgnitorConfig
|
|
255
261
|
#appRoot?: URL
|
|
@@ -557,6 +563,15 @@ export class Ignitor {
|
|
|
557
563
|
|
|
558
564
|
async #phaseBoot(): Promise<void> {
|
|
559
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
|
+
}
|
|
560
575
|
this.#phase = 'booted'
|
|
561
576
|
}
|
|
562
577
|
|
|
@@ -885,6 +900,7 @@ export class Ignitor {
|
|
|
885
900
|
// `services/encryption` is the same object, so releasing it here keeps the
|
|
886
901
|
// locator from outliving the app that built it.
|
|
887
902
|
if (this.#signer) clearEncryption(this.#signer)
|
|
903
|
+
if (this.#logger) clearLogger(this.#logger)
|
|
888
904
|
|
|
889
905
|
this.#phase = 'shutdown'
|
|
890
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
|
|
package/src/debug.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug channels, off unless `NODE_DEBUG` names them — the shape AdonisJS
|
|
3
|
+
* uses (`NODE_DEBUG=adonisjs:http`).
|
|
4
|
+
*
|
|
5
|
+
* NODE_DEBUG=ream:http ream serve
|
|
6
|
+
* NODE_DEBUG=ream:* ream serve
|
|
7
|
+
*
|
|
8
|
+
* These are for the framework's own tracing: which route a request matched,
|
|
9
|
+
* which middleware ran, what status came back. They are NOT request logging —
|
|
10
|
+
* a production request log belongs to the app's logger (`ctx.logger`), which
|
|
11
|
+
* is correlation-scoped and structured. Neither framework prints one by
|
|
12
|
+
* default, and this is the switch for when you need to see the plumbing.
|
|
13
|
+
*
|
|
14
|
+
* `debuglog` returns a no-op when the channel is off, so an inactive probe
|
|
15
|
+
* costs a call. Guard with `.enabled` anywhere the ARGUMENTS would cost
|
|
16
|
+
* something to build — the per-request probes below all do.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { debuglog } from 'node:util'
|
|
20
|
+
|
|
21
|
+
/** Routing, middleware and response tracing. AdonisJS `adonisjs:http`. */
|
|
22
|
+
export const debugHttp = debuglog('ream:http')
|
|
23
|
+
|
|
24
|
+
/** Boot: providers, preloads, container bindings. AdonisJS `adonisjs:core`. */
|
|
25
|
+
export const debugCore = debuglog('ream:core')
|