defaultRulesEngineProcessorRulePilot
constdefaultRulesEngineProcessorRulePilot:RulesEngineProcessor<RulePilotRule>
Defined in: rules-engine/src/utils/formatRulesEngine/defaultRulesEngineProcessorRulePilot.ts:30
Default processor for the "rulepilot" export format. Returns a single
rulepilot Rule whose ordered conditions reproduce
the rules engine's cascade: each condition pairs a guard (its own antecedent AND-ed with its
ancestor antecedents and the negated antecedents of prior siblings) with result: consequent.
Because RulePilot.evaluate returns a single result—the first matching condition's—this
target models single-outcome decisioning. A flat cascade (if/else-if/else) maps exactly; for a
rules engine whose nested or overlapping conditions would fire multiple consequents under the
"json-rules-engine"/"native" targets, rulepilot yields only the first match. Cumulative mode
(every matching condition fires) therefore has no rulepilot representation and throws.
Guards built from empty antecedents compile to an always-true { all: [] }, which rulepilot's
validator rejects; evaluate such rules with RulePilot.evaluate(rule, criteria, true) to skip
pre-validation.
Example
const rule = formatRulesEngine(re, 'rulepilot');
const result = await RulePilot.evaluate(rule, { experience: 12 }, true);
API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.