Reference
Event types
The StitchEvent union and the shape of each event in the stream.
The events a stitch emits as it runs. A stitch streams an async iterable of
StitchEvent values; this page documents their shapes.
StitchEvent
StitchEvent<T> is a discriminated union on type. The T parameter is the
type of the value carried by the result event.
import type { } from 'stitchapi';Prop
Type
The events
A union table can render sparsely, so here is each of the seven variants and its
fields. Every event carries an at field — a millisecond timestamp.
start— the request is about to go out. Fields:name(the stitch label),method,url,input(theStitchInputfor this call),at.progress— a lifecycle beat within an attempt. Fields:phase(aProgressPhase),attempt(1-based),detail?,waitedMs?(set when the phase involved a wait, e.g.throttledorretry),at.drift— a single contract-drift observation against the response. Fields:finding(aDriftFindingwithlevel,path,change,detail?),at.delta— a streamed chunk of the response body. Fields:chunk(unknown),at.result— the call succeeded and produced a value. Fields:value(theT),status(HTTP status),attempts(how many it took),at.error— the call failed. Fields:name,message,status?,attempts,at.done— the stream is finished, success or failure. Fields:ok,ms(total duration),attempts,at.
ProgressPhase is one of 'auth', 'request', 'throttled', 'retry',
'paginate', or 'circuit'.
result and error are mutually exclusive within one stream, but done
always fires last — read done.ok to know which way it went.