@bymax-one/nest-core 1.6.7 → 1.6.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/CHANGELOG.md +84 -1
- package/README.md +474 -901
- package/dist/health/index.d.cts +6 -3
- package/dist/health/index.d.ts +6 -3
- package/dist/http/index.cjs +16 -7
- package/dist/http/index.d.cts +1 -1
- package/dist/http/index.d.ts +1 -1
- package/dist/http/index.mjs +16 -7
- package/dist/index.cjs +87 -15
- package/dist/index.d.cts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.mjs +87 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,88 @@ heading here.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [1.6.8] - 2026-11-13
|
|
15
|
+
|
|
16
|
+
A patch release. Readiness stops amplifying probe traffic, stops serving what an indicator returned,
|
|
17
|
+
and answers not ready once shutdown begins; invalid timing options now fail the boot; the README is
|
|
18
|
+
corrected.
|
|
19
|
+
|
|
20
|
+
**Apply to a derived backend:** `pnpm up @bymax-one/nest-core`, then:
|
|
21
|
+
|
|
22
|
+
- If you call `applyHttpFloors` after `app.init()`, move the call before it: it now throws there
|
|
23
|
+
instead of applying only the timeouts.
|
|
24
|
+
- By default readiness answers can be up to one second old. Set `health.readinessCacheMs: 0` to keep every
|
|
25
|
+
probe fresh; probes that overlap still share one run.
|
|
26
|
+
- Readiness no longer serves the `details` an indicator returns. If a dashboard or probe reads
|
|
27
|
+
them, set `health.exposeIndicatorErrors: true` (development only) or move that data to the logger
|
|
28
|
+
or a protected endpoint.
|
|
29
|
+
- Call `app.enableShutdownHooks()` if a `SIGTERM` should flip readiness to `503`; `app.close()`
|
|
30
|
+
always does.
|
|
31
|
+
- `health.indicatorTimeoutMs` and `timing.slowRequestThresholdMs` must be positive integers, and the
|
|
32
|
+
timeout at most `2147483647`, or the boot fails. A zero or negative value was accepted before and
|
|
33
|
+
misbehaved silently; a fractional one was accepted too, and now has to be rounded.
|
|
34
|
+
- An indicator that can cancel its query should pass on the `signal` its `check()` now receives.
|
|
35
|
+
|
|
36
|
+
### Security
|
|
37
|
+
|
|
38
|
+
- **Readiness no longer fans out one run per probe.** `GET /<health.path>/ready` is usually
|
|
39
|
+
reachable without credentials, and every probe ran every indicator: 200 concurrent probes made
|
|
40
|
+
200 database and cache calls at once, and a check that timed out kept running. Probes that arrive
|
|
41
|
+
while a run is in progress now share it, a finished answer is reused for
|
|
42
|
+
`health.readinessCacheMs` (default `1000`, `0` turns it off, and the window is timed on a
|
|
43
|
+
monotonic clock), and the signal passed to `check()` is aborted at the timeout. A run that throws is
|
|
44
|
+
never cached.
|
|
45
|
+
- **Readiness no longer serves what an indicator returned.** An indicator's `details` were served
|
|
46
|
+
verbatim even with `health.exposeIndicatorErrors` off. Each check now carries only its `name` and
|
|
47
|
+
`status`; the timeout the aggregator itself reports is unchanged.
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
|
|
51
|
+
- **`health.readinessCacheMs`** and an optional `AbortSignal` argument to `IHealthIndicator.check()`.
|
|
52
|
+
Existing indicators compile unchanged.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- **`bodyDepth` no longer expands a raw body.** A `Buffer` or typed array (a body read with
|
|
57
|
+
`express.raw()` or `useBodyParser('raw')`) was walked with `Object.values`, which builds one element
|
|
58
|
+
per byte: a 40 MB body stalled the event loop for about 0.7 s and grew the process by over 1 GB,
|
|
59
|
+
with no credential needed. The walk now descends only into arrays and plain objects, so a Buffer, a typed
|
|
60
|
+
array, a `Map` or a class instance is a leaf.
|
|
61
|
+
- **`applyHttpFloors` refuses an already initialised application.** After `app.init()` Nest's own
|
|
62
|
+
parsers and the routes sit ahead of anything the helper mounts, so only the timeouts took effect
|
|
63
|
+
while the call returned normally: a gzip body was no longer refused with `415` and no
|
|
64
|
+
security headers were sent. It now throws "must run before app.init()", as it already did for a listening server.
|
|
65
|
+
- **Readiness answers not ready as soon as shutdown begins.** It kept returning the last healthy
|
|
66
|
+
answer while the process drained, so a load balancer kept routing to it. From
|
|
67
|
+
`beforeApplicationShutdown` it answers `503` with a `shutdown` check `down`, before it reads the
|
|
68
|
+
cache or a run in progress and without running an indicator. Liveness is unchanged.
|
|
69
|
+
- **`health.indicatorTimeoutMs` and `timing.slowRequestThresholdMs` are validated.** A zero made
|
|
70
|
+
every indicator report down with a timeout, or every request slow; `NaN` flagged none. A timeout
|
|
71
|
+
above `2147483647` was clamped by Node to one millisecond and did the same. Each now fails the
|
|
72
|
+
boot, naming the option.
|
|
73
|
+
|
|
74
|
+
### Documentation
|
|
75
|
+
|
|
76
|
+
- **The README states two limits of `applyHttpFloors`.** Only the JSON and urlencoded parsers refuse
|
|
77
|
+
a compressed body, so a raw or text parser you add still decompresses; and
|
|
78
|
+
`strictTransportSecurity: undefined` turns helmet's HSTS default back on.
|
|
79
|
+
- **The README says to raise `keepAliveTimeout` behind a load balancer.** It must exceed the
|
|
80
|
+
balancer's idle timeout, or the balancer reuses a connection Node has closed and answers an
|
|
81
|
+
intermittent `502`. On Node 24 a shorter `headersTimeout` did not close an idle keep-alive socket,
|
|
82
|
+
so the two need no particular order.
|
|
83
|
+
- **The README states what `prom-client` leaves behind.** Its default collectors keep an unreferenced
|
|
84
|
+
garbage-collection observer and event-loop histogram for the life of the process, which matters only
|
|
85
|
+
to a host that creates many applications in one process.
|
|
86
|
+
|
|
87
|
+
- **README rewritten for correctness and length.** The mutation threshold, the subpath and optional-peer
|
|
88
|
+
counts and the Tech Stack now match the code (`./http` and `helmet` included); the do-it-yourself
|
|
89
|
+
body-depth guide is replaced by the `bodyDepth` option it described; the OpenAPI configuration and
|
|
90
|
+
its section are merged; history and measurement narration are removed; and the Compatibility
|
|
91
|
+
section is now "What This Library Does NOT Do". No API or behaviour change.
|
|
92
|
+
- **The README states the `prom-client` position.** npm marks `prom-client` 15.x deprecated in favour of
|
|
93
|
+
`@prometheus-io/client`; this library stays on `prom-client` `^15` because collectors and the
|
|
94
|
+
`MetricsRegistry` must come from one package. No API or behaviour change.
|
|
95
|
+
|
|
14
96
|
## [1.6.7] - 2026-11-12
|
|
15
97
|
|
|
16
98
|
A patch release. Two floors that every backend re-implemented move into the library; both are additive
|
|
@@ -1366,4 +1448,5 @@ have regressed from. They are kept because the reasoning is worth having.
|
|
|
1366
1448
|
[1.6.5]: https://github.com/bymaxone/nest-core/compare/v1.6.4...v1.6.5
|
|
1367
1449
|
[1.6.6]: https://github.com/bymaxone/nest-core/compare/v1.6.5...v1.6.6
|
|
1368
1450
|
[1.6.7]: https://github.com/bymaxone/nest-core/compare/v1.6.6...v1.6.7
|
|
1369
|
-
[
|
|
1451
|
+
[1.6.8]: https://github.com/bymaxone/nest-core/compare/v1.6.7...v1.6.8
|
|
1452
|
+
[Unreleased]: https://github.com/bymaxone/nest-core/compare/v1.6.8...HEAD
|