Skip to content
Trigora
Start building →

TypeScript

@trigora/sdk is how you build Programs for Trigora. It is not the engine embed API. Declare which files to compile in trigora.toml.

import { effect, waitForEvent } from "@trigora/sdk";
export default async function approval() {
const result = await effect("generate", () => 42);
const review = await waitForEvent("approved");
return { result, review };
}
  • A default-export async function. Parameters are plain identifiers. A missing or undefined argument uses a call-time default that may read earlier parameters, otherwise it is undefined. Extra arguments are ignored. Explicit null stays null. The program id is the export name, or the file stem when the export is anonymous. See Programs.
  • effect, waitForEvent, sleep, invoke, and execution.id / execution.attempt / execution.programId / execution.signal. Durable operations stay in the program entry.
  • String-literal effect keys and event names.
  • Ordinary computation between durable operations, including objects, arrays, helpers, and one-level destructuring. Defaults on those helpers run at the call and may use earlier parameters. See Supported language semantics.
  • Direct await Promise.all([...]) and await Promise.race([...]), including return await and an outer use such as format(await Promise.all([...])). The argument is a fixed array literal of 1–32 effect, waitForEvent, sleep, or invoke calls. See Structured concurrency.
  • A rest parameter, a binding pattern, or optional ? on the entry.
  • A stored promise (const pending = Promise.all([...]); await pending), return Promise.all([...]) or return Promise.race([...]) without await, spread, a dynamic array, .then, Promise.any, and Promise.allSettled.
  • effect(fn) without a name.
  • Running the file with node or tsx. That throws. Use trigora dev or Cloud.
  • Any construct outside ts.subset.v1. The compiler reports these constructs before the Program can run.

Python and Rust are supported as well. More authoring languages are planned. See Unsupported constructs for the current language boundaries.

Webhook helpers at @trigora/sdk/stripe and @trigora/sdk/github verify request signatures. They neither create durable operations nor configure Trigora triggers.

See Supported language semantics and Limits.