ObjectStackObjectStack

Assignment Rule — Automation Protocol

Assignment Rule schemas of the ObjectStack Automation Protocol: AssignmentRule and 3 more — each property with its type, default and a TypeScript example.

Source: packages/spec/src/automation/assignment-rule.zod.ts

TypeScript Usage

import { AssignmentRuleSchema, AssignmentRuleEntrySchema, AssignmentStrategy, AssignmentTargetSchema } from '@objectstack/spec/automation';
import type { AssignmentRule, AssignmentRuleEntry, AssignmentStrategy, AssignmentTarget } from '@objectstack/spec/automation';

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

AssignmentRule

Properties

PropertyTypeRequiredDescription
namestring✅Rule machine name (lowercase snake_case)
labelstringoptionalDisplay label
descriptionstringoptionalAdministrative notes
objectstring✅The object whose inserted rows the rule routes (an ownership: user object)
activebooleanoptional (default: true)Whether the rule is evaluated
entries{ name: string; criteria?: string | object; assignTo: object; strategy?: Enum<'round_robin' | 'least_loaded'>; … }[]✅Ordered entries; the first whose criteria match the inserted row decides where it goes
_lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>optionalItem-level lock — controls overlay & delete (ADR-0010).
_lockReasonstringoptionalHuman-readable reason shown when a write is refused by _lock.
_lockSourceEnum<'artifact' | 'package' | 'env-forced'>optionalLayer that set _lock (artifact | package | env-forced).
_provenanceEnum<'package' | 'org' | 'env-forced'>optionalOrigin of the item (package | org | env-forced).
_packageIdstringoptionalOwning package machine id.
_packageVersionstringoptionalOwning package version.
_lockDocsUrlstringoptionalOptional documentation link surfaced next to _lockReason.

Nested Shape: AssignmentRule.entries[number]

PropertyTypeRequiredDescription
namestring✅Entry machine name, unique within the rule (the round-robin cursor is kept per entry)
criteriastring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }optionalCEL over record.*, interpreted against the row being inserted (it is not stored yet). Absent = every row.
assignTo{ type: Enum<'queue' | 'user'>; value: string }✅Where a matching row goes: a queue or one user
strategyEnum<'round_robin' | 'least_loaded'>optionalHow one member of the target queue is chosen: 'round_robin' or 'least_loaded'. Only with a queue target; absent = the row parks in the queue for a member to claim.
loadstring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }optionalRequired with 'least_loaded', refused otherwise: a CEL pushdown predicate over the object naming the rows that count as a member's open load (e.g. record.status != "closed"). There is no platform default, because what is open differs per object.

AssignmentRuleEntry

Properties

PropertyTypeRequiredDescription
namestring✅Entry machine name, unique within the rule (the round-robin cursor is kept per entry)
criteriastring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }optionalCEL over record.*, interpreted against the row being inserted (it is not stored yet). Absent = every row.
assignTo{ type: Enum<'queue' | 'user'>; value: string }✅Where a matching row goes: a queue or one user
strategyEnum<'round_robin' | 'least_loaded'>optionalHow one member of the target queue is chosen: 'round_robin' or 'least_loaded'. Only with a queue target; absent = the row parks in the queue for a member to claim.
loadstring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }optionalRequired with 'least_loaded', refused otherwise: a CEL pushdown predicate over the object naming the rows that count as a member's open load (e.g. record.status != "closed"). There is no platform default, because what is open differs per object.

Nested Shape: AssignmentRuleEntry.assignTo

PropertyTypeRequiredDescription
typeEnum<'queue' | 'user'>✅'queue' routes into a queue (by machine name); 'user' names one owner (by id)
valuestring✅The queue machine name, or the user id

AssignmentStrategy

Allowed Values

  • round_robin
  • least_loaded

AssignmentTarget

Properties

PropertyTypeRequiredDescription
typeEnum<'queue' | 'user'>✅'queue' routes into a queue (by machine name); 'user' names one owner (by id)
valuestring✅The queue machine name, or the user id

On this page