Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/live/deps.ts>WorkflowContext

Open-Source web editor based on Preact, Tailwind and TypeScript. The other side of code.
Go to Latest
class WorkflowContext
Re-export
import { WorkflowContext } from "https://deno.land/x/live@1.57.22/deps.ts";

WorkflowContext is used for providing api access to the workflow engine.

Constructors

new
WorkflowContext(execution: WorkflowExecution<Arg, unknown, TMetadata>)

Type Parameters

optional
TMetadata extends Metadata = Metadata

Properties

private
rand: () => number

Methods

_experimentalWaitAll(commands: AwaitableCommands[]): WaitAllCommand

UNDER TEST, wait all has a bug where the items where delivered out of the order. Wait until all commands has completed and return an array of results.

callActivity<TArgs extends Arg = Arg, TResult = unknown>(activity: Activity<TArgs, TResult>, ...input: [...TArgs]): ScheduleActivityCommand<TArgs, TResult>

Executes the activity for the given context and args.

callLocalActivity<TResult = unknown>(activity: () => PromiseOrValue<TResult>): LocalActivityCommand<TResult>

Executes the activity for the given context and args.

fetch(
url: string,
options?: { body?: string; headers?: Record<string, string>; method?: string; },
format?: InvokeHttpEndpointCommand["responseFormat"],
): InvokeHttpEndpointCommand

Executes the http request for the given context and args.

log(message: any, ...optionalParams: any[]): LocalActivityCommand

Logs at least once with additional workflow information

random(): number

Returns a random consistent with the given workflow execution

sendSignal(
executionId: string,
_signal: string,
payload: unknown,
): LocalActivityCommand

Send a signal for the given workflow execution

sleep(sleepMs: number): SleepCommand

stop the current workflow execution and sleep the given miliseconds time.

sleepUntil(until: Date): SleepCommand

stops the current workflow execution and sleep until the given date.

Start a new workflow execution

waitAny(commands: AwaitableCommands[]): WaitAnyCommand

Wait until any of commands has completed and return its result.

waitForSignal(signal: string): WaitForSignalCommand

waitForSignal wait for the given signal to be occurred.