Trigger action
A Trigger action is the code that runs when one Event fires, named for its Noun and Event.
| Property | Value |
|---|---|
| Path | workflows/ |
| Holds | Trigger |
| Kind | file |
| Leaders | db-first, git-first |
| Team | Engineering Team |
| Written by | Change.merge |
| Compiled by | StartupBuilder |
Example
workflows/ in a Startup repository. Closewise, a sample business, declares a Close Noun.
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
on.Noun.event(handler: (thing: Noun, $: $) => Promise<unknown>): TriggerGenerates
StartupBuilder compiles it into these records, Verbs and routes.