Type Alias GraffitiStream<TValue, TReturn>

GraffitiStream: AsyncGenerator<
    { error?: undefined; value: TValue }
    | { error: Error; source: string },
    TReturn,
>

This type represents a stream of data that are returned by Graffiti's query-like operations such as Graffiti.discover and Graffiti.recoverOrphans.

Errors are returned within the stream rather than as exceptions that would halt the entire stream. This is because some implementations may pull data from multiple sources including some that may be unreliable. In many cases, these errors can be safely ignored.

The stream is an AsyncGenerator that can be iterated over using for await loops or calling next on the generator. The stream can be terminated by breaking out of a loop calling return on the generator.

Type Parameters

  • TValue
  • TReturn = void