From 62add5d7fbbeb9c05e2dad4a9ffd27ccf651f161 Mon Sep 17 00:00:00 2001 From: "andrew.borg" Date: Sun, 17 Nov 2024 12:14:56 +0100 Subject: [PATCH] feat(core): Updates docs --- src/services/introspector.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/introspector.ts b/src/services/introspector.ts index 76ba6ad..67e8faa 100644 --- a/src/services/introspector.ts +++ b/src/services/introspector.ts @@ -27,14 +27,14 @@ export class Introspector { subjects: string[] ): IntrospectionResult[] { // We care about all the possible values for the subjects which will satisfy - // the rule if the rule is tested against the constraint provided. + // the rule if the rule is tested against the criteria provided. // To proceed we must first clone the rule (to avoid modifying the original) rule = JSON.parse(JSON.stringify(rule)); // First step is to simplify the rule: // 1. Make sure the rule conditions is an array. - // 2. Convert any 'none' conditions to an 'all' and reverse operators of all children till the bottom. + // 2. Convert any 'none' conditions to an 'all' and reverse operators of all children (recursively). // 3. Remove all constraints which are not relevant to the subjects provided. rule.conditions = this.#asArray(rule.conditions); for (let i = 0; i < rule.conditions.length; i++) { @@ -57,6 +57,8 @@ export class Introspector { conditions.push(this.#removeAllSubRules(rule.conditions[i])); } + // Take each sub-rule we extracted and create a new condition which joins the sub-rule with the + // parent condition(s) it must satisfy. We then add this new condition to the list of conditions. subRules.forEach((rule) => { if (!rule.parent) { conditions.push(rule.subRule);