You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
925 B
32 lines
925 B
4 months ago
|
/**
|
||
|
* Represents a variable used in a condition and the set of operators that can be applied to this variable.
|
||
|
*
|
||
|
* A `ConditionVariable` holds the ID of the variable and a list of operators that define how this variable can be evaluated
|
||
|
* in conditions. For example, if the variable is a request body or a specific field in a request, the operators can include
|
||
|
* operations such as equality checks, comparisons, or other custom evaluations.
|
||
|
*/
|
||
|
class ConditionVariable {
|
||
|
/**
|
||
|
* @type {string}
|
||
|
*/
|
||
|
id;
|
||
|
|
||
|
/**
|
||
|
* @type {import("./operators").ConditionOperator[]}
|
||
|
*/
|
||
|
operators = {};
|
||
|
|
||
|
/**
|
||
|
* @param {string} id ID of variable
|
||
|
* @param {import("./operators").ConditionOperator[]} operators Operators the condition supports
|
||
|
*/
|
||
|
constructor(id, operators = []) {
|
||
|
this.id = id;
|
||
|
this.operators = operators;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
ConditionVariable,
|
||
|
};
|