import { workflowInfo } from './workflowInfo'; import { didRun } from './didRun'; import { isSideEffectAllowed } from './isSideEffectAllowed'; import { trace } from './trace'; import { enrich } from './enrich'; import { emit } from './emit'; import { executeChild, startChild } from './executeChild'; import { execHook } from './execHook'; import { execHookBatch } from './execHookBatch'; import { proxyActivities } from './proxyActivities'; import { search } from './searchMethods'; import { random } from './random'; import { uuid4 } from './uuid4'; import { signal } from './signal'; import { hook } from './hook'; import { terminate } from './terminate'; import { didInterrupt } from './interruption'; import { all } from './all'; import { sleep } from './sleep'; import { condition } from './condition'; import { continueAsNew } from './continueAsNew'; import { patched, deprecatePatch } from './patched'; import { CancellationScope, CancelledFailure, isCancellation } from './cancellationScope'; import { HotMesh } from './common'; import { entity } from './entityMethods'; /** * In-workflow API surface, exposed as `Durable.workflow`. Every method * is called **inside** a workflow function and participates in * deterministic replay — results are persisted and returned instantly * on recovery without re-executing side effects. * * ## Primitives * * | Method | Purpose | * |--------|---------| * | {@link proxyActivities} | Execute activities with automatic retry | * | {@link sleep} | Durable timer (survives restarts) | * | {@link condition} | Pause until a named signal arrives (optional timeout) | * | {@link signal} | Deliver data to a waiting `condition` | * | {@link executeChild} | Spawn a child workflow and await its result | * | {@link startChild} | Fire-and-forget child workflow | * | {@link continueAsNew} | Restart with new args (resets history) | * | {@link patched} / {@link deprecatePatch} | Safe versioning for in-flight code changes | * | {@link CancellationScope} | Shield cleanup code from cancellation | * | {@link isCancellation} | Detect `CancelledFailure` errors | * * ## Utilities * * | Method | Purpose | * |--------|---------| * | {@link workflowInfo} | Access workflow ID, namespace, replay state | * | {@link random} | Deterministic pseudo-random numbers | * | {@link uuid4} | Deterministic UUID v4 generation | * | {@link all} | Workflow-safe `Promise.all` | * | {@link didInterrupt} | Detect engine control-flow errors | * * ## Example * * ```typescript * import { Durable } from '@hotmeshio/hotmesh'; * import * as activities from './activities'; * * export async function orderWorkflow(orderId: string): Promise { * const { validateOrder, processPayment, sendReceipt } = * Durable.workflow.proxyActivities({ * activities, * retry: { maximumAttempts: 3 }, * }); * * await validateOrder(orderId); * await Durable.workflow.sleep('5 seconds'); * const receipt = await processPayment(orderId); * * // Wait for external approval signal (with 1-hour timeout) * const approval = await Durable.workflow.condition<{ ok: boolean }>('approve', '1 hour'); * if (!approval) return 'timed-out'; * if (!approval.ok) return 'rejected'; * * await sendReceipt(orderId, receipt); * return receipt; * } * ``` */ export declare class WorkflowService { /** * @private * The constructor is private to prevent instantiation; * all methods are static. */ private constructor(); static workflowInfo: typeof workflowInfo; static didRun: typeof didRun; static isSideEffectAllowed: typeof isSideEffectAllowed; static trace: typeof trace; static enrich: typeof enrich; static emit: typeof emit; static executeChild: typeof executeChild; static startChild: typeof startChild; static execHook: typeof execHook; static execHookBatch: typeof execHookBatch; static proxyActivities: typeof proxyActivities; static search: typeof search; static entity: typeof entity; static random: typeof random; static uuid4: typeof uuid4; static signal: typeof signal; static hook: typeof hook; static didInterrupt: typeof didInterrupt; static terminate: typeof terminate; static all: typeof all; static sleep: typeof sleep; static condition: typeof condition; static continueAsNew: typeof continueAsNew; static patched: typeof patched; static deprecatePatch: typeof deprecatePatch; static CancellationScope: typeof CancellationScope; static CancelledFailure: typeof CancelledFailure; static isCancellation: typeof isCancellation; /** * Return a handle to the HotMesh client hosting the workflow execution. * @returns {Promise} The HotMesh client instance. */ static getHotMesh(): Promise; }