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 };}Supported syntax
Section titled “Supported syntax”- A default-export async function. Parameters are plain identifiers. A missing or
undefinedargument uses a call-time default that may read earlier parameters, otherwise it isundefined. Extra arguments are ignored. Explicitnullstaysnull. The program id is the export name, or the file stem when the export is anonymous. See Programs. effect,waitForEvent,sleep,invoke, andexecution.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([...])andawait Promise.race([...]), includingreturn awaitand an outer use such asformat(await Promise.all([...])). The argument is a fixed array literal of 1–32effect,waitForEvent,sleep, orinvokecalls. See Structured concurrency.
Unsupported syntax
Section titled “Unsupported syntax”- A rest parameter, a binding pattern, or optional
?on the entry. - A stored promise (
const pending = Promise.all([...]); await pending),return Promise.all([...])orreturn Promise.race([...])withoutawait, spread, a dynamic array,.then,Promise.any, andPromise.allSettled. effect(fn)without a name.- Running the file with
nodeortsx. That throws. Usetrigora devor Cloud. - Any construct outside
ts.subset.v1. The compiler reports these constructs before the Program can run.
Additional notes
Section titled “Additional notes”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.