Expressions handler interface.
ExpressionsresolveExpression(expression[, context, fnContext]): resolve expressionisExpression(testString): optional function to evaluate if string is an expressionhasExpression(testString): optional function to evaluate if the string contains an expression
Resolve expression.
Arguments:
expression: expresion templated stringcontext: optional context from where to resolve expressionsfnContext: optional call context (this)
Evaluate if a string is an expression, and only an expression, e.g. ${environment.variables.supersecret}.
Evaluate if a string contains an expression, e.g. ${environment.variables.username}:${environment.variables.supersecret}.
Default expressions come in the form of ${<variables or services>.<property name>}.
The following expressions are supported:
-
${environment.variables.input}- resolves to the variable input -
${environment.variables.input[0]}- resolves to first item of the variable input array -
${environment.variables.input[-1]}- resolves to last item of the variable input array -
${environment.variables.input[spaced name]}- resolves to the variable input object propertyspaced name -
${environment.services.getInput}- resolves to the service functiongetInputitself (it is not called). The caller decides how to invoke it — e.g. a sequence flow condition calls it with the flow execution scope -
${environment.services.getInput()}- calls the service functiongetInput. Empty parentheses are not a no-argument call: the resolutioncontextis passed as the single argument, i.e.{ environment, ...message }(so the service can readarg.content,arg.environment, …) -
${environment.services.isBelow(content.input,2)}- calls the service functionisBelowwith the resolvedcontent.inputvalue and2 -
I, ${content.id}, execute with id ${content.executionId}- formats a string addressing content object values
and, as utility:
${true}- return Boolean valuetrue${false}- return Boolean valuefalse
Expressions in expressions is not supported and has unforeseeable outcome!
A far more advanced expression parser by Aircall.
npm i @aircall/expression-parser