@nwire/endpoint 0.10.0 → 0.10.1

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.
@@ -28,7 +28,7 @@
28
28
  * ## Why this exists
29
29
  *
30
30
  * Every framework eventually needs a process layer — something that knows
31
- * about SIGTERM, drains in-flight requests, exposes `/healthz`, and binds
31
+ * about SIGTERM, drains in-flight requests, exposes `/live`, and binds
32
32
  * to a port. Most frameworks bolt this on as a deployment afterthought.
33
33
  * `@nwire/endpoint` makes it the first-class entry point so you don't
34
34
  * write the same K8s-readiness code on every project. It works alone —
package/dist/endpoint.js CHANGED
@@ -28,7 +28,7 @@
28
28
  * ## Why this exists
29
29
  *
30
30
  * Every framework eventually needs a process layer — something that knows
31
- * about SIGTERM, drains in-flight requests, exposes `/healthz`, and binds
31
+ * about SIGTERM, drains in-flight requests, exposes `/live`, and binds
32
32
  * to a port. Most frameworks bolt this on as a deployment afterthought.
33
33
  * `@nwire/endpoint` makes it the first-class entry point so you don't
34
34
  * write the same K8s-readiness code on every project. It works alone —
@@ -405,7 +405,7 @@ function printBanner(opts) {
405
405
  : ` data: (no HTTP listener)`,
406
406
  ];
407
407
  if (opts.probePort !== undefined) {
408
- // lightship's actual paths — not /readyz + /healthz (which was a
408
+ // lightship's actual paths — not /ready + /live (which was a
409
409
  // historical misnaming in our docs).
410
410
  lines.push(` probes: http://${opts.host}:${opts.probePort}/live · /ready`);
411
411
  }
@@ -7,13 +7,13 @@
7
7
  * `server.close()`. Without it, in-flight requests on persistent
8
8
  * connections silently die when the process exits.
9
9
  * - **lightship** — Kubernetes-style readiness/liveness probes on a
10
- * separate operational port. Flips `/readyz` to 503 the moment shutdown
10
+ * separate operational port. Flips `/ready` to 503 the moment shutdown
11
11
  * starts so the load balancer stops sending new traffic — the single
12
12
  * most important step in a zero-downtime rolling deploy.
13
13
  *
14
14
  * Sequence on SIGTERM/SIGINT:
15
15
  *
16
- * 1. lightship: /readyz → 503 (LB removes us from rotation)
16
+ * 1. lightship: /ready → 503 (LB removes us from rotation)
17
17
  * 2. wait `drainDelay` (LB has time to catch up; default 10s)
18
18
  * 3. stop accepting new connections (http-terminator)
19
19
  * 4. drain in-flight requests (http-terminator; bounded by drainTimeout)
@@ -105,7 +105,7 @@ export interface LifecycleManager {
105
105
  addCheck(check: HealthCheck): void;
106
106
  /**
107
107
  * Bare Node http handler for probes-on-main deployments. Mount on your
108
- * own HTTP server's /livez and /readyz routes; the third arg picks which.
108
+ * own HTTP server's /live and /ready routes; the third arg picks which.
109
109
  * No framework lock-in — works with Express, Fastify, Koa, raw http.
110
110
  */
111
111
  probeHandler(req: {
package/dist/lifecycle.js CHANGED
@@ -7,13 +7,13 @@
7
7
  * `server.close()`. Without it, in-flight requests on persistent
8
8
  * connections silently die when the process exits.
9
9
  * - **lightship** — Kubernetes-style readiness/liveness probes on a
10
- * separate operational port. Flips `/readyz` to 503 the moment shutdown
10
+ * separate operational port. Flips `/ready` to 503 the moment shutdown
11
11
  * starts so the load balancer stops sending new traffic — the single
12
12
  * most important step in a zero-downtime rolling deploy.
13
13
  *
14
14
  * Sequence on SIGTERM/SIGINT:
15
15
  *
16
- * 1. lightship: /readyz → 503 (LB removes us from rotation)
16
+ * 1. lightship: /ready → 503 (LB removes us from rotation)
17
17
  * 2. wait `drainDelay` (LB has time to catch up; default 10s)
18
18
  * 3. stop accepting new connections (http-terminator)
19
19
  * 4. drain in-flight requests (http-terminator; bounded by drainTimeout)
@@ -53,8 +53,8 @@ export async function attachLifecycle(opts) {
53
53
  const healthCfg = {
54
54
  enabled: opts.health?.enabled ?? true,
55
55
  port: opts.health?.port ?? 9_400,
56
- livenessPath: opts.health?.livenessPath ?? "/healthz",
57
- readinessPath: opts.health?.readinessPath ?? "/readyz",
56
+ livenessPath: opts.health?.livenessPath ?? "/live",
57
+ readinessPath: opts.health?.readinessPath ?? "/ready",
58
58
  checks: opts.health?.checks ?? [],
59
59
  };
60
60
  const terminator = createHttpTerminator({
@@ -138,9 +138,9 @@ export async function attachLifecycle(opts) {
138
138
  try {
139
139
  if (lightship) {
140
140
  lightship.signalNotReady();
141
- console.log(`[lifecycle] /readyz → 503; waiting ${shutdownCfg.drainDelay}ms for LB to catch up`);
141
+ console.log(`[lifecycle] /ready → 503; waiting ${shutdownCfg.drainDelay}ms for LB to catch up`);
142
142
  // The drain delay exists to give the LB time to redirect traffic
143
- // after /readyz flips to 503. Without lightship, there's no probe
143
+ // after /ready flips to 503. Without lightship, there's no probe
144
144
  // for an LB to poll — waiting would just stall shutdown.
145
145
  await new Promise((r) => setTimeout(r, shutdownCfg.drainDelay));
146
146
  }
@@ -166,13 +166,13 @@ export async function attachLifecycle(opts) {
166
166
  process.once("SIGTERM", () => void shutdown("SIGTERM"));
167
167
  process.once("SIGINT", () => void shutdown("SIGINT"));
168
168
  /**
169
- * Bare Node http handler for `/livez` / `/readyz` on the MAIN port. Use
169
+ * Bare Node http handler for `/live` / `/ready` on the MAIN port. Use
170
170
  * when probes-on-main is the deployment shape (Cloud Run, Lambda Function
171
171
  * URLs, simple K8s sidecar-free setups).
172
172
  *
173
173
  * const probeHandler = lifecycle.probeHandler;
174
- * expressApp.get("/livez", (req, res) => probeHandler(req, res, "live"));
175
- * expressApp.get("/readyz", (req, res) => probeHandler(req, res, "ready"));
174
+ * expressApp.get("/live", (req, res) => probeHandler(req, res, "live"));
175
+ * expressApp.get("/ready", (req, res) => probeHandler(req, res, "ready"));
176
176
  *
177
177
  * `live` is always 200 unless the process is shutting down.
178
178
  * `ready` is 200 only when all checks pass AND we're not shutting down.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwire/endpoint",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Nwire — production process lifecycle. Wraps any Node server (Express, Fastify, Koa, Nest, Nwire interfaces) with K8s-grade graceful shutdown, http-terminator drain, and lightship readiness/liveness probes. Standalone — no framework dependency beyond @nwire/container.",
5
5
  "keywords": [
6
6
  "endpoint",
@@ -32,10 +32,10 @@
32
32
  "dependencies": {
33
33
  "http-terminator": "^3.2.0",
34
34
  "lightship": "^9.0.4",
35
- "@nwire/container": "0.10.0",
36
- "@nwire/hooks": "0.10.0",
37
- "@nwire/wires": "0.10.0",
38
- "@nwire/logger": "0.10.0"
35
+ "@nwire/hooks": "0.10.1",
36
+ "@nwire/container": "0.10.1",
37
+ "@nwire/logger": "0.10.1",
38
+ "@nwire/wires": "0.10.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^22.19.9",