ReferencePackages
@mwillbanks/tuil-operations
Observable asynchronous operations, progress, retries, rollback, and cancellation for tuil.
Overview
Observable asynchronous operations, progress, retries, rollback, and cancellation for tuil.
@mwillbanks/tuil-operations is independently installable and also participates in the
umbrella @mwillbanks/tuil runtime where applicable.
Installation
npm install @mwillbanks/tuil-operationsHow it operates
Operation executors track progress, retries, cancellation, timeouts, dependencies, rollback, logs, and immutable observable snapshots.
API
| API | Signature | Description |
|---|---|---|
createOperation | function createOperation | Public function createOperation. |
defineOperation | function defineOperation | Public function defineOperation. |
OperationBlockedError | class OperationBlockedError | Public class OperationBlockedError. |
OperationContext | interface OperationContext | Public interface OperationContext. |
OperationDefinition | interface OperationDefinition | Public interface OperationDefinition. |
OperationError | interface OperationError | Public interface OperationError. |
OperationEvent | interface OperationEvent | Public interface OperationEvent. |
OperationExecutor | class OperationExecutor | Public class OperationExecutor. |
OperationExecutorOptions | interface OperationExecutorOptions | Public interface OperationExecutorOptions. |
OperationFeedback | type OperationFeedback | Public type OperationFeedback. |
operationFeedbackDelays | constant operationFeedbackDelays | Public constant operationFeedbackDelays. |
OperationProgress | interface OperationProgress | Public interface OperationProgress. |
OperationSnapshot | interface OperationSnapshot | Public interface OperationSnapshot. |
OperationStatus | type OperationStatus | Public type OperationStatus. |
OperationTimeoutError | class OperationTimeoutError | Public class OperationTimeoutError. |
resolveOperationFeedback | function resolveOperationFeedback | Public function resolveOperationFeedback. |
Events and lifecycle
Executors expose snapshot subscriptions and operation progress rather than stringly typed global events.
All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.
Example
import { defineOperation } from "@mwillbanks/tuil-operations";
const operation = defineOperation({ id: "build", run: async ({ progress }) => progress(1) });