@dokebi/web 0.4.7 → 0.4.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/AI.md CHANGED
@@ -44,6 +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
48
  | `maxBodyBytes` | integer | 1048576 | request body limit, 1 B..64 MiB |
48
49
  | `bodyLimit` | integer | — | deprecated name of `maxBodyBytes` (D-0071): warns `OPTION_DEPRECATED`; setting both is `INVALID_OPTIONS` |
49
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
@@ -390,6 +390,8 @@ class WebOwner {
390
390
  /** A draining worker's idle wait ended and it closed the connections still idle (D-0036). */
391
391
  #idleClosed = false;
392
392
  #address;
393
+ /** `listen: false` was logged once (D-0221). */
394
+ #notListening = false;
393
395
  #sealing;
394
396
  /** D-0149: the security headers of every answer. */
395
397
  #security;
@@ -525,6 +527,7 @@ class WebOwner {
525
527
  logger.log('debug', 'Web server configured', {
526
528
  host: options.host,
527
529
  port: options.port,
530
+ listen: options.listen,
528
531
  bodyLimit: options.maxBodyBytes,
529
532
  maxRouteBodyBytes: options.maxRouteBodyBytes,
530
533
  binaryBody: options.binaryBody,
@@ -1574,10 +1577,23 @@ class WebOwner {
1574
1577
  longestBodyMs: this.#longestBodyMs,
1575
1578
  });
1576
1579
  }
1577
- /** Listens unless this process does not serve (`runtime.serving` false, D-0063 §4). */
1580
+ /**
1581
+ * Listens unless this process does not serve (`runtime.serving` false, D-0063 §4) or its
1582
+ * dokebi.yaml says so (`listen: false`, a worker process of the same code, D-0221).
1583
+ */
1578
1584
  async listen() {
1579
1585
  if (this.#address !== undefined)
1580
1586
  return;
1587
+ if (!this.options.listen) {
1588
+ if (!this.#notListening) {
1589
+ this.#notListening = true;
1590
+ this.context.logger.log('info', 'Web server not listening', {
1591
+ code: 'WEB_NOT_LISTENING',
1592
+ reason: 'listen: false',
1593
+ });
1594
+ }
1595
+ return;
1596
+ }
1581
1597
  const runtime = this.context.runtime ?? this.context.app.runtime;
1582
1598
  if (!runtime.serving) {
1583
1599
  this.context.logger.log('debug', 'Web server not listening', {
@@ -2558,6 +2574,7 @@ class WebRuntime {
2558
2574
  describe: () => ({
2559
2575
  host: options.host,
2560
2576
  port: options.port,
2577
+ listen: options.listen,
2561
2578
  healthRoutes: options.healthRoutes ? { ...options.healthRoutes } : false,
2562
2579
  formBody: options.formBody,
2563
2580
  maxBodyBytes: options.maxBodyBytes,
@@ -2594,7 +2611,7 @@ class WebRuntime {
2594
2611
  }
2595
2612
  export const createPlugin = definePlugin({
2596
2613
  name: 'dokebi-web',
2597
- version: '0.4.7',
2614
+ version: '0.4.8',
2598
2615
  core: '^0.4.2',
2599
2616
  options: declaration,
2600
2617
  entry: (input) => new WebEntryInput(input),
package/dist/options.d.ts CHANGED
@@ -26,6 +26,7 @@ export declare const options: import("@dokebi/core").OptionsDeclaration<{
26
26
  readonly maxBytes: number;
27
27
  readonly ms: number;
28
28
  };
29
+ readonly listen: boolean;
29
30
  readonly logRepeatWindowMs: number;
30
31
  readonly maxBodyBytes: number;
31
32
  readonly maxRouteBodyBytes: number;
package/dist/options.js CHANGED
@@ -22,6 +22,10 @@ export const options = defineOptions({
22
22
  default: 0,
23
23
  description: 'Port to listen on; 0 picks a free one.',
24
24
  }),
25
+ listen: o.boolean({
26
+ default: true,
27
+ description: 'Open the port. false: a process that serves no HTTP (a worker process started from the same code with another dokebi.yaml): routes are still registered, nothing listens, and /health/live and /health/ready are not served (D-0221).',
28
+ }),
25
29
  maxBodyBytes: o.integer({
26
30
  minimum: 1,
27
31
  maximum: 67108864,
@@ -17,6 +17,11 @@
17
17
  "default": 0,
18
18
  "description": "Port to listen on; 0 picks a free one."
19
19
  },
20
+ "listen": {
21
+ "type": "boolean",
22
+ "default": true,
23
+ "description": "Open the port. false: a process that serves no HTTP (a worker process started from the same code with another dokebi.yaml): routes are still registered, nothing listens, and /health/live and /health/ready are not served (D-0221)."
24
+ },
20
25
  "maxBodyBytes": {
21
26
  "type": "integer",
22
27
  "minimum": 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/web",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Fastify 5 HTTP server owned by a Dokebi app: 503 before ready, health routes, drain and cluster handover.",
5
5
  "keywords": [
6
6
  "dokebi",