@bymax-one/nest-realtime 1.2.27 → 1.2.28
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 +13 -2
- package/README.md +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,12 +7,22 @@ Versioning is **not** strict [SemVer](https://semver.org/spec/v2.0.0.html) while
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.28] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
- **The README states what a `tenantResolver`'s promise cannot have handled, and what `websocket.cors` does without an `origin`.** A promise the resolver returns has its rejection absorbed except in the cases the 1.2.27 entry lists. A `cors` block with no `origin` key leaves Socket.IO's own default, which answers `*`; browsers refuse `*` together with `credentials: true`, so the origin is the host's to set.
|
|
15
|
+
|
|
16
|
+
#### Apply to a derived backend
|
|
17
|
+
|
|
18
|
+
None. No code changed.
|
|
19
|
+
|
|
10
20
|
## [1.2.27] - 2026-11-21
|
|
11
21
|
|
|
12
22
|
### Fixed
|
|
13
23
|
|
|
14
24
|
- **`roles` is read with a bound, and a `roles` that cannot be read is refused in every shape.** A revoked proxy over an array made `Array.isArray` throw a raw `TypeError` before the guard; the check now sits inside it, so the refusal is `REALTIME_AUTH_FAILED` with the host's error as the cause. The copy stops at 1,024 roles: an authentication result with more is refused with `REALTIME_AUTH_FAILED`, and an iterator that never ends is no longer read to exhaustion. The bound is there to cap the cost of the copy, not to say how many roles a user may hold; exactly 1,024 is admitted.
|
|
15
|
-
- **The rejection of a promise a `tenantResolver` returns is absorbed whatever kind of promise it is.** The check was `instanceof Promise`, which a promise from another realm fails, and the handler was the promise's own `catch`, which a subclass can override; either left an unhandled rejection that ended the process. The handler is now attached with the intrinsic `then`, which accepts a real promise of any realm and refuses every other value without reading a property of it. A proxy over a promise
|
|
25
|
+
- **The rejection of a promise a `tenantResolver` returns is absorbed whatever kind of promise it is.** The check was `instanceof Promise`, which a promise from another realm fails, and the handler was the promise's own `catch`, which a subclass can override; either left an unhandled rejection that ended the process. The handler is now attached with the intrinsic `then`, which accepts a real promise of any realm and refuses every other value without reading a property of it. A proxy over a promise whose `get` trap binds the promise's methods to it is given its own `catch` when the intrinsic refuses it, so its rejection is absorbed too; a thenable that is not a promise is still never asked for its `then`. These cannot be given a handler by either path, and their rejection is left to the process: a proxy with no traps, a proxy whose `catch` trap throws, and a promise whose species lookup throws (see the README for which values do that).
|
|
16
26
|
|
|
17
27
|
### Documentation
|
|
18
28
|
|
|
@@ -1319,7 +1329,8 @@ First published release.
|
|
|
1319
1329
|
rather than by the manual sweep that raised the NestJS floors — that sweep
|
|
1320
1330
|
asked about NestJS and never put the same question to the other ten peers.
|
|
1321
1331
|
|
|
1322
|
-
[Unreleased]: https://github.com/bymaxone/nest-realtime/compare/v1.2.
|
|
1332
|
+
[Unreleased]: https://github.com/bymaxone/nest-realtime/compare/v1.2.28...HEAD
|
|
1333
|
+
[1.2.28]: https://github.com/bymaxone/nest-realtime/compare/v1.2.27...v1.2.28
|
|
1323
1334
|
[1.2.27]: https://github.com/bymaxone/nest-realtime/compare/v1.2.26...v1.2.27
|
|
1324
1335
|
[1.2.26]: https://github.com/bymaxone/nest-realtime/compare/v1.2.25...v1.2.26
|
|
1325
1336
|
[1.2.25]: https://github.com/bymaxone/nest-realtime/compare/v1.2.24...v1.2.25
|
package/README.md
CHANGED
|
@@ -631,6 +631,7 @@ When integrating `@bymax-one/nest-realtime` in production, verify each of the fo
|
|
|
631
631
|
- `tenantId` is derived from the authenticated result, never from a query parameter or request body
|
|
632
632
|
- Tickets are single-use and short-lived; `consume()` must be atomic under concurrency
|
|
633
633
|
- `websocket.cors.origin` is an explicit allowlist, not `true`, in any browser-facing deployment
|
|
634
|
+
- `websocket.cors` with `credentials: true` also sets `origin`: a block with no `origin` key leaves Socket.IO's default, which answers `*`, and browsers refuse `*` together with credentials
|
|
634
635
|
- `maxConnectionsPerUser` is left at its default of `5` (or set) for WebSocket if clients are untrusted — `0` makes it unlimited
|
|
635
636
|
- Reserved event names are not reused for application events (see the [catalog](#reserved-events))
|
|
636
637
|
|
|
@@ -779,6 +780,8 @@ To place a connection in no tenant, **omit `tenantId`**. The runtime also accept
|
|
|
779
780
|
|
|
780
781
|
`tenantResolver` cannot clear a tenant. It receives the authenticator's own result, the object it returned and not a copy, so everything on it works as it does for the authenticator's code. The library keeps its own record of `userId`, `tenantId`, `roles`, `rooms` and `metadata`, built by name before the resolver runs and read the way JavaScript reads a property, so a field that a class default, `Object.create` or an accessor on the prototype supplies counts. What a resolver writes to the result does not change that record, which is another object; `roles`, `rooms` and `metadata` are shared, so a write inside them changes what the library keeps. Resolution is `tenantResolver?.(auth) ?? tenantId`, where `tenantId` is what the result held before the resolver ran, so a resolver returning `undefined` or `null` means "no opinion" and the authenticator's tenant stays. Decide the absent case in the authenticator.
|
|
781
782
|
|
|
783
|
+
A resolver that returns a promise is refused as a blank tenant, and the promise's rejection is handled so it cannot end the process. That handling reaches a native promise from any realm, a subclass, a promise with a `then` of its own, and a proxy whose `get` trap binds the promise's methods. It cannot reach a proxy with no traps, a proxy whose `catch` trap throws, or a promise whose species lookup throws, which is a `constructor` that is neither an object nor `undefined`, a `Symbol.species` that is neither a constructor nor `null` or `undefined`, or a getter for either that throws: `then` and `catch` run that lookup before attaching a handler, so such a promise's rejection is left to the process. A thenable that is not a promise is never asked for its `then`. Return a value from a resolver, not a promise.
|
|
784
|
+
|
|
782
785
|
#### Carrying handshake context into the hooks
|
|
783
786
|
|
|
784
787
|
`AuthenticationResult.metadata` is a free-form bag the library carries verbatim: it reaches
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bymax-one/nest-realtime",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.28",
|
|
4
4
|
"description": "Realtime backend → frontend communication for NestJS — dual-transport SSE (default) and WebSocket (opt-in) with a unified server-side API.",
|
|
5
5
|
"author": "Bymax One <support@bymax.one>",
|
|
6
6
|
"license": "MIT",
|