Under heavy development
StitchAPI

Watch retries and throttling as they happen

Iterate a stitch's event stream instead of awaiting it, and observe every retry, pause, and drift in real time.

Task

A call is slow or flaky and you want to see why — the retry that fired, the throttle that paused, the field that drifted — not just the final value or a thrown error.

Example

One way: iterate the stitch's event stream instead of awaiting it.

import {  } from 'stitchapi';

const  = ({ : 'https://api.example.com', : '/search' });

// Await for just the value…
const  = await ({ : { : 'mango' } });

// …or iterate the stream for everything that happened on the way there.
for await (const  of ({ : { : 'mango' } }).()) {
    if (. === 'progress') .(., .);
    if (. === 'drift')
        .(.., ..);
    if (. === 'result') .(.);
}

How it works

A stitch yields a typed event stream — start → progress → drift → result → done — and await simply consumes it for the final value. .stream() hands you the events instead, discriminated on type, so narrowing one field tells the compiler the shape of the rest. progress carries a phase (auth, throttled, retry, pagination, circuit) and an attempt; drift carries leveled findings — including the warn/info ones that never throw; then exactly one terminal result or error, then done. This is the one source every cross-cutting feature reports through, and exactly what a trace sink consumes.

See also

On this page