OperationDefinition
interface exported by @mwillbanks/tuil-operations.
interface
Public interface exported by @mwillbanks/tuil-operations.
export interface OperationDefinition<TResult = unknown> {
readonly id: string;
readonly title: string;
readonly description?: string;
readonly metadata?: Readonly<Record<string, unknown>>;
readonly retries?: number;
readonly retryDelay?: number;
readonly timeout?: number;
readonly run: (context: OperationContext) => TResult | Promise<TResult>;
readonly rollback?: OperationRollback<TResult>;
}Members
| Member | Type | Required | Description | Related types |
|---|---|---|---|---|
id | string | Yes | The id member uses the string contract. | — |
title | string | Yes | The title member uses the string contract. | — |
description | string | undefined | No | The description member uses the string | undefined contract. | — |
metadata | Readonly<Record<string, unknown>> | undefined | No | The metadata member uses the Readonly<Record<string, unknown>> | undefined contract. | — |
retries | number | undefined | No | The retries member uses the number | undefined contract. | — |
retryDelay | number | undefined | No | The retryDelay member uses the number | undefined contract. | — |
timeout | number | undefined | No | The timeout member uses the number | undefined contract. | — |
run | (context: OperationContext) => TResult | Promise<TResult> | Yes | The run member uses the (context: OperationContext) => TResult | Promise<TResult> contract. | OperationContext |
rollback | ((result: TResult | undefined, context: OperationContext) => void | Promise<void>) | undefined | No | The rollback member uses the ((result: TResult | undefined, context: OperationContext) => void | Promise<void>) | undefined contract. | OperationContext |
Parameters
This declaration has no public members.
Returns
This declaration does not return a value.
Throws
No thrown errors are documented for this declaration.
Related types
Source
View the secondary source reference