UNPKG

@o3r/rules-engine

Version:

This module provides a rule engine that can be executed on your Otter application to customize your application (translations, placeholders and configs) based on a json file generated by your CMS.

869 lines 18.8 kB
{ "operators": [ { "id": "arrayContains", "description": "Check if any of the variable's value is equal to a specific value", "display": "contains", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "stringContains", "description": "Check if the specified text value is included in the text variable", "display": "contains", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "notArrayContains", "description": "Check if every value of the variable is different from a specific value", "display": "does not contain", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "notStringContains", "description": "Check if the specified text value is not included in the text variable", "display": "does not contain", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "allEqual", "description": "Check if every value of the variable equals a specific value", "display": "all equal to", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "allGreater", "description": "Check if every numerical value of the variable is greater than a specific value", "display": "all >", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "allIn", "description": "Check if every value of the variable is in a specific list", "display": "all in", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 } }, { "id": "allNotIn", "description": "Check if every value of the variable is not in a specific list", "display": "none in", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 } }, { "id": "allLower", "description": "Check if every numerical value of the variable is lower than a specific value", "display": "all <", "leftOperand": { "types": [ "number" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "allMatch", "description": "Check if every string value of the variable matches a specific pattern", "display": "all match", "leftOperand": { "types": [ "string" ], "nbValues": -1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "allRangeNumber", "description": "Check if every value of the variable is included in a specified range", "display": "all between", "leftOperand": { "types": [ "number" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 2 } }, { "id": "oneEquals", "description": "Check if at least one of the values of the variable equals a specific value", "display": "one equal to", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "oneGreater", "description": "Check if one of the values of the variable is greater than a specific value", "display": "one >", "leftOperand": { "types": [ "number" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "oneIn", "description": "Check if at least one of the values of the variable is equal to one in a specified list", "display": "one in", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 } }, { "id": "oneLower", "description": "Check if one of the values of the variable is lower than a specific value", "display": "one <", "leftOperand": { "types": [ "number" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "oneMatches", "description": "Check if one of the values of the variable matches a specific pattern", "display": "one matches", "leftOperand": { "types": [ "string" ], "nbValues": -1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "oneRangeNumber", "description": "Check if one of the values of the variable is included in a specified range", "display": "one between", "leftOperand": { "types": [ "number" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 2 } }, { "id": "lengthEquals", "description": "Check if the number of values of the variable is equal to a specific value", "display": "number of =", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "lengthNotEquals", "description": "Check if the number of values of the variable is different from a specific value", "display": "number of ≠", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "lengthLessThanOrEquals", "description": "Check if the number of values of the variable is lower or equal to a specific value", "display": "number of ≤", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "lengthLessThan", "description": "Check if the number of values of the variable is lower than a specific value", "display": "number of <", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "lengthGreaterThanOrEquals", "description": "Check if the number of values of the variable is greater or equal to a specific value", "display": "number of ≥", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "lengthGreaterThan", "description": "Check if the number of values of the variable is greater than a specific value", "display": "number of >", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": -1 }, "rightOperand": { "types": [ "number", "string" ], "nbValues": 1 } }, { "id": "equals", "description": "Check if a variable is equal to a specific value", "display": "is equal to", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "notEquals", "description": "Check if a variable is different from a specific value", "display": "is not equal to", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 } }, { "id": "inArray", "description": "Check if the variable's value is included in a specified list", "display": "is in", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 } }, { "id": "notInArray", "description": "Check if the variable's value is not included in the value list", "display": "is not in", "leftOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": 1 }, "rightOperand": { "types": [ "string", "number", "date", "boolean" ], "nbValues": -1 } }, { "id": "inString", "description": "Check if the text variable is part of the specified value", "display": "within", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "notInString", "description": "Check if the text variable is not part of the specified value", "display": "not within", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "isDefined", "description": "Check if the variable and its value are defined", "display": "is defined", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": 0 } }, { "id": "isUndefined", "description": "Check if the variable and its value are undefined", "display": "is not defined", "leftOperand": { "types": [ "string", "number", "date", "boolean", "object" ], "nbValues": 0 } }, { "id": "matchesPattern", "description": "Check if the text variable matches the specified RegExp pattern", "display": "matches the pattern", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 1 } }, { "id": "inRangeDate", "description": "Check if a date variable is in a specified date range", "display": "is between", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "rightOperand": { "types": [ "date", "string", "number" ], "nbValues": 2 } }, { "id": "dateInNextMinutes", "description": "Check if the value of the variable is in the next x minutes", "display": "is in next minutes", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "factImplicitDependencies": [ "o3rCurrentTime" ], "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "dateNotInNextMinutes", "description": "Check if the value of the variable is not in the next x minutes", "display": "is not in next minutes", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "factImplicitDependencies": [ "o3rCurrentTime" ], "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "dateBefore", "description": "Check if a date variable is prior than a specified date", "display": "is before", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "rightOperand": { "types": [ "date", "string", "number" ], "nbValues": 1 } }, { "id": "dateAfter", "description": "Check if a date variable is posterior than a specified date", "display": "is after", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "rightOperand": { "types": [ "date", "string", "number" ], "nbValues": 1 } }, { "id": "dateEquals", "description": "Check if a date variable is the same as a specified date", "display": "is equal to", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "rightOperand": { "types": [ "date", "string", "number" ], "nbValues": 1 } }, { "id": "dateNotEquals", "description": "Check if a date variable is different from a specified date", "display": "is not equal", "leftOperand": { "types": [ "date" ], "nbValues": 1 }, "rightOperand": { "types": [ "date", "string", "number" ], "nbValues": 1 } }, { "id": "greaterThanOrEqual", "description": "Check if the number variable is greater or equal to a specific value", "display": "≥", "leftOperand": { "types": [ "number" ], "nbValues": 1 }, "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "greaterThan", "description": "Check if the number variable is greater than a specific value", "display": ">", "leftOperand": { "types": [ "number" ], "nbValues": 1 }, "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "lessOrEqual", "description": "Check if the number variable is lower or equal to a specific value", "display": "≤", "leftOperand": { "types": [ "number" ], "nbValues": 1 }, "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "lessThan", "description": "Check if the number variable is lower than a specific value", "display": "<", "leftOperand": { "types": [ "number" ], "nbValues": 1 }, "rightOperand": { "types": [ "number" ], "nbValues": 1 } }, { "id": "inRangeTime", "description": "Check if the time variable is between the specified start and end times. This method also supports time ranges that cross midnight. For example, a range from \"23:00\" to \"02:00\" will be true for an input like \"00:30\".", "display": "is between", "leftOperand": { "types": [ "string" ], "nbValues": 1 }, "rightOperand": { "types": [ "string" ], "nbValues": 2 } } ] }