TypeScript SDK
Import from @trigora/sdk. These functions throw outside an Execution. Program globs and triggers live in trigora.toml.
effect
Section titled “effect”function effect<T>(name: string, run: () => T | Promise<T>): Promise<T>Commits the outcome of run under name. Reused after commit. May run again if the outcome never committed. Empty name throws. Details.
waitForEvent
Section titled “waitForEvent”function waitForEvent<TPayload>( eventOrName: EventDefinition<TPayload> | string, options?: { timeout?: string | number; match?: Record<string, unknown> },): Promise<TPayload>Suspends until trigora send delivers that event name. Returns the payload. Details.
function sleep(duration: string | number): Promise<void>Number of milliseconds, or a duration string. Prefer a number. Details.
invoke
Section titled “invoke”function invoke(program: string, ...args: unknown[]): Promise<unknown>Starts one child and returns its result. The values after the program id are the ordered argument vector. Details.
execution
Section titled “execution”execution.idexecution.attemptexecution.programIdexecution.signalReads the current Execution. signal is the cancellation signal for this attempt.
function event<TPayload>(name: string): EventDefinition<TPayload>Optional typed name for waitForEvent and send. A string works without it.