Skip to content

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 ​

Type Parameters ​

Type ParameterDefault typeDescription
TEventunknownInbound event payload type from the stream source.
TPayloadunknownOutbound signal payload type emitted into the harness.

Methods ​

emitSignal() ​

ts
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 ParameterDescription
TNextPayloadSignal payload type.

Parameters ​

ParameterTypeDescription
signalMaybeBuilder<SignalNode<TNextPayload>>Target signal node or builder.
mapPayload(event) => TNextPayloadSynchronous event-to-signal payload mapper.

Returns ​

StreamBuilder<TEvent, TNextPayload>

New immutable stream builder instance.


filter() ​

ts
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 ​

ParameterTypeDescription
predicate(event) => booleanSynchronous event filter predicate.

Returns ​

StreamBuilder<TEvent, TPayload>

New immutable stream builder instance.


source() ​

ts
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 ParameterDescription
TNextEventInbound event type produced by streamSource.

Parameters ​

ParameterTypeDescription
streamSourceMaybeBuilder<GithubWebhookStreamNode<TNextEvent>>Stream source node or builder.

Returns ​

StreamBuilder<TNextEvent, TPayload>

New immutable stream builder instance.


toAST() ​

ts
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 ​

StreamNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the stream definition.builders/stream-builder.ts:19

Released under the MIT License.