The Falcon engine uses the @stackone/expressions library to evaluate dynamic values throughout connector YAML files. Three expression formats are available, each suited to different use cases.
Quick rule of thumb:
- JSONPath (
$.path) — Direct value access
- String Interpolation (
${...}) — Building strings/URLs
- JEXL (
'{{...}}') — Logic, conditions, and transformations
JSONPath Expressions
When an expression starts with $, it is treated as a JSONPath expression. Use this for direct data access without transformation.
Syntax
Available Contexts
Examples
For more details on JSONPath syntax, refer to the JSONPath specification.
String Interpolation
Use ${...} syntax to embed values within strings. This is the preferred method for building URLs, composing strings, and simple variable substitution.
Syntax
The content inside ${...} supports the same dot-notation paths as JSONPath but without the $ root prefix.
Examples
String interpolation only substitutes values — it does not support operators, conditionals, or function calls. Use JEXL expressions for logic.
JEXL Expressions
JEXL (JavaScript Expression Language) expressions are enclosed in double curly brackets {{expression}} and support variables, operators, functions, and conditional logic. In YAML, these must be wrapped in single quotes: '{{...}}'.
Operators
Arithmetic
Comparison
Logical
Special
Identifiers and Context Access
Access variables from the evaluation context using dot notation:
Collection Filtering
Filter arrays using bracket expressions:
Common Patterns in Connector YAML
Built-in Functions
The expression engine includes a set of built-in functions available in JEXL expressions.
Presence & Type Checking
present(value)
Returns true if the value is not null or undefined. This is the most commonly used function in connector YAML for conditional argument inclusion.
missing(value)
Returns true if the value is null or undefined. The inverse of present().
String Functions
capitalize(value, mode?)
Capitalizes characters in a string. By default capitalizes the first character; use 'each' mode to capitalize each word.
truncate(value, maxLength, suffix?)
Truncates a string to a maximum length, appending a suffix (default "...").
padStart(value, targetLength, padString?)
Pads the start of a string to reach a target length. Numbers are converted to strings automatically.
encodeBase64(value)
Encodes a string to Base64.
decodeBase64(value)
Decodes a Base64 string.
regexMatch(value, pattern, groupIndex?)
Extracts a value from a string using a regular expression. Returns the specified capture group (default: 1) or null if no match.
Similar to regexMatch but simplified for common extraction patterns.
Crypto Functions
sha256(value, encoding?)
Computes the SHA-256 hash of a string. Useful for request signing and content verification.
value (string): The string to hash
encoding (string, optional): 'hex' (default) or 'base64'
- Returns: hash string, or empty string for invalid input
hmacSha256(value, key, encoding?)
Computes an HMAC-SHA256 signature using a secret key. Used for webhook signature verification and API request signing.
value (string): The string to sign
key (string): The secret key
encoding (string, optional): 'hex' (default) or 'base64'
- Returns: HMAC digest, or empty string for invalid input
md5(value, encoding?)
Computes the MD5 hash of a string.
value (string): The string to hash
encoding (string, optional): 'hex' (default) or 'base64'
- Returns: hash string, or empty string for invalid input
Array Functions
includes(array, value)
Checks if an array includes a value. If value is an array, checks that ALL values are included.
includesSome(array, value)
Checks if an array includes AT LEAST ONE of the given values.
dedupe(array)
Removes duplicate entries from an array, preserving order. Works with primitives and objects (compared by content with sorted keys).
join(array, separator?)
Joins array elements into a string with a separator (default: ","). Filters out null/undefined values.
reduce(array, operation, field?)
Applies an aggregate operation to an array. When field is specified, that field is extracted from each object before applying the operation.
Supported operations:
Object Functions
keys(object)
Returns the keys of an object as an array. Returns empty array for non-objects.
values(object)
Returns the values of an object as an array. Returns empty array for non-objects.
zipObject(keys, values)
Combines two parallel arrays into an object by pairing keys[i] with values[i]. If the arrays are different lengths, extra elements from the longer array are ignored. Non-string keys are skipped. Returns {} if either input is missing or not an array.
groupBy(array, key)
Array utility that groups items but returns an object result; it’s documented here alongside object helpers for convenience (see the Array Functions section for related utilities). Groups an array of objects by the value of a specified key, producing an object where each unique key value maps to an array of matching items. Items without the key or with a null/undefined value for that key are collected under "__missing__". Returns {} if the input is missing, not an array, or the key is not a string.
Date Functions
now()
Returns the current date/time in ISO 8601 format.
Calculates the number of complete years between two dates. If endDate is omitted, uses today.
Checks whether a date (optionally with years added) has already passed.
Calculates the next anniversary of a date.
Calculates milliseconds between a date and now. Supports ISO strings (default), Unix timestamps ('timestamp'), and seconds ('seconds').
Expression Selection Guide
Choosing the right expression format depends on the context:
Do not mix expression formats within a single value. Use one format per field:
- Correct:
value: '{{$.inputs.limit ?? 25}}'
- Incorrect:
value: '$.inputs.limit ?? 25'
Validation and Error Handling
isValidExpression(expression)
The expression engine validates syntax before evaluation. Invalid expressions return errors that help identify issues.
Incremental JSONPath Errors
When using the expression engine with incrementalJsonPath: true, detailed error messages are provided for JSON Path evaluation failures:
This is used internally by StackOne Agent for self-repair during connector development.
Safe Evaluation
The safeEvaluate function returns null instead of throwing errors, which is useful for optional expressions and fallback patterns.