Evaluators

Evaluators are used to define conditions that determine whether a block of configuration should be included in the evaluated and merged configuration document.

Evaluators work on different aspects of the runtime experience, including:

  • what is being observed
  • who is observing it
  • what URL is being looked at
  • what objects are known about at the time (i.e. observables)
  • what permissions and authorities the current user has over things that are being observed

There are many types of evaluators available.

The condition parameter

Each conditional block names an evaluator and may supply a condition. In the evaluate phase of the Configuration Service, the evaluator matches the current runtime state against the given condition. If true, the block's config section is carried forward and merged into the final configuration document.

{
    "evaluator": "{evaluatorId}",
    "condition": {condition},
    "config": {
        ...
    }
}

Each evaluator has its own support for different kinds of conditions, so set the condition according to what the evaluator expects (if it is needed at all). For example:

  • document-has-type takes a type as its condition (for example, "my:article")
  • document-is-file takes no condition
  • and and or take an array of condition blocks
  • not takes a single condition block

A condition is only applicable when an evaluator is supplied. If an evaluator is not supplied, the configuration block always evaluates to true.

Boolean evaluators assume a condition of true, which tests for the evaluator to return true. You can adjust this to test the opposite by setting condition to false.

Available evaluators

The following evaluators are available: