summaryrefslogtreecommitdiffstats
path: root/server/monitor-conditions/variables.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/monitor-conditions/variables.js')
-rw-r--r--server/monitor-conditions/variables.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/monitor-conditions/variables.js b/server/monitor-conditions/variables.js
new file mode 100644
index 0000000..af98d2f
--- /dev/null
+++ b/server/monitor-conditions/variables.js
@@ -0,0 +1,31 @@
+/**
+ * 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,
+};