@fuzdev/fuz_app 0.177.0 → 0.179.0
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/dist/actions/CLAUDE.md +117 -12
- package/dist/actions/connection_registry.d.ts +18 -0
- package/dist/actions/connection_registry.d.ts.map +1 -1
- package/dist/actions/connection_registry.js +23 -0
- package/dist/actions/room_action_specs.d.ts +733 -0
- package/dist/actions/room_action_specs.d.ts.map +1 -0
- package/dist/actions/room_action_specs.js +506 -0
- package/dist/actions/room_actions.d.ts +276 -0
- package/dist/actions/room_actions.d.ts.map +1 -0
- package/dist/actions/room_actions.js +394 -0
- package/dist/actions/room_client.svelte.d.ts +399 -0
- package/dist/actions/room_client.svelte.d.ts.map +1 -0
- package/dist/actions/room_client.svelte.js +942 -0
- package/dist/actions/room_registry.d.ts +454 -0
- package/dist/actions/room_registry.d.ts.map +1 -0
- package/dist/actions/room_registry.js +927 -0
- package/dist/actions/ws_socket_session.d.ts +2 -2
- package/dist/actions/ws_socket_session.js +3 -3
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_queries.d.ts +17 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +30 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts +102 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_mesh.svelte.js +232 -0
- package/dist/rtc/rtc_peer.svelte.d.ts +180 -0
- package/dist/rtc/rtc_peer.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_peer.svelte.js +397 -0
- package/dist/rtc/rtc_signal.d.ts +74 -0
- package/dist/rtc/rtc_signal.d.ts.map +1 -0
- package/dist/rtc/rtc_signal.js +87 -0
- package/dist/server/app_server.d.ts +16 -27
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +7 -9
- package/dist/testing/CLAUDE.md +72 -18
- package/dist/testing/cross_backend/action_manifest.d.ts +34 -2
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +33 -6
- package/dist/testing/cross_backend/capabilities.d.ts +23 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +4 -1
- package/dist/testing/cross_backend/default_backend_configs.js +1 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +31 -6
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -13
- package/dist/testing/cross_backend/rooms_ws.d.ts +20 -0
- package/dist/testing/cross_backend/rooms_ws.d.ts.map +1 -0
- package/dist/testing/cross_backend/rooms_ws.js +534 -0
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +5 -2
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +24 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +2 -1
- package/dist/testing/cross_backend/test_room_authorize.d.ts +47 -0
- package/dist/testing/cross_backend/test_room_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_room_authorize.js +58 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +10 -4
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +85 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +57 -3
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts +23 -37
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -8
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +35 -46
- package/dist/testing/cross_backend/transport_composition.js +2 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +6 -3
- package/dist/testing/stubs.d.ts +1 -1
- package/dist/testing/stubs.js +1 -1
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/package.json +21 -26
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -770,14 +770,13 @@ runs after server context is assembled so action lists can depend on
|
|
|
770
770
|
`ctx.deps` / `ctx.action_*_rate_limiter`. Each entry is auto-mounted via
|
|
771
771
|
`register_action_ws` against the assembled Hono app.
|
|
772
772
|
|
|
773
|
-
`
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
NOT trip the check, so feature-flag gated WS surfaces stay safe.
|
|
773
|
+
`upgrade_websocket: UpgradeWebSocket` is the Hono runtime adapter's
|
|
774
|
+
module-level helper — `upgradeWebSocket` from `@hono/bun`, or from
|
|
775
|
+
`@hono/node-server` on Node, whose `serve` must then be given a `ws`
|
|
776
|
+
`WebSocketServer` built with `noServer: true` (`websocket: {server}`).
|
|
777
|
+
`create_app_server` throws when `ws_endpoints` resolves non-empty but the
|
|
778
|
+
helper is missing; a `ws_endpoints` factory returning `[]` does NOT trip the check, so
|
|
779
|
+
feature-flag gated WS surfaces stay safe.
|
|
781
780
|
|
|
782
781
|
What every auto-mount gets, so no hand mount has to remember it: the
|
|
783
782
|
`action_ip_rate_limiter` / `action_account_rate_limiter` instances the RPC
|
|
@@ -873,7 +872,7 @@ HTTP RPC also calls. The socket session owns only WS-specific concerns:
|
|
|
873
872
|
- **Wire envelope parsing** — `parse_json_text` (`http/json_text.ts`: what the Rust spine's `serde_json` refuses is a `parse_error` here too) → batch rejection → `classify_jsonrpc_message` (`http/jsonrpc_helpers.ts`, the twin of the Rust `fuz_http::classify`, the same classifier the HTTP POST path runs) → per-arm handling: an `invalid` answers its error on its id; a `response` routes to the socket's pending peer request; a `notification` routes `cancel` and is otherwise dropped; a `request` goes on to the duplicate-id and in-flight checks and dispatch. The classifier runs the twin's order — version, then the `method` axis, then `id`, then the `JsonrpcRequest` envelope — so `{method: 'x'}` and `{jsonrpc: '1.0', method: 'x'}` answer `invalid_request` rather than being dropped as notifications; a response is the twin's shape exactly (no string `method`, a string/number `id`, exactly one of `result` / `error`), so a hybrid like `{method, id, result}` stays a dispatchable request; and `params: null`, an array `params`, or a non-string/number `id` answers `invalid_request` (-32600) on both transports rather than reaching the dispatcher as `invalid_params`. Notifications stay unvalidated (they carry no id to echo). A non-object frame answers `id: null`. POST answers a notification or a response `invalid_request` on `id: null`, as the Rust spine does.
|
|
874
873
|
- **Cancel-notification interception** — `{request_id → AbortController}` map; aborts the matching pending controller before the cancel bubbles past the dispatcher
|
|
875
874
|
- **Duplicate live ids refused** — a request whose id names a request still running on the socket is answered `invalid_request` with `data.reason` `ERROR_DUPLICATE_REQUEST_ID` and not dispatched; the running request keeps its controller, its cancel entry, and its reply id. An id is free again once its request is answered. Same refusal on the Rust spine
|
|
876
|
-
- **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-
|
|
875
|
+
- **In-flight ceiling** — at most `MAX_INBOUND_DISPATCHES_PER_CONNECTION` (128) requests run at once per socket (`@hono/node-server` does not await `onMessage`, so nothing else bounds them); one more is answered `queue_overflow` (`WS_INBOUND_DISPATCH_OVERFLOW_MESSAGE`) and not dispatched, and the socket stays open and keeps reading — a reply to a server-initiated request still gets through. The duplicate check runs first; neither refusal reaches `perform_action`, so neither charges the action rate limiters. Same cap, message, and order as the Rust spine's `MAX_INBOUND_DISPATCHES_PER_CONNECTION`
|
|
877
876
|
- **Socket-scoped notify** — `(method, params) => registry.send_to(connection_id, notification)`, threaded into `perform_action` as `notify`
|
|
878
877
|
- **Every send through the registry** — responses, error frames, and notifications all go through `registry.send_to`, so they are held to the connection's outbound budget; a handler that sends past it closes its own socket with `WS_CLOSE_OUTBOUND_OVERFLOW` and gets no response written
|
|
879
878
|
- **Composed abort signal** — `AbortSignal.any([socket_close, per_request_cancel])`, threaded as `signal`
|
|
@@ -919,7 +918,7 @@ the registry after the mount returns, releasing it when assembly fails or
|
|
|
919
918
|
the server closes.
|
|
920
919
|
|
|
921
920
|
Because `onOpen` awaits, an adapter can deliver `onMessage` before admission
|
|
922
|
-
(`@hono/node-
|
|
921
|
+
(`@hono/node-server` doesn't await `onOpen` at all). Those frames are **queued, not
|
|
923
922
|
dispatched** — nothing runs on a credential that has not been re-read — and
|
|
924
923
|
dispatch in arrival order, back to back, once the socket is admitted and
|
|
925
924
|
`on_socket_open` has completed; a refusal drops them unread. The Rust spine
|
|
@@ -941,7 +940,7 @@ returns (it times out); start such a request without awaiting it.
|
|
|
941
940
|
|
|
942
941
|
**A server-closed socket dispatches nothing.** An adapter can keep delivering
|
|
943
942
|
frames after the server calls `ws.close(…)`, until the close handshake
|
|
944
|
-
completes — `@hono/node-
|
|
943
|
+
completes — `@hono/node-server` does, for up to the `ws` close timeout when the
|
|
945
944
|
client withholds its close frame. So every server-side close removes the
|
|
946
945
|
connection from the registry and aborts the socket's controller **at close
|
|
947
946
|
time**: the registry does both for a revocation or a cap eviction, and
|
|
@@ -980,7 +979,7 @@ and reaches `on_effect_error` (`create_app_server` threads its own to the
|
|
|
980
979
|
endpoints it mounts) with `{transport: 'ws', method, path}`. Nothing orders that
|
|
981
980
|
flush against other frames: frames on an admitted socket are not serialized
|
|
982
981
|
(`handle_frame` calls aren't chained, and an adapter need not await
|
|
983
|
-
`onMessage` — `@hono/node-
|
|
982
|
+
`onMessage` — `@hono/node-server` doesn't), so a message's effects can still be
|
|
984
983
|
in flight when the caller reads its reply and when the next message
|
|
985
984
|
dispatches. A test that reads the audit log after a WS reply awaits
|
|
986
985
|
`_testing_drain_effects` first, over an emitter built with
|
|
@@ -1046,6 +1045,112 @@ Two abort signals composed via `AbortSignal.any`:
|
|
|
1046
1045
|
- `socket_abort_controller` — per-socket, fires when the socket ends: at the server's close (revocation, cap eviction, heartbeat timeout, …) or the client's. Registered with the registry, which aborts it on the closes it makes. Drives every handler's `ctx.signal`.
|
|
1047
1046
|
- `pending_controllers: Map<JsonrpcRequestId, AbortController>` — per-request. Registered before dispatch (one entry per running request — a duplicate live id is refused — so its size is the in-flight count the ceiling bounds), cleared in `finally` so late cancels for a completed id (or a reused id) can't null-abort the wrong handler. Unknown cancels no-op.
|
|
1048
1047
|
|
|
1048
|
+
## Rooms (`actions/room_registry.ts`, `actions/room_action_specs.ts`, `actions/room_actions.ts`)
|
|
1049
|
+
|
|
1050
|
+
A generic live-room primitive over one WS endpoint's `ConnectionRegistry` —
|
|
1051
|
+
the TS twin of the Rust spine's `fuz_realtime::RoomRegistry` and
|
|
1052
|
+
`fuz_actions::room`, one wire, held to it by the `rooms_ws` cross suite. Each
|
|
1053
|
+
module doc holds the detail; the cross-cutting shape:
|
|
1054
|
+
|
|
1055
|
+
- **`RoomRegistry`** (`new RoomRegistry(connections, options)`) — rooms keyed
|
|
1056
|
+
by a consumer's `RoomId` (1–`ROOM_ID_MAX_LENGTH` printable ASCII), holding
|
|
1057
|
+
seats (random `MemberId` per join, keyed by connection and actor) and watches
|
|
1058
|
+
(one per connection and room, for whichever actor last asked). Options:
|
|
1059
|
+
`exclusive` (one seat per actor across the registry, newest admitted wins,
|
|
1060
|
+
with the rejoin tombstone — `ROOM_REJOIN_TOMBSTONE_TTL_MS`,
|
|
1061
|
+
`ROOM_REJOIN_TOMBSTONES_PER_ACTOR`), `max_members_per_room`,
|
|
1062
|
+
`max_payload_bytes`, `max_state_bytes`, `max_watches_per_connection`
|
|
1063
|
+
(`DEFAULT_ROOM_*`), `topology`. Every method runs without an `await`, so no
|
|
1064
|
+
check is separated from its mutation (the Rust registry's one lock). Each
|
|
1065
|
+
room's events carry a per-room `seq`; an empty room is deleted. Refusals are
|
|
1066
|
+
a `RoomResult` (`RoomError`), not throws.
|
|
1067
|
+
- **Two-phase join and watch** — `reserve_seat` / `reserve_watch` before the
|
|
1068
|
+
consumer's authorizer reads, `admit_seat` / `admit_watch` after, so an
|
|
1069
|
+
eviction committing mid-authorizer still reaches the request (an actor or
|
|
1070
|
+
room target refuses it, a scope target poisons it, at most
|
|
1071
|
+
`MAX_POISONED_SCOPES`). The admit consumes the pending entry; a caller that
|
|
1072
|
+
never reaches it calls `withdraw` in a `finally` (the Rust guard's drop). A
|
|
1073
|
+
TS join keeps running after its socket closes, so the admit reads the
|
|
1074
|
+
socket's signal and the close marks every join in flight.
|
|
1075
|
+
- **Disconnect** — the first reserve on a connection adds one listener to
|
|
1076
|
+
`ConnectionRegistry.socket_signal(connection_id)` (the registered
|
|
1077
|
+
`abort_controller`'s signal, which every close path aborts; `null` while
|
|
1078
|
+
pending or once gone); its abort releases every seat (`room_member_left`
|
|
1079
|
+
reason `disconnected`), watch, and join in flight on the next microtask, so a
|
|
1080
|
+
close inside a fan-out (an overflow) never re-enters the registry mid-step.
|
|
1081
|
+
- **Eviction** — `evict(target, reason)` by `actor`, `actor_in_scope`, `room`,
|
|
1082
|
+
or `scope` (`RoomEvictTarget`), covering seats, watches, and joins in flight;
|
|
1083
|
+
the consumer calls it after its authority change commits
|
|
1084
|
+
(`emit_after_commit`). `clear()` drops everything silently, for a test reset.
|
|
1085
|
+
- **The verbs** — `create_room_actions({registry, authorize, limiter},
|
|
1086
|
+
{join_extra?})` returns the `room_*` `RpcAction`s
|
|
1087
|
+
(`all_room_action_specs`), **WS-only**: mount them on a `ws_endpoints` entry
|
|
1088
|
+
(with `room_notification_actions` for the surface), never an RPC endpoint.
|
|
1089
|
+
Actor-required, `side_effects: false`; `room_join` and `room_watch` carry
|
|
1090
|
+
`rate_limit: 'account'`. `RoomAuthorize.authorize({actor_id, account_id,
|
|
1091
|
+
room_id, access}, db)` gets the caller's ids and the pool `db`, never the
|
|
1092
|
+
request's role grants (loaded before the reserve, so possibly older than an
|
|
1093
|
+
eviction); `{allow: false}` answers `room_not_found`, the IDOR mask.
|
|
1094
|
+
`RoomRateLimiter` (`DEFAULT_ROOM_RATE_LIMIT`: 300 requests and 1 MiB per
|
|
1095
|
+
10 s) is per connection, two refilling buckets charged on join, send, and
|
|
1096
|
+
state set — one request plus the payload's or state's `json_escaped_len`,
|
|
1097
|
+
the bytes it adds to each frame — but not watch; `create_room_actions` throws
|
|
1098
|
+
when the limiter can't cover a max-size payload or state
|
|
1099
|
+
(`check_room_limits`). Refusals: the `ERROR_ROOM_*` reasons
|
|
1100
|
+
(`to_room_jsonrpc_error`), `rate_limited` with `data.retry_after`, and
|
|
1101
|
+
`request_cancelled` for a cancelled join or a closed socket.
|
|
1102
|
+
- **Notifications** — `room_member_joined`, `room_member_left`,
|
|
1103
|
+
`room_member_state` (to the other members and the watchers),
|
|
1104
|
+
`room_message` (addressee, or the room minus the sender), `room_seat_lost`
|
|
1105
|
+
(the displaced or evicted seat's own connection, `moved_to` for a move), and
|
|
1106
|
+
`room_watch_ended` — each a `remote_notification` spec with its params schema.
|
|
1107
|
+
|
|
1108
|
+
### Room client (`actions/room_client.svelte.ts`)
|
|
1109
|
+
|
|
1110
|
+
The frontend side, one `RoomClient` per socket and actor (`acting`), holding a
|
|
1111
|
+
reactive `RoomState` per room (`client.room(room_id)`): `members`, `seat`
|
|
1112
|
+
(`RoomSeat` — `member_id`, `topology`, `extra`), `seat_status`
|
|
1113
|
+
(`RoomSeatStatus`), `watching`, `ended` (`RoomSeatEnded`), `watch_ended`,
|
|
1114
|
+
`error`, `local_state`. The module doc holds the reasoning; the shape:
|
|
1115
|
+
|
|
1116
|
+
- **Verbs** — `create_room_rpc(socket)` builds the `RoomRpc` the client takes:
|
|
1117
|
+
the room verbs straight over `FrontendWebsocketClient.request`, unqueued,
|
|
1118
|
+
answers parsed with the output schemas forward-compatibly
|
|
1119
|
+
(`safe_parse_dropping_unknown_keys`), never through the RPC client's
|
|
1120
|
+
transports (which fall back to HTTP while the socket is down, where no room
|
|
1121
|
+
verb is mounted), plus `connection` — the open `WebSocket`, else `null`.
|
|
1122
|
+
- **Wants, converged one request at a time** — `join`, `leave`, `watch`,
|
|
1123
|
+
`unwatch`, `set_state` record a want; one runner per room sends the requests
|
|
1124
|
+
that close the gap, waiting for each answer (the server dispatches a
|
|
1125
|
+
socket's requests concurrently, so a leave could otherwise overtake its
|
|
1126
|
+
join). Nothing is sent while the socket is down. `send` goes out at once.
|
|
1127
|
+
Every verb runs in `untrack`, so a page's `$effect` may call one (with its
|
|
1128
|
+
opposite in the teardown) without depending on room state.
|
|
1129
|
+
- **`seq`** — events before the first join or watch answer buffer, then replay
|
|
1130
|
+
past its `seq`; a live room drops events at or below its last `seq`. A
|
|
1131
|
+
message reaching a live watch while the join is in flight is held for the
|
|
1132
|
+
seat and delivered after `seated`.
|
|
1133
|
+
- **Connections** — the client follows `RoomRpc.connection` itself, an
|
|
1134
|
+
`$effect.root` made in the constructor (a no-op on the server) and ended by
|
|
1135
|
+
`dispose`, calling `sync_connection()`, which compares it by identity, so a
|
|
1136
|
+
close and reopen in one batch still counts; `sync_connection` stays public
|
|
1137
|
+
and runs before each request and notification. A seat lost to the old
|
|
1138
|
+
connection is rejoined with `rejoin_of`; a `room_seat_moved` refusal ends it
|
|
1139
|
+
as moved, and a `rate_limited` one is retried after its `retry_after`, up
|
|
1140
|
+
to `ROOM_REJOIN_RATE_LIMITED_RETRIES_MAX` times (`set_timeout` /
|
|
1141
|
+
`clear_timeout` in `RoomClientOptions`). `room_seat_lost` (moved, evicted,
|
|
1142
|
+
room closed) is never rejoined. Watches are taken again.
|
|
1143
|
+
- **Notifications** — `receive(method, params)` from the RPC client's
|
|
1144
|
+
`'receive'` handlers (`is_room_notification_method`), parsing each with its
|
|
1145
|
+
params schema. `RoomListener` (`add_listener`) hears `seated`, `unseated`
|
|
1146
|
+
(`RoomUnseatedReason`), member events, and messages, in `seq` order except
|
|
1147
|
+
a message held for the seat, heard once it is taken —
|
|
1148
|
+
`rtc/rtc_mesh.svelte.ts`'s `RtcMesh` follows a room through it. A listener
|
|
1149
|
+
that throws is logged; the others still hear, and the join or replay
|
|
1150
|
+
carries on.
|
|
1151
|
+
- **`dispose()`** leaves every seat, drops every watch, and stops following
|
|
1152
|
+
the connection.
|
|
1153
|
+
|
|
1049
1154
|
## Protocol actions (`actions/protocol.ts`)
|
|
1050
1155
|
|
|
1051
1156
|
Three shared `{spec, handler}` tuples that every consumer spreads into both
|
|
@@ -533,6 +533,24 @@ export declare class ConnectionRegistry {
|
|
|
533
533
|
* is still in flight. The twin of the Rust `ConnectionRegistry::is_registered`.
|
|
534
534
|
*/
|
|
535
535
|
is_registered(connection_id: Uuid): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* The socket-scoped signal of an admitted connection — its registered
|
|
538
|
+
* `abort_controller`'s, which every close path aborts: the registry's own
|
|
539
|
+
* closes (a revocation, the cap, an overflow, a stalled write, the
|
|
540
|
+
* shutdown) and `register_action_ws`'s (a heartbeat timeout, an oversized
|
|
541
|
+
* message, a refused admission, the client's close). `null` once the
|
|
542
|
+
* connection is gone, while it is still pending admission, and for one
|
|
543
|
+
* registered without a controller.
|
|
544
|
+
*
|
|
545
|
+
* A room registry (`actions/room_registry.ts`) waits on it, one listener
|
|
546
|
+
* per connection, to release the connection's seats and watches. Twin of
|
|
547
|
+
* the Rust `ConnectionRegistry::socket_signal` (crate-private there, where
|
|
548
|
+
* the room registry shares the crate).
|
|
549
|
+
*
|
|
550
|
+
* @param connection_id - the id `register_pending` / `add_connection` returned
|
|
551
|
+
* @returns the signal, or `null`
|
|
552
|
+
*/
|
|
553
|
+
socket_signal(connection_id: Uuid): AbortSignal | null;
|
|
536
554
|
/**
|
|
537
555
|
* Number of currently **admitted** WebSocket connections.
|
|
538
556
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection_registry.d.ts","sourceRoot":"","sources":["../../src/lib/actions/connection_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEjE,O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O;IAI3C;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,aAAa,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI;IAMtD;;;;;;;;OAQG;IACH,gBAAgB,IAAI,MAAM;IAQ1B;;;;;OAKG;IACH,wBAAwB,IAAI,MAAM;CAOlC"}
|
|
@@ -824,6 +824,29 @@ export class ConnectionRegistry {
|
|
|
824
824
|
is_registered(connection_id) {
|
|
825
825
|
return this.#connections.get(connection_id)?.admitted === true;
|
|
826
826
|
}
|
|
827
|
+
/**
|
|
828
|
+
* The socket-scoped signal of an admitted connection — its registered
|
|
829
|
+
* `abort_controller`'s, which every close path aborts: the registry's own
|
|
830
|
+
* closes (a revocation, the cap, an overflow, a stalled write, the
|
|
831
|
+
* shutdown) and `register_action_ws`'s (a heartbeat timeout, an oversized
|
|
832
|
+
* message, a refused admission, the client's close). `null` once the
|
|
833
|
+
* connection is gone, while it is still pending admission, and for one
|
|
834
|
+
* registered without a controller.
|
|
835
|
+
*
|
|
836
|
+
* A room registry (`actions/room_registry.ts`) waits on it, one listener
|
|
837
|
+
* per connection, to release the connection's seats and watches. Twin of
|
|
838
|
+
* the Rust `ConnectionRegistry::socket_signal` (crate-private there, where
|
|
839
|
+
* the room registry shares the crate).
|
|
840
|
+
*
|
|
841
|
+
* @param connection_id - the id `register_pending` / `add_connection` returned
|
|
842
|
+
* @returns the signal, or `null`
|
|
843
|
+
*/
|
|
844
|
+
socket_signal(connection_id) {
|
|
845
|
+
const entry = this.#connections.get(connection_id);
|
|
846
|
+
if (!entry?.admitted)
|
|
847
|
+
return null;
|
|
848
|
+
return entry.abort_controller?.signal ?? null;
|
|
849
|
+
}
|
|
827
850
|
/**
|
|
828
851
|
* Number of currently **admitted** WebSocket connections.
|
|
829
852
|
*
|