File

libs/ngx-pfe/pfe-conditions/rules-evaluator/condition.model.ts

Description

A condition to be evaluated by the PfeRulesEvaluator

Do not use this type directly. Use the Conditions instead.

Index

Properties

Properties

expression
expression: JsonPathExpression | boolean | number
Type : JsonPathExpression | boolean | number
Optional

Used to handle complex conditions instead of the value?Expression.

To evaluate a JsonPath expression, put curly braces {} around the expression, like {$.bffCreateClaim.claimNumber}. After the JsonPath evaluation the complete expressions is evaluated. Examples:

!{$.undefinedKey} {$.nine} > {$.negativeValue} || {$.KeyWest} == 99999 {$.questionContainerTest..[?(@.value == "LEFT_Q1")].value} == "LEFT_Q1"

If the expression evaluates to an object, a random number is generated instead which then evaluates to true.

operator
operator: string
Type : string
Optional

The operator that is used for the comparison between the value1Expression and value2Expression.

value1Expression
value1Expression: JsonPathExpression | boolean | number
Type : JsonPathExpression | boolean | number
Optional

The first jsonPath expression.

If the expression doesn't start with a $ it is handled as a literal.

The operator and value2Expression are optional. If they are not configured, the condition will evaluate to true, if the value1Expression expression returns a defined value.

value2Expression
value2Expression: JsonPathExpression | boolean | number
Type : JsonPathExpression | boolean | number
Optional

The second expression.

import { JsonPathExpression } from '../../models/jsonpath-expression-type.model';

export type RulesEvaluatorConditions = ConditionAdvanced | ExpressionCondition[];

/**
 * @deprecated
 * @deprecationMessage Please, use the "PfeAndCondition" or the "PfeOrCondition"
 */
export enum OPERATORS {
  AND = 'AND',
  OR = 'OR',
}

/**
 * A questionAdvanced config allows it to choose the operator for the list of conditions.
 *
 * Do not use this type directly. Use the {@link Conditions} instead.
 *
 * @deprecated
 * @deprecationMessage Please, use the "PfeAndCondition" or the "PfeOrCondition"
 */
export interface ConditionAdvanced {
  operator: OPERATORS;
  conditions: ExpressionCondition[];
}

/**
 * A condition to be evaluated by the {@link PfeRulesEvaluator}
 *
 * Do not use this type directly. Use the {@link Conditions} instead.
 */
export interface ExpressionCondition {
  /**
   * Used to handle complex conditions instead of the value?Expression.
   *
   * To evaluate a JsonPath expression, put curly braces {} around the expression, like {$.bffCreateClaim.claimNumber}.
   * After the JsonPath evaluation the complete expressions is evaluated. Examples:
   *
   * !{$.undefinedKey}
   * {$.nine} > {$.negativeValue} || {$.KeyWest} == 99999
   * {$.questionContainerTest..[?(@.value == "LEFT_Q1")].value} == "LEFT_Q1"
   *
   * If the expression evaluates to an object, a random number is generated instead which then evaluates to true.
   */
  expression?: JsonPathExpression | boolean | number;

  /**
   * The first jsonPath expression.
   *
   * If the expression doesn't start with a $ it is handled as a literal.
   *
   * The operator and value2Expression are optional. If they are not
   * configured, the condition will evaluate to true, if the value1Expression expression
   * returns a defined value.
   *
   * @deprecated
   * @deprecationMessage The value*Expression conditions are deprecated. Please use the `expression` option as an alternative.
   */
  value1Expression?: JsonPathExpression | boolean | number;

  /**
   * The operator that is used for the comparison between the value1Expression and
   * value2Expression.
   *
   * @deprecated
   * @deprecationMessage The value*Expression conditions are deprecated. Please use the `expression` option as an alternative.
   */
  operator?: string;

  /**
   * The second expression.
   *
   * @deprecated
   * @deprecationMessage The value*Expression conditions are deprecated. Please use the `expression` option as an alternative.
   */
  value2Expression?: JsonPathExpression | boolean | number;
}

results matching ""

    No results matching ""