Interface: StreamBuilder<TEvent, TPayload>
Defined in: builders/stream-builder.ts:16
Fluent builder for inbound event streams (P.stream(id)).
Connects an external StreamSourceASTNode through an optional synchronous filter predicate to a typed SignalNode emission rule.
Extends
AstBuilder<StreamNode<TEvent,TPayload>>
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TEvent | unknown | Inbound event payload type from the stream source. |
TPayload | unknown | Outbound signal payload type emitted into the harness. |
Methods
emitSignal()
emitSignal<TNextPayload>(signal, mapPayload): StreamBuilder<TEvent, TNextPayload>;Defined in: builders/stream-builder.ts:59
Binds the target SignalNode<TNextPayload> and synchronous payload mapper emitted when an event matches.
Every matching event is projected via mapPayload(event) and validated against signal.schema.
Type Parameters
| Type Parameter | Description |
|---|---|
TNextPayload | Signal payload type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
signal | MaybeBuilder<SignalNode<TNextPayload>> | Target signal node or builder. |
mapPayload | (event) => TNextPayload | Synchronous event-to-signal payload mapper. |
Returns
StreamBuilder<TEvent, TNextPayload>
New immutable stream builder instance.
filter()
filter(predicate): StreamBuilder<TEvent, TPayload>;Defined in: builders/stream-builder.ts:45
Binds a synchronous predicate filtering inbound events before signal projection.
Events for which predicate(event) returns false are dropped before emitSignal runs.
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | (event) => boolean | Synchronous event filter predicate. |
Returns
StreamBuilder<TEvent, TPayload>
New immutable stream builder instance.
source()
source<TNextEvent>(streamSource): StreamBuilder<TNextEvent, TPayload>;Defined in: builders/stream-builder.ts:32
Binds the inbound StreamSourceASTNode<TNextEvent> for this stream.
Resets any previously bound filter predicate when the inbound event type changes.
Type Parameters
| Type Parameter | Description |
|---|---|
TNextEvent | Inbound event type produced by streamSource. |
Parameters
| Parameter | Type | Description |
|---|---|---|
streamSource | MaybeBuilder<GithubWebhookStreamNode<TNextEvent>> | Stream source node or builder. |
Returns
StreamBuilder<TNextEvent, TPayload>
New immutable stream builder instance.
toAST()
toAST(): StreamNode;Defined in: ast/ast-builder.ts:20
Compiles the current builder configuration into a deeply frozen passive AST node.
Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.
Returns
Deeply frozen passive AST node.
Inherited from
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
id | readonly | string | Unique identifier of the stream definition. | builders/stream-builder.ts:19 |