Skip to content

Trigger action

A Trigger action is the code that runs when one Event fires, named for its Noun and Event.

PropertyValue
Pathworkflows/[process]/[workflow].ts
HoldsTrigger
Kindfile
Leadersdb-first, git-first
TeamEngineering Team
Written byChange.merge
Compiled byStartupBuilder

Example

workflows/close/open-on-activation.ts in a Startup repository. Closewise, a sample business, declares a Close Noun.

workflows/close/open-on-activation.ts
on.Customer.activated(async (customer, $) => $.Close.create({ client: customer.$id, period: new Date().toISOString().slice(0, 7) }))

every.night(async ($) => {
  for await (const close of $.Close.list({ where: 'balanced = false' }).all()) await $.Close.reconcile({ close: close.$id, through: new Date().toISOString().slice(0, 10) })
})

Signature

TypeScript
on.Noun.event(handler: (thing: Noun, $: $) => Promise<unknown>): Trigger

Generates

StartupBuilder compiles it into these records, Verbs and routes.

KindWhat
RecordsWorkflow, Trigger, Action
VerbsNone.
RoutesNone.