@dokebi/web 0.4.8 → 0.4.9
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/AI.md +1 -1
- package/dist/index.js +20 -1
- package/package.json +1 -1
package/AI.md
CHANGED
|
@@ -44,7 +44,7 @@ dokebi-web:
|
|
|
44
44
|
|---|---|---|---|
|
|
45
45
|
| `host` | string | `127.0.0.1` | listen address |
|
|
46
46
|
| `port` | integer | 0 | 0..65535; 0 picks an ephemeral port |
|
|
47
|
-
| `listen` | boolean | true | (0.4.8, [D-0221](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0221-process-roles.md)) `false`: open no port — a worker process started from the same code with its own dokebi.yaml (`DOKEBI_CONFIG`). Routes are still registered (`inject` answers), nothing listens, `address` stays undefined and `/health/live` and `/health/ready` are not reachable; info `Web server not listening` (`WEB_NOT_LISTENING`) once. To probe a worker over HTTP, give it a port nothing routes traffic to instead |
|
|
47
|
+
| `listen` | boolean | true | (0.4.8, [D-0221](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0221-process-roles.md)) `false`: open no port — a worker process started from the same code with its own dokebi.yaml (`DOKEBI_CONFIG`). Routes are still registered (`inject` answers), nothing listens, `address` stays undefined and `/health/live` and `/health/ready` are not reachable; info `Web server not listening` (`WEB_NOT_LISTENING`) once. In place of the socket the plugin holds the process open until the app drains (0.4.9: before it, a worker with no other open connection exited right after it started). `dokebi verify` skips its HTTP check for such a settings file (@dokebi/cli 0.4.45). To probe a worker over HTTP, give it a port nothing routes traffic to instead |
|
|
48
48
|
| `maxBodyBytes` | integer | 1048576 | request body limit, 1 B..64 MiB |
|
|
49
49
|
| `bodyLimit` | integer | — | deprecated name of `maxBodyBytes` (D-0071): warns `OPTION_DEPRECATED`; setting both is `INVALID_OPTIONS` |
|
|
50
50
|
| `maxRouteBodyBytes` | integer 1..1073741824 | 67108864 | the largest `bodyLimit` one route may declare for itself (64 MiB; at least `maxBodyBytes`); a larger one fails the start with `INVALID_ROUTE` ([D-0122](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0122-studio-terminal-needs.md), below) |
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,8 @@ export { errorFormat, FORM_SUBMISSION_HEADER, requestErrorFormat, SEALED_FETCH_H
|
|
|
39
39
|
export { SEALED_LOCATION_HEADER, SEALED_PATH_HEADER, } from './seal.js';
|
|
40
40
|
export { DEFAULT_DIRECTIVES, } from './security-headers.js';
|
|
41
41
|
/** Set by `dokebi verify` on the app it starts (D-0065 §11); the header echoes it. */
|
|
42
|
+
/** The longest timer delay Node takes (about 24.8 days); the keep-alive never fires in practice. */
|
|
43
|
+
const KEEP_ALIVE_MS = 2 ** 31 - 1;
|
|
42
44
|
const VERIFY_TOKEN_ENV = 'DOKEBI_VERIFY_TOKEN';
|
|
43
45
|
const VERIFY_HEADER = 'x-dokebi-verify';
|
|
44
46
|
/**
|
|
@@ -392,6 +394,12 @@ class WebOwner {
|
|
|
392
394
|
#address;
|
|
393
395
|
/** `listen: false` was logged once (D-0221). */
|
|
394
396
|
#notListening = false;
|
|
397
|
+
/**
|
|
398
|
+
* D-0221: with `listen: false` this holds the process open in place of the listening socket,
|
|
399
|
+
* until the drain or close: a worker process with no other open handle would otherwise exit
|
|
400
|
+
* right after it started.
|
|
401
|
+
*/
|
|
402
|
+
#keepAlive;
|
|
395
403
|
#sealing;
|
|
396
404
|
/** D-0149: the security headers of every answer. */
|
|
397
405
|
#security;
|
|
@@ -1587,6 +1595,8 @@ class WebOwner {
|
|
|
1587
1595
|
if (!this.options.listen) {
|
|
1588
1596
|
if (!this.#notListening) {
|
|
1589
1597
|
this.#notListening = true;
|
|
1598
|
+
if (!this.#draining && !this.#closed)
|
|
1599
|
+
this.#keepAlive = setInterval(() => undefined, KEEP_ALIVE_MS);
|
|
1590
1600
|
this.context.logger.log('info', 'Web server not listening', {
|
|
1591
1601
|
code: 'WEB_NOT_LISTENING',
|
|
1592
1602
|
reason: 'listen: false',
|
|
@@ -1621,6 +1631,7 @@ class WebOwner {
|
|
|
1621
1631
|
}
|
|
1622
1632
|
async drain(signal, deadline) {
|
|
1623
1633
|
this.#draining = true;
|
|
1634
|
+
this.#releaseProcess();
|
|
1624
1635
|
this.#frozen = true;
|
|
1625
1636
|
const started = performance.now();
|
|
1626
1637
|
const logger = this.context.logger;
|
|
@@ -2414,8 +2425,16 @@ class WebOwner {
|
|
|
2414
2425
|
json: () => JSON.parse(response.body),
|
|
2415
2426
|
});
|
|
2416
2427
|
}
|
|
2428
|
+
/** Lets the process end once nothing else holds it (`listen: false`, D-0221). */
|
|
2429
|
+
#releaseProcess() {
|
|
2430
|
+
if (this.#keepAlive === undefined)
|
|
2431
|
+
return;
|
|
2432
|
+
clearInterval(this.#keepAlive);
|
|
2433
|
+
this.#keepAlive = undefined;
|
|
2434
|
+
}
|
|
2417
2435
|
async close() {
|
|
2418
2436
|
this.#closed = true;
|
|
2437
|
+
this.#releaseProcess();
|
|
2419
2438
|
const started = performance.now();
|
|
2420
2439
|
const { ended } = this.#connections.close();
|
|
2421
2440
|
try {
|
|
@@ -2611,7 +2630,7 @@ class WebRuntime {
|
|
|
2611
2630
|
}
|
|
2612
2631
|
export const createPlugin = definePlugin({
|
|
2613
2632
|
name: 'dokebi-web',
|
|
2614
|
-
version: '0.4.
|
|
2633
|
+
version: '0.4.9',
|
|
2615
2634
|
core: '^0.4.2',
|
|
2616
2635
|
options: declaration,
|
|
2617
2636
|
entry: (input) => new WebEntryInput(input),
|