Skip to content
Alvo is pre-v0.1: the image runs from its edge tag, and no NuGet package or release is published yet.Pre-v0.1: no release yet.Roadmap and status

entities.hooks

Lifecycle hooks.

Guide: Before-hooks

The entities block spans these pages: entities · entities · fields · entities · computed & rollups · entities · rules · entities · hooks · entities · indexes.

Lifecycle hooks. before* = in-transaction, no network, may reject/mutate; after* = post-commit from the outbox.

  • Type: object
  • Required: no

Before-hooks, run in declaration order inside the write’s transaction: each may reject the write or mutate the row about to be written (mutate is refused on beforeDelete). No network access.

  • Type: array of object
  • Required: no

entities.<name>.hooks.beforeCreate[].condition

Section titled “entities.<name>.hooks.beforeCreate[].condition”

Condition in the CEL subset. Context: @user, @tenant; hooks/events additionally expose old, new, changed(field). Compiled fail-fast at apply time.

  • Type: string
  • Required: no

entities.<name>.hooks.beforeCreate[].action

Section titled “entities.<name>.hooks.beforeCreate[].action”

Before-actions run in-transaction: reject or mutate only. No network, no external calls.

  • Type: object
  • Required: yes

entities.<name>.hooks.beforeCreate[].action.reject

Section titled “entities.<name>.hooks.beforeCreate[].action.reject”

Cancels the operation; the text becomes the detail of the RFC 7807 error.

  • Type: string
  • Required: yes (in its variant)
  • Exactly one of reject, mutate.

entities.<name>.hooks.beforeCreate[].action.mutate

Section titled “entities.<name>.hooks.beforeCreate[].action.mutate”

Payload patch before write: field -> literal value or tagged {“$cel”: ”…”} expression.

  • Type: map of any
  • Required: yes (in its variant)
  • Exactly one of reject, mutate.
  • Each entry: A literal JSON value, or a tagged CEL expression object {“$cel”: ”…”}.

entities.<name>.hooks.beforeCreate[].action.mutate.<name>.$cel

Section titled “entities.<name>.hooks.beforeCreate[].action.mutate.<name>.$cel”

A CEL expression whose result becomes the value, in place of a JSON literal (e.g. now(), @user.id).

  • Type: string
  • Required: yes

Before-hooks, run in declaration order inside the write’s transaction: each may reject the write or mutate the row about to be written (mutate is refused on beforeDelete). No network access.

Before-hooks, run in declaration order inside the write’s transaction: each may reject the write or mutate the row about to be written (mutate is refused on beforeDelete). No network access.

After-hooks, delivered post-commit from the outbox with retries; a condition filters which writes trigger them.

  • Type: array of object
  • Required: no

entities.<name>.hooks.afterCreate[].condition

Section titled “entities.<name>.hooks.afterCreate[].condition”

Condition in the CEL subset. Context: @user, @tenant; hooks/events additionally expose old, new, changed(field). Compiled fail-fast at apply time.

  • Type: string
  • Required: no

entities.<name>.hooks.afterCreate[].action

Section titled “entities.<name>.hooks.afterCreate[].action”

After-side action (post-commit, durable, retries). Payload transformations = JSONata; {{…}} is sugar.

  • Type: object
  • Required: yes

entities.<name>.hooks.afterCreate[].action.type

Section titled “entities.<name>.hooks.afterCreate[].action.type”

Selects the variant.

  • Type: string
  • Required: yes
  • Values: "webhook", "email", "function", "entity.update", "http.call"

entities.<name>.hooks.afterCreate[].action.endpoint

Section titled “entities.<name>.hooks.afterCreate[].action.endpoint”

The name of an endpoint declared under the top-level webhooks.endpoints.

  • Type: string
  • Required: yes (in its variant)
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$
  • Only when type is "webhook".

entities.<name>.hooks.afterCreate[].action.payload

Section titled “entities.<name>.hooks.afterCreate[].action.payload”

Depends on the variant; see the notes below.

  • Type: string or map of any
  • Required: depends on the variant
  • Only when type is "webhook", "entity.update" or "http.call".
  • When type is "webhook" or "http.call": string, optional — JSONata transformation expression (JSON -> JSON). Runs strictly post-commit (after-side), with depth/time limits. {{…}} templates are syntactic sugar.
  • When type is "entity.update": map of any, required — Field -> literal value or tagged {“$cel”: ”…”} expression; {{…}} sugar allowed in string values. Each entry: A literal JSON value, or a tagged CEL expression object {“$cel”: ”…”}.
  • When type is "entity.update": Same shape as entities.<name>.hooks.beforeCreate[].action.mutate.<name>.

entities.<name>.hooks.afterCreate[].action.template

Section titled “entities.<name>.hooks.afterCreate[].action.template”

The name of a template declared in the top-level templates block.

  • Type: string
  • Required: yes (in its variant)
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$
  • Only when type is "email".

entities.<name>.hooks.afterCreate[].action.to

Section titled “entities.<name>.hooks.afterCreate[].action.to”

Address or a {{…}} template.

  • Type: string
  • Required: yes (in its variant)
  • Only when type is "email".

entities.<name>.hooks.afterCreate[].action.data

Section titled “entities.<name>.hooks.afterCreate[].action.data”

JSONata transformation expression (JSON -> JSON). Runs strictly post-commit (after-side), with depth/time limits. {{…}} templates are syntactic sugar.

  • Type: string
  • Required: no
  • Only when type is "email".

entities.<name>.hooks.afterCreate[].action.name

Section titled “entities.<name>.hooks.afterCreate[].action.name”

The name of a function declared in the top-level functions block.

  • Type: string
  • Required: yes (in its variant)
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$
  • Only when type is "function".

entities.<name>.hooks.afterCreate[].action.input

Section titled “entities.<name>.hooks.afterCreate[].action.input”

JSONata transformation expression (JSON -> JSON). Runs strictly post-commit (after-side), with depth/time limits. {{…}} templates are syntactic sugar.

  • Type: string
  • Required: no
  • Only when type is "function".

entities.<name>.hooks.afterCreate[].action.entity

Section titled “entities.<name>.hooks.afterCreate[].action.entity”

The entity whose record is created or updated.

  • Type: string
  • Required: yes (in its variant)
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$
  • Only when type is "entity.update".

entities.<name>.hooks.afterCreate[].action.recordId

Section titled “entities.<name>.hooks.afterCreate[].action.recordId”

Id or {{…}} template; omit to create a new record.

  • Type: string
  • Required: no
  • Only when type is "entity.update".

entities.<name>.hooks.afterCreate[].action.url

Section titled “entities.<name>.hooks.afterCreate[].action.url”

Absolute URL to call.

  • Type: string
  • Required: yes (in its variant)
  • Only when type is "http.call".

entities.<name>.hooks.afterCreate[].action.method

Section titled “entities.<name>.hooks.afterCreate[].action.method”

HTTP method.

  • Type: string
  • Required: no
  • Values: "GET", "POST", "PUT", "PATCH", "DELETE"
  • Default: "POST"
  • Only when type is "http.call".

entities.<name>.hooks.afterCreate[].action.headersSecretRef

Section titled “entities.<name>.hooks.afterCreate[].action.headersSecretRef”

Secret name in ISecretStore holding request headers (e.g. auth token); never the value itself.

  • Type: string
  • Required: no
  • Only when type is "http.call".

After-hooks, delivered post-commit from the outbox with retries; a condition filters which writes trigger them.

After-hooks, delivered post-commit from the outbox with retries; a condition filters which writes trigger them.