EventBuilder
Declares an Event’s payload, Listeners, child Events and schedules.
Remarks
Section titled “Remarks”The payload is declared with the InputBuilder methods this interface exposes, such as
addProperty. Registering a Listener declares behavior; the Runtime executes it when the Event
is published or invoked immediately.
- TemplateBuilder.addEvent and AppBuilder.addEvent for declaring Events
- Events
- EventDefinition for the emitted Definition
- WriteEventPublishInstance for publishing the Event
Extends
Section titled “Extends”BaseBuilder.Omit<InputBuilder,"toDefinition">
Properties
Section titled “Properties”children
Section titled “children”
readonlychildren:EventBuilder[]
Events this Event’s Listeners may publish, in the order they were added.
readonlyinput:InputBuilder
Payload declaration of the Event.
readonlykey:string
Event key within its Template, Union or App.
readonlyprn:string
Platform Resource Name of the declared resource, derived from the App key and resource key.
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”addArray()
Section titled “addArray()”addArray(
key):ArrayInputBuilder
Declares an array value; declare its element type on the returned builder.
Parameters
Section titled “Parameters”string
Input key.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”addChildEvent()
Section titled “addChildEvent()”addChildEvent(
event):this
Declares an Event that this Event’s Listeners may publish.
Parameters
Section titled “Parameters”EventBuilder
Event that Listeners of this Event publish.
Returns
Section titled “Returns”this
This builder for chaining.
Remarks
Section titled “Remarks”Declared children let the Builder reject cycles at build time; the Runtime separately bounds the depth of Event chains. Adding the same child twice adds it once.
Throws
Section titled “Throws”When adding event would create a cycle of declared child Events.
Example
Section titled “Example”Declaring a follow-up Event
const refresh = app.addEvent('refresh');const refreshed = app.addEvent('refreshed');refresh.addChildEvent(refreshed);addJson()
Section titled “addJson()”addJson(
key,parser):JsonInputBuilder
Declares a JSON value parsed by a Zod type or parse function.
Parameters
Section titled “Parameters”string
Input key.
parser
Section titled “parser”ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | JsonParse<any>
Zod type or parse function that parses the value.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”addListener()
Section titled “addListener()”addListener(
key,handler):EventListenerBuilder
Registers a Listener that the Runtime runs when this Event is processed.
Parameters
Section titled “Parameters”string
Listener key within the Event.
handler
Section titled “handler”Listener to run.
Returns
Section titled “Returns”The Listener builder.
Remarks
Section titled “Remarks”The Listener receives the Event, the target Item, the declaring App as current and a write
context as ctx. Execution and failure semantics depend on whether the Event was published
or invoked immediately.
- EventListener for the handler signature
- Handle events
addObject()
Section titled “addObject()”addObject(
key):ObjectInputBuilder
Declares a nested object value; declare its members on the returned builder.
Parameters
Section titled “Parameters”string
Input key.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”addProperty()
Section titled “addProperty()”Call Signature
Section titled “Call Signature”addProperty(
key,type):DataTypeInputBuilder
Declares a primitive or temporal value such as 'id', 'string' or 'date'.
Parameters
Section titled “Parameters”string
Input key.
PrimitiveDataType | TemporalDataType
Data type of the value.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”addProperty(
key,type,options?):SelectInputBuilder
Declares a single-select or multi-select value; declare its options on the returned builder,
or resolve them from a well-known format via options.format.
Parameters
Section titled “Parameters”string
Input key.
Select data type.
options?
Section titled “options?”Select options, such as the format the options are resolved from.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”addProperty(
key,type):JsonInputBuilder
Declares a JSON value parsed by a Zod type.
Parameters
Section titled “Parameters”string
Input key.
ZodType
Zod type of the value.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”addProperty(
key,type,options?):JsonInputBuilder
Declares a value of any supported type and returns the matching builder.
Parameters
Section titled “Parameters”string
Input key.
PrimitiveDataType | TemporalDataType | SelectDataType | ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>
Data type name or Zod type.
options?
Section titled “options?”Select options, only applicable to a select data type.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”addSchedule()
Section titled “addSchedule()”addSchedule(
key,crontab):EventSchedulerBuilder
Publishes this Event on a crontab schedule.
Parameters
Section titled “Parameters”string
Schedule key within the Event.
crontab
Section titled “crontab”string
Crontab expression in the five-part Unix format.
Returns
Section titled “Returns”The schedule builder.
Remarks
Section titled “Remarks”The crontab uses the standard five-part Unix format. An App-level Event is published against the Workspace Item; a Template Event is published against every active Item of the Template, or only Items in the states given with EventSchedulerBuilder.state. Schedules run on a best-effort basis: precise timing is not guaranteed and ticks of frequent schedules may be skipped.
Example
Section titled “Example”A daily schedule
leaveExpiryDue.addSchedule('daily', '30 2 * * *');setDescription()
Section titled “setDescription()”setDescription(
description):this
Sets the description emitted into the definition and rendered in generated reference and application assets.
Parameters
Section titled “Parameters”description
Section titled “description”string
Human-readable description of the resource.
Returns
Section titled “Returns”this
This builder for chaining.
Inherited from
Section titled “Inherited from”toDefinition()
Section titled “toDefinition()”toDefinition():
EventDefinition
Emits the Definition of this Event, including its payload, Listeners, child Event PRNs and schedules.

