Shared abort-signal utilities for the pipeline and runner.
Centralises the abort-check pattern so every call-site doesn't repeat
the DOMException construction.
Exports
throwIfAborted— Throw if signal is already aborted.isRunAborted— Check if a run has been aborted.finalizeRunIfNotAborted— Mark run as completed (unless aborted).
- Source:
Methods
(static) finalizeRunIfNotAborted(run, onCompleteopt)
Guard that marks a run as "completed" only if it wasn't already aborted,
then calls onComplete for site-specific logging / SSE emission.
Extracts the duplicated pattern: if (run.status !== "aborted") { run.status = "completed"; // …log summary, emit SSE done… }
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
run |
object | — mutable run record |
|
onComplete |
function |
<optional> |
— called (with no args) only when the run is actually completed (not aborted) |
- Source:
(static) isRunAborted(run, signalopt)
Returns true if the run has been aborted (either via run.status or signal).
Centralises the duplicated run.status !== "aborted" && !signal?.aborted
guard used across pipeline functions.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
run |
object | ||
signal |
AbortSignal | undefined | null |
<optional> |
- Source:
(static) throwIfAborted(signal)
Throws an AbortError if the signal has already been aborted. No-op when signal is null/undefined or not yet aborted.
Parameters:
| Name | Type | Description |
|---|---|---|
signal |
AbortSignal | undefined | null |
- Source: