ObjectStackObjectStack

Approval — Automation Protocol reference

Approval schemas of the ObjectStack Automation Protocol: ApprovalDecision and 5 more — each property with its type, default and a TypeScript example.

Source: packages/spec/src/automation/approval.zod.ts

TypeScript Usage

import { ApprovalDecision, ApprovalEscalationSchema, ApprovalNodeApproverSchema, ApprovalNodeConfigSchema, ApproverType, DecisionOutputDefSchema } from '@objectstack/spec/automation';
import type { ApprovalDecision, ApprovalEscalation, ApprovalNodeApprover, ApprovalNodeConfig, ApproverType, DecisionOutputDef } from '@objectstack/spec/automation';

// Validate data
const result = ApprovalDecision.parse(data);

ApprovalDecision

Allowed Values

  • approve
  • reject

ApprovalEscalation

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: true)Turns this step's deadline on or off. It is on by default once a deadline is set: switch it off to keep the settings without acting on them, or remove the escalation to drop the deadline altogether
timeoutHoursnumber✅How many hours a request may wait before the escalation runs. These are calendar (wall-clock) hours — nights, weekends and holidays count. The platform ships no business-hours calendar: a request opened at 17:00 on a Friday with 4 hours escalates at 21:00 that same Friday
actionEnum<'reassign' | 'auto_approve' | 'auto_reject' | 'notify'>optional (default: "notify")What happens when the deadline passes: hand the request to someone else, approve it, reject it, or notify someone (the default)
escalateTostringoptionalWho takes over or is notified when the deadline passes: usually a position, or a specific person. Write a position machine name or 'position:<name>', a user id or an email. A 'team:', 'department:', 'org_membership_level:' or 'role:' address is refused: no approver acts under one
notifySubmitterbooleanoptional (default: true)Tell the person who submitted the request when it escalates

ApprovalNodeApprover

Properties

PropertyTypeRequiredDescription
typeEnum<'manager' | 'position' | 'department' | 'team' | 'queue' | 'field' | 'expression' | 'org_membership_level' | 'role' | 'user'>✅How this step finds its approvers. Prefer a role in the organization (manager, position, department, team) over one named person, who may leave or not exist in another environment. A manager step only finds someone once an administrator has recorded each user's manager in the user directory; until then it finds nobody and the request follows the node's onEmptyApprovers policy. os lint reports that at authoring time as approval-approvers-may-resolve-empty, and os explain approval-approvers-may-resolve-empty carries the ways to fill the directory in and the full remedy; the Approvals guide states the same remedy in prose.
valuestringoptionalWho exactly, for the chosen type: the user, membership tier, position, team, department or queue, or the record field that holds the approver. Leave it empty for a manager step. For an expression step, write the CEL expression that returns the approvers; it may read current.*, trigger.* and vars.*.
resolveAsEnum<'user' | 'department' | 'position' | 'team'>optionalExpression steps only: what the expression's results name. By default each result is a person; choose departments, positions or teams to make all their members approvers.
groupstringoptionalGroup name for one-from-each-group sign-off: approvers with the same name form one group, and the step needs approval from every group (e.g. "legal", "finance"). Read only when approvers combine per group.
organizationstringoptionalLook this approver up in another organization of the same group instead of the request's own, for example a group CFO approving a plant's purchase order. Leave it empty to use the request's organization. Write $root for the top of the group, $parent for one level up, or an organization's slug.

ApprovalNodeConfig

Properties

PropertyTypeRequiredDescription
approvers{ type: Enum<'manager' | 'position' | 'department' | 'team' | 'queue' | 'field' | …>; value?: string; resolveAs?: Enum<'user' | 'department' | 'position' | 'team'>; group?: string; … }[]✅Who can approve this step
excludeSubmitterbooleanoptionalStops people approving their own requests: when on, whoever submitted the request is taken off this step's approvers, whichever way they were found. If that leaves no one, the request goes where the step's onEmptyApprovers policy sends it (the organization's administrators by default, or the backup approvers you name) and is never approved automatically; the approval record notes the reason. So 'auto_approve' cannot be chosen alongside this option. Off by default: the approvers stay as found.
behaviorEnum<'first_response' | 'unanimous' | 'quorum' | 'per_group'>optional (default: "first_response")How several approvers decide: the first answer wins (the default), everyone must approve, a minimum number must approve, or one from each group must approve. Any single rejection rejects the step
minApprovalsintegeroptionalHow many approvals this step needs: in total when a minimum number must approve, or from each group when one from each group signs off. Omitted ⇒ all resolvable approvers for quorum, 1 per group for per_group
lockRecordbooleanoptional (default: true)Stop anyone editing the record while it waits for this approval
approvalStatusFieldstringoptionalA field on the record that shows where its approval stands (pending, approved, rejected or recalled); make it read-only
onEmptyApproversEnum<'admin_rescue' | 'fail' | 'auto_approve' | 'fallback'>optional (default: "admin_rescue")What happens when this step finds no one to approve: by default the organization's administrators decide; you can instead name backup approvers, fail the step, or approve it automatically. 'admin_rescue' (default) opens the request on the administrators; 'fallback' opens it on fallbackApprovers instead, naming who decides; 'fail' fails the step; 'auto_approve' approves it with no one deciding
fallbackApprovers{ type: Enum<'manager' | 'position' | 'department' | 'team' | 'queue' | 'field' | …>; value?: string; resolveAs?: Enum<'user' | 'department' | 'position' | 'team'>; group?: string; … }[]optionalBackup approvers who decide when this step finds no one else. Read only when onEmptyApprovers is 'fallback'
decisionOutputs(string | { key: string; label?: string; type?: Enum<'text' | 'user' | 'department' | 'position' | 'team'>; multiple?: boolean; … })[]optionalExtra answers the approver gives with the decision, such as who approves a later step; later steps read them. Each entry is a plain name (a text box) or { key, type, multiple } to show a picker
escalation{ enabled?: boolean; timeoutHours: number; action?: Enum<'reassign' | 'auto_approve' | 'auto_reject' | 'notify'>; escalateTo?: string; … }optionalA deadline for this step, and what happens when it passes
maxRevisionsintegeroptional (default: 3)How many times a request can be sent back for changes before it is rejected automatically (0 turns send-back off)

Nested Shape: ApprovalNodeConfig.approvers[number]

PropertyTypeRequiredDescription
typeEnum<'manager' | 'position' | 'department' | 'team' | 'queue' | 'field' | …>✅How this step finds its approvers. Prefer a role in the organization (manager, position, department, team) over one named person, who may leave or not exist in another environment. A manager step only finds someone once an administrator has recorded each user's manager in the user directory; until then it finds nobody and the request follows the node's onEmptyApprovers policy. os lint reports that at authoring time as approval-approvers-may-resolve-empty, and os explain approval-approvers-may-resolve-empty carries the ways to fill the directory in and the full remedy; the Approvals guide states the same remedy in prose.
valuestringoptionalWho exactly, for the chosen type: the user, membership tier, position, team, department or queue, or the record field that holds the approver. Leave it empty for a manager step. For an expression step, write the CEL expression that returns the approvers; it may read current.*, trigger.* and vars.*.
resolveAsEnum<'user' | 'department' | 'position' | 'team'>optionalExpression steps only: what the expression's results name. By default each result is a person; choose departments, positions or teams to make all their members approvers.
groupstringoptionalGroup name for one-from-each-group sign-off: approvers with the same name form one group, and the step needs approval from every group (e.g. "legal", "finance"). Read only when approvers combine per group.
organizationstringoptionalLook this approver up in another organization of the same group instead of the request's own, for example a group CFO approving a plant's purchase order. Leave it empty to use the request's organization. Write $root for the top of the group, $parent for one level up, or an organization's slug.

Nested Shape: ApprovalNodeConfig.fallbackApprovers[number]

PropertyTypeRequiredDescription
typeEnum<'manager' | 'position' | 'department' | 'team' | 'queue' | 'field' | …>✅How this step finds its approvers. Prefer a role in the organization (manager, position, department, team) over one named person, who may leave or not exist in another environment. A manager step only finds someone once an administrator has recorded each user's manager in the user directory; until then it finds nobody and the request follows the node's onEmptyApprovers policy. os lint reports that at authoring time as approval-approvers-may-resolve-empty, and os explain approval-approvers-may-resolve-empty carries the ways to fill the directory in and the full remedy; the Approvals guide states the same remedy in prose.
valuestringoptionalWho exactly, for the chosen type: the user, membership tier, position, team, department or queue, or the record field that holds the approver. Leave it empty for a manager step. For an expression step, write the CEL expression that returns the approvers; it may read current.*, trigger.* and vars.*.
resolveAsEnum<'user' | 'department' | 'position' | 'team'>optionalExpression steps only: what the expression's results name. By default each result is a person; choose departments, positions or teams to make all their members approvers.
groupstringoptionalGroup name for one-from-each-group sign-off: approvers with the same name form one group, and the step needs approval from every group (e.g. "legal", "finance"). Read only when approvers combine per group.
organizationstringoptionalLook this approver up in another organization of the same group instead of the request's own, for example a group CFO approving a plant's purchase order. Leave it empty to use the request's organization. Write $root for the top of the group, $parent for one level up, or an organization's slug.

Nested Shape: ApprovalNodeConfig.decisionOutputs[number]

PropertyTypeRequiredDescription
keystring✅Name of the answer the approver fills in; later steps read it as a flow variable under this step's id
labelstringoptionalField label in the decision dialog
typeEnum<'text' | 'user' | 'department' | 'position' | 'team'>optionalWhat the approver answers with: free text (the default), or a picker of users, departments, positions or teams. The user, department and team pickers store record ids; the position picker stores position machine names
multiplebooleanoptionalLet the approver pick more than one value (stored as a list)
requiredbooleanoptionalThe approver must fill this in to approve; a rejection never needs it

Nested Shape: ApprovalNodeConfig.escalation

PropertyTypeRequiredDescription
enabledbooleanoptional (default: true)Turns this step's deadline on or off. It is on by default once a deadline is set: switch it off to keep the settings without acting on them, or remove the escalation to drop the deadline altogether
timeoutHoursnumber✅How many hours a request may wait before the escalation runs. These are calendar (wall-clock) hours — nights, weekends and holidays count. The platform ships no business-hours calendar: a request opened at 17:00 on a Friday with 4 hours escalates at 21:00 that same Friday
actionEnum<'reassign' | 'auto_approve' | 'auto_reject' | 'notify'>optional (default: "notify")What happens when the deadline passes: hand the request to someone else, approve it, reject it, or notify someone (the default)
escalateTostringoptionalWho takes over or is notified when the deadline passes: usually a position, or a specific person. Write a position machine name or 'position:<name>', a user id or an email. A 'team:', 'department:', 'org_membership_level:' or 'role:' address is refused: no approver acts under one
notifySubmitterbooleanoptional (default: true)Tell the person who submitted the request when it escalates

ApproverType

How this step finds its approvers. Prefer a role in the organization (manager, position, department, team) over one named person, who may leave or not exist in another environment. A manager step only finds someone once an administrator has recorded each user's manager in the user directory; until then it finds nobody and the request follows the node's onEmptyApprovers policy. os lint reports that at authoring time as approval-approvers-may-resolve-empty, and os explain approval-approvers-may-resolve-empty carries the ways to fill the directory in and the full remedy; the Approvals guide states the same remedy in prose.

Allowed Values

  • manager
  • position
  • department
  • team
  • queue
  • field
  • expression
  • org_membership_level
  • role
  • user

DecisionOutputDef

Properties

PropertyTypeRequiredDescription
keystring✅Name of the answer the approver fills in; later steps read it as a flow variable under this step's id
labelstringoptionalField label in the decision dialog
typeEnum<'text' | 'user' | 'department' | 'position' | 'team'>optionalWhat the approver answers with: free text (the default), or a picker of users, departments, positions or teams. The user, department and team pickers store record ids; the position picker stores position machine names
multiplebooleanoptionalLet the approver pick more than one value (stored as a list)
requiredbooleanoptionalThe approver must fill this in to approve; a rejection never needs it

On this page