Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.frontic.com/llms.txt

Use this file to discover all available pages before exploring further.

The Value Composer transforms data by chaining together operations. Below is the full catalogue of available operations, grouped by category.
Value Composer

How operations are configured

A composer slot is a JSON object with a source discriminator. There are three sources you’ll work with:
SourceShapeUse for
static{ "source": "static", "value": <literal>, "outputType": "<type>" }A fixed value baked into the configuration.
data-field{ "source": "data-field", "field": "path.to.field" }A reference to a field on the incoming feed record. Use $item / $parent inside iterations.
composed{ "source": "composed", "composition": { "type": "<op>", "<param>": <slot>, ... } }An operation. Each parameter is itself a slot, so operations nest arbitrarily.
Putting it together — a concat of vendor.name + - + name, the JSON the admin UI emits:
{
  "source": "composed",
  "composition": {
    "type": "concat",
    "value1": { "source": "data-field", "field": "vendor.name" },
    "value2": { "source": "data-field", "field": "name" },
    "separator": { "source": "static", "value": " - " }
  }
}
The same recursion shows up everywhere: an if whose then is a concat of two static values, a map whose mapFunction is a get on $item, and so on. The catalogue below documents the parameter names and types each operation expects.

Type compatibility

Every slot has a known output type, and operations declare what they accept:
  • Concrete types (number, string, boolean, array, object) — the input slot must produce that exact type, or the configuration is invalid.
  • Type markers (T, K, V) — polymorphic placeholders. The first input that fills a marker fixes the type for every other slot using the same marker. For example, equals(value: T, compare: T) accepts any type as long as value and compare agree — fill value with a string and compare is constrained to strings too.
The admin UI surfaces type mismatches in the slot’s validation state — slots that can’t yet produce the required type stay highlighted as invalid and the configuration won’t save. There’s no implicit coercion at runtime: a string flowing into a number slot raises an explicit type error rather than getting cast silently. When you actually want a cast, use toString / toNumber / toBoolean so the conversion is part of the chain. See Error handling for what happens when something does slip through.

Array Operations

count

Return the number of elements in an array.
output
number
The element count.

filter

Return the elements of an array that satisfy a condition. Each element is exposed as $item inside the filter expression.
output
array<T>
The elements that returned true from filterFunction.
filter $item.id ==
{
  "source": "composed",
  "composition": {
    "type": "filter",
    "array": { "source": "data-field", "field": "properties" },
    "filterFunction": {
      "source": "composed",
      "composition": {
        "type": "equals",
        "value": { "source": "data-field", "field": "$item.id" },
        "compare": { "source": "static", "value": "color" }
      }
    }
  }
}

findFirst

Return the first element of an array that satisfies a condition. Each element is exposed as $item inside the filter expression.
output
T
The first matching element, or null if none match.

first

Return the first element of an array.
output
T
The first element, or null if the array is empty.

flatMap

Apply a function to each element of an array, then flatten the resulting arrays into a single array. Each element is exposed as $item inside the map expression.
output
array
The flattened result of all per-element mappings.

join

Join an array of strings into a single string.
output
string
The joined string.

map

Apply a function to each element of an array and return the resulting array. Each element is exposed as $item inside the map expression.
output
array
The mapped array.
map images[] ->
{
  "source": "composed",
  "composition": {
    "type": "map",
    "array": { "source": "data-field", "field": "images" },
    "mapFunction": {
      "source": "composed",
      "composition": {
        "type": "object",
        "properties": {
          "url": { "source": "data-field", "field": "$item.path" },
          "alt": { "source": "data-field", "field": "$item.alt" }
        }
      }
    }
  }
}

merge

Merge two arrays of scalar values into one. Values in additional are appended to base.
output
array
The merged array.

slice

Extract a portion of an array.
output
array
The sliced array.

split

Split a string into an array of strings.
output
array
The resulting array of substrings.

unique

Remove duplicate values from a scalar array, preserving the order of first occurrence.
output
array
The deduplicated array.

Comparison Operations

equals

Compare two values for equality.
output
boolean
true when the values are equal.

greaterThan

Compare two numbers; true when the first is greater than the second.
output
boolean
true when value > compare.

isEmpty

Return whether a value is empty. Empty strings (after trim), empty arrays, null, and similar are true; numbers and false are not considered empty.
output
boolean
true when the value is empty.

isNull

Return whether a value is NULL.
output
boolean
true when the value is NULL.

isScalar

Return whether a value is a scalar (not an object or array). null is also considered scalar.
output
boolean
true when the value is a scalar or null.

Logic Operations

and

Return true when all values are true.
output
boolean
true when both values are true.

if

Branch the execution flow based on a condition.
output
T
Either the then or the else value.
availability based on stock > 10
{
  "source": "composed",
  "composition": {
    "type": "if",
    "condition": {
      "source": "composed",
      "composition": {
        "type": "greaterThan",
        "value": { "source": "data-field", "field": "stock" },
        "compare": { "source": "static", "value": 10 }
      }
    },
    "then": { "source": "static", "value": "in-stock" },
    "else": { "source": "static", "value": "low" }
  }
}

not

Negate a boolean. Non-boolean values are coerced to false before negation.
output
boolean
The negated value.

or

Return true when at least one value is true.
output
boolean
true when either value is true.

xor

Return true when exactly one value is true (exclusive or).
output
boolean
true when exactly one of the values is true.

Math Operations

divide

Divide two numbers (numerator / denominator).
output
number
The quotient.

exponent

Raise a number to the power of another (base^exponent).
output
number
The result of the exponentiation.

multiply

Multiply two numbers.
output
number
The product.

Object Operations

get

Read a value from an object by key.
output
T
The value at the given key, or null if the key isn’t present.

object

Compose an object by resolving each property’s expression.
output
object
The composed object.

Text Operations

concat

Concatenate two strings.
output
string
The concatenated string.

contains

Check whether a string contains another string, with optional case-insensitive matching.
output
boolean
true when value contains reference.

length

Return the number of characters in a string.
output
number
The character count.

md5

Hash a string with the MD5 algorithm. Useful for stable identifiers derived from input data.
output
string
The MD5 hash as a 32-character hexadecimal string.

padLeft

Pad a string on the left to a target length.
output
string
The padded string.

padRight

Pad a string on the right to a target length.
output
string
The padded string.

replace

Replace occurrences of a substring within a string.
output
string
The string with replacements applied.

slugify

Convert a string to a slug — lowercase, no spaces or special characters.
output
string
The slugified string.

substring

Extract a substring from a string.
output
string
The extracted substring.

toLower

Convert a string to lowercase.
output
string
The lowercased string.

toUpper

Convert a string to uppercase.
output
string
The uppercased string.

trim

Remove whitespace from the beginning and end of a string.
output
string
The trimmed string.

Transform Operations

toBoolean

Convert a value to a boolean. Falsy values like "false", "0", and [] evaluate to false.
output
boolean
The boolean result.

toNumber

Convert a value to a number. NULL becomes 0.
output
number
The numeric result.

toString

Convert a value to a string. NULL becomes an empty string.
output
string
The string result.

Utilities Operations

randomBoolean

Return a random boolean. The probability controls how often true is returned, on a 0–100 scale.
output
boolean
A random boolean.

randomNumber

Return a random number between min and max (both inclusive). Set precision to 0 for integers, or higher for decimals (e.g. 2 produces values like 3.14).
output
number
A random number in the requested range.

Error handling

The composer is strict about types and forgiving about absence:
  • Missing fields and keys resolve to null. A data-field slot pointing at a path that doesn’t exist on the current record returns null. get against a missing key returns null. The chain continues with null flowing through.
  • null inputs are absorbed where it makes sense. Per-operation handling, not a global rule:
    • concat coalesces null inputs to empty strings.
    • filter, map, and other array operations coalesce a null array input to [] and return an empty array.
    • get against a null object returns null.
    • findFirst against an empty array returns null.
  • Type mismatches throw. Operations don’t implicitly coerce — passing a number into a string slot, or a non-array into filter’s array parameter, raises a runtime error and fails the sync. Use explicit toString / toNumber / toBoolean when you need a cast, so the conversion is visible in the chain.
  • Math has guard rails. divide raises a runtime error on a zero denominator instead of producing Infinity or NaN.
  • Iteration context has a limit. filter and map populate $item (and $parent when nested one level). Three or more nesting levels aren’t supported and raise a runtime error — flatten with flatMap instead.
The field-level debugger shows node-wise output for the configuration: when a chain produces an unexpected null or fails outright, the debugger pinpoints which operation introduced it. Use it before the configuration runs against real sync data. Configuration errors that the type system can catch — an invalid operation type, a slot whose output can’t satisfy the parent’s expected type, a missing required parameter — show as inline validation on the affected slot in the admin UI; the configuration won’t save until they’re resolved. Backend resolution carries equivalent runtime checks as a backstop, raising explicit exceptions if an invalid configuration somehow reaches it.