plugins/process/docs/dsl.md
Process DSL — context expressions
This document describes the small DSL used to reference parts of a process execution context and to apply "modifiers" (functions, source reducers, fallbacks) to those references. The implementation lives in src/dslContext.ts and the tests are at src/__tests__/dslContext.test.ts.
A DSL expression is always enclosed in ${...} when embedded. The parser and serializer in this package support converting between the typed SelectedContext objects and their compact DSL string.
Attribute: @<key> — references an attribute on the current object.
@nameNested attribute: @<refKey>.<attrKey> — follows a reference attribute to another object and takes its attribute.
@owner.idRelation: $relation(<associationRef>,<direction>,<key>,<name>)
$relation(my.assoc, A, id, title)Execution context: $context(<id>,<key>)
$context(12345, result)User request: $userRequest(<id>,<key>,<_class>)
$userRequest(123, value, MyClass)Const: #<value>,<key> — a literal value and a target key.
null/undefined, quoted strings and arrays are supported.#42,answer or #"hello",greeting or #[1,2,3],arrFunction as primary expression: =><funcRef>(<props...>)
=>myFunc(a=1,b="x")Modifiers always start with => and are appended after the main expression separated by spaces (at top-level). Examples:
=>SOURCE(<funcRef>,<props...>)=>FALLBACK(<props...>) or =>FALLBACK(<value>)=><funcRef>(<props...>)=> inside nested brackets, quotes and template expressions ${...}.(), arrays [], object braces {}, quoted strings (single/double) with escapes, and ${...} template blocks.simplifyFuncRef is used when serializing to shorten function references; expandFuncRef restores those during parsing.${@name} — attribute name${@owner.id =>MYFUNC(a=1) =>FALLBACK(10)} — nested attribute with a function modifier and a fallback${#"he\"llo",greet} — const string with escaped quote${=>COMPUTE(sum=1)} — function as primary expression