Skip to main content

Interface: LeafEvents<I, O>

Defined in: packages/core/src/core/stream-hub.ts:134

The members of a leaf Processable that carry its events.

Type Parameters​

I​

I

O​

O

Methods​

complete()​

complete(output, options?): void

Defined in: packages/core/src/core/stream-hub.ts:153

Report a run's completion to the call's onComplete and to subscribers, as process() does after run for a leaf with the default lifecycle. For a leaf with lifecycle: false, whose run decides when it completed.

Parameters​

output​

O

options?​

ProcessOptions

Returns​

void


emit()​

emit(event, options?): void

Defined in: packages/core/src/core/stream-hub.ts:147

Report an event for a call from outside run's emit, as emit does.

Parameters​

event​

BaleybotStreamEvent

options?​

ProcessOptions

Returns​

void


process()​

process(input, options?): Promise<O>

Defined in: packages/core/src/core/stream-hub.ts:135

Parameters​

input​

I

options?​

ProcessOptions

Returns​

Promise<O>


stream()​

stream(input, options?): AsyncGenerator<BaleybotStreamEvent>

Defined in: packages/core/src/core/stream-hub.ts:137

process() as an async iterator of its events; ends after the last one, or throws its error.

Parameters​

input​

I

options?​

Omit<ProcessOptions, "onError" | "onToken" | "onComplete">

Returns​

AsyncGenerator<BaleybotStreamEvent>


subscribeToAll()​

subscribeToAll(options?): Subscription

Defined in: packages/core/src/core/stream-hub.ts:145

Subscribers are called synchronously, inside the run, like the call's own callbacks. Every subscriber hears a notification; if any of them threw, the run then fails with that error (an AggregateError when several did). A subscriber that throws while hearing of a failure turns the run's rejection into an AggregateError of the failure and its own error.

Parameters​

options?​

SubscribeAllCallbacks

Returns​

Subscription