ChangeStreamOptions
Defined in: libs/runtime/src/change-stream.ts:27
How a hub serves its change stream: polling, batch size, port and the limits that protect it.
Member summary
Section titled “Member summary”Properties
| Name | Description |
|---|---|
| limit? | Batch size per flush. |
| maxBodyBytes? | The largest POST body, in bytes. |
| maxStreams? | The most SSE streams open at once. |
| onError? | Told about a failure inside the hub: a batch that could not be applied. |
| pollMs? | How often to look for new changes. |
| port? | Bind a specific port instead of an ephemeral one. |
Properties
Section titled “Properties”limit?
Section titled “limit?”
readonlyoptionallimit?:number
Defined in: libs/runtime/src/change-stream.ts:38
Batch size per flush.
maxBodyBytes?
Section titled “maxBodyBytes?”
readonlyoptionalmaxBodyBytes?:number
Defined in: libs/runtime/src/change-stream.ts:52
The largest POST body, in bytes. A larger one is refused with 413 before it is all read. Default 64 MiB, far above a batch of 500 revisions of ordinary documents (about 2 MB in the load test), and low enough that one request cannot exhaust a hub’s memory.
maxStreams?
Section titled “maxStreams?”
readonlyoptionalmaxStreams?:number
Defined in: libs/runtime/src/change-stream.ts:57
The most SSE streams open at once. One more is refused with 503 and retry-after. Each stream
holds a connection and a timer that queries the log every pollMs. Default 256.
onError?
Section titled “onError?”
readonlyoptionalonError?: (error) =>void
Defined in: libs/runtime/src/change-stream.ts:63
Told about a failure inside the hub: a batch that could not be applied. The client is told only “internal error”, because the real message names tables and files. Without this, the failure is invisible to whoever runs the hub.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void
pollMs?
Section titled “pollMs?”
readonlyoptionalpollMs?:number
Defined in: libs/runtime/src/change-stream.ts:36
How often to look for new changes.
This is the safety net, not the mechanism: a hub that performs its own writes publishes a
domain event and can wake immediately. What polling covers is a write that bypassed the
application — a CLI, a migration, a repair script — which emits nothing. node:sqlite exposes
no update or commit hook, so there is no way to be told about those.
readonlyoptionalport?:number
Defined in: libs/runtime/src/change-stream.ts:46
Bind a specific port instead of an ephemeral one.
Needed to restart a hub on the port a client is already retrying against — otherwise a “survives a restart” test would be testing a client’s ability to find a new address, which is not what resume means.
TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.