Member Junction
    Preparing search index...

    A per-key serial task chain. Tasks for the same key (compared by object identity) run one at a time in enqueue order; tasks for different keys run concurrently. Enqueuing is fire-and-forget — the returned promise never rejects, and failures are tallied for flush.

    This is what makes "mutate after the prior task lands" structural: a task enqueued after another on the same key physically cannot begin until the prior one resolves.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Enqueues task to run after all prior tasks for key have settled. Fire-and-forget: returns the task's result promise, but the caller need not await it — it resolves to the task's value on success or undefined on failure, and never rejects. Failures (a thrown error, or a resolved value opts.isOk deems falsy) are counted for flush and routed to onError.

      Type Parameters

      • T

      Parameters

      • key: object

        Serialization key (object identity). Same key → serialized; different keys → concurrent.

      • task: () => Promise<T>

        The work to run.

      • Optionalopts: { after?: object; isOk?: (v: T) => boolean; label?: string }
        • Optionalafter?: object

          Optional dependency key — the task waits for this key's latest task to settle before running, in addition to waiting for its own key's prior tasks. Use this to honour cross-instance ordering constraints like self-referencing foreign keys (e.g. a child step's INSERT must land after its parent step's INSERT).

        • OptionalisOk?: (v: T) => boolean

          Treats a resolved value as a failure when it returns false (e.g. Save()false).

        • Optionallabel?: string

          Diagnostic label passed to onError.

      Returns Promise<T | undefined>