interface BridgeOperation<TResult = void, TFailure = never> A recoverable command execution identified by its request id (the protocol's operation id). Its statuses carry contract, the View's operation contract {view}:{fingerprint}, and requestId.
Properties
requestId
readonly requestId: string; No documentation.
completion
readonly completion: Promise<BridgeOperationStatus<TResult, TFailure>>; The terminal status. A failed observation is retried by the next read.
Methods
status
status(): Promise<BridgeOperationStatus<TResult, TFailure>>; Reads the current status. A terminal status resolves once the View's state includes the operation's effects.
subscribe
subscribe(listener: (status: BridgeOperationStatus<TResult, TFailure>) => void): () => void; Calls listener with each status the client observes, such as running with a new progress and the terminal status, until the returned function is called. A subscription watches the operation on the producer, which pushes its changes; the watch ends with the terminal status or when the last observer leaves. A terminal status is delivered once the View's state includes the operation's effects. A listener that throws is reported and does not stop delivery to others.
wait
wait(options?: BridgeOperationWaitOptions): Promise<BridgeOperationStatus<TResult, TFailure>>; Waits for the terminal status, which the producer pushes to a watch. It resolves once the View's state includes the operation's effects. With timeout, resolves to a timed-out status after cancelling the operation, unless it finished first. With signal, rejects with its abort reason when it aborts first.
outcome
outcome(options?: BridgeOperationWaitOptions): Promise<BridgeOutcome<TResult, TFailure>>; Waits like wait() and resolves to the result, or to the declared failure. Rejects with BridgeError for failed (failed), cancelled (cancelled), timed-out (timeout) and a result or failure that could not be delivered (failed), and with BridgeOperationUncertainError for expired and unknown: the outcome is unknown, so do not retry blindly. Rejects with the abort reason when signal aborts first.