tuil
ReferencePackages

@mwillbanks/tuil-operations

Observable asynchronous operations, progress, retries, rollback, and cancellation for tuil.

View rawEdit

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-operations

How it operates

Operation executors track progress, retries, cancellation, timeouts, dependencies, rollback, logs, and immutable observable snapshots.

Documentation flow diagram. idle; running; succeeded | failed | cancelled; optional rollback; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. idle; running; succeeded | failed | cancelled; optional rollback; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
createOperationfunction createOperationPublic function createOperation.
defineOperationfunction defineOperationPublic function defineOperation.
OperationBlockedErrorclass OperationBlockedErrorPublic class OperationBlockedError.
OperationContextinterface OperationContextPublic interface OperationContext.
OperationDefinitioninterface OperationDefinitionPublic interface OperationDefinition.
OperationErrorinterface OperationErrorPublic interface OperationError.
OperationEventinterface OperationEventPublic interface OperationEvent.
OperationExecutorclass OperationExecutorPublic class OperationExecutor.
OperationExecutorOptionsinterface OperationExecutorOptionsPublic interface OperationExecutorOptions.
OperationFeedbacktype OperationFeedbackPublic type OperationFeedback.
operationFeedbackDelaysconstant operationFeedbackDelaysPublic constant operationFeedbackDelays.
OperationProgressinterface OperationProgressPublic interface OperationProgress.
OperationSnapshotinterface OperationSnapshotPublic interface OperationSnapshot.
OperationStatustype OperationStatusPublic type OperationStatus.
OperationTimeoutErrorclass OperationTimeoutErrorPublic class OperationTimeoutError.
resolveOperationFeedbackfunction resolveOperationFeedbackPublic 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) });

On this page