@hotmeshio/hotmesh
Version:
Serverless Workflow
71 lines (70 loc) • 2.55 kB
TypeScript
import { getContext } from './context';
import { didRun } from './didRun';
import { isSideEffectAllowed } from './isSideEffectAllowed';
import { trace } from './trace';
import { enrich } from './enrich';
import { emit } from './emit';
import { execChild, startChild } from './execChild';
import { proxyActivities } from './proxyActivities';
import { search } from './searchMethods';
import { random } from './random';
import { signal } from './signal';
import { hook } from './hook';
import { interrupt } from './interrupt';
import { all } from './all';
import { sleepFor } from './sleepFor';
import { waitFor } from './waitFor';
import { HotMesh } from './common';
/**
* The WorkflowService class provides a set of static methods to be used within a workflow function.
* These methods ensure deterministic replay, persistence of state, and error handling across
* re-entrant workflow executions.
*
* By refactoring the original single-file implementation into submodules,
* we maintain clear separation of concerns and improved maintainability,
* while preserving type information and full functionality.
*
* @example
* ```typescript
* import { MeshFlow } from '@hotmeshio/hotmesh';
*
* export async function waitForExample(): Promise<[boolean, number]> {
* const [s1, s2] = await Promise.all([
* MeshFlow.workflow.waitFor<boolean>('my-sig-nal-1'),
* MeshFlow.workflow.waitFor<number>('my-sig-nal-2')
* ]);
* return [s1, s2];
* }
* ```
*/
export declare class WorkflowService {
/**
* @private
* The constructor is private to prevent instantiation;
* all methods are static.
*/
private constructor();
static getContext: typeof getContext;
static didRun: typeof didRun;
static isSideEffectAllowed: typeof isSideEffectAllowed;
static trace: typeof trace;
static enrich: typeof enrich;
static emit: typeof emit;
static execChild: typeof execChild;
static executeChild: typeof execChild;
static startChild: typeof startChild;
static proxyActivities: typeof proxyActivities;
static search: typeof search;
static random: typeof random;
static signal: typeof signal;
static hook: typeof hook;
static interrupt: typeof interrupt;
static all: typeof all;
static sleepFor: typeof sleepFor;
static waitFor: typeof waitFor;
/**
* Return a handle to the HotMesh client hosting the workflow execution.
* @returns {Promise<HotMesh>} The HotMesh client instance.
*/
static getHotMesh(): Promise<HotMesh>;
}