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.

78 lines 3.89 kB
import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import type { DebugEvent, Ruleset, RulesetExecutionErrorEvent, RulesetExecutionEvent } from '../engine'; import { RulesEngineRunnerService } from '../services'; import { RulesetsStore } from '../stores'; import { RulesEngineDevtoolsServiceOptions } from './rules-engine-devkit.interface'; import * as i0 from "@angular/core"; export declare class OtterRulesEngineDevtools { protected store: Store<RulesetsStore>; private readonly rulesEngineService; /** Stream of rules engine report */ readonly rulesEngineReport$?: Observable<{ events: DebugEvent[]; rulesetMap: Record<string, Ruleset>; }>; /** Stream of rules engine event */ readonly rulesEngineEvents$?: Observable<DebugEvent[]>; /** * Return true if the rules engine debug option is activated */ get isRulesEngineDebugActivated(): boolean; constructor(store: Store<RulesetsStore>, rulesEngineService: RulesEngineRunnerService, options: RulesEngineDevtoolsServiceOptions); /** Return the list of debug events emitted by rules engine */ getCurrentRulesEngineEventsStack(): Promise<DebugEvent[] | undefined>; /** Returns the list of active rulesets (name and id) at the moment when the function is called */ getActiveRulesets(): Promise<Pick<Ruleset, "id" | "name">[]>; /** Returns the list of available rulesets (name and id) at the moment when the function is called */ getAvailableRulesets(): Promise<Pick<Ruleset, "id" | "name">[]>; /** Returns the list of output actions emitted by the rules engine at the moment when the function is called */ getAllOutputActions(): Promise<import("../engine").AllActionsEvent | undefined>; /** * Get the list of executions for the given ruleset * @param rulesetId */ getRulesetExecutions(rulesetId: string): Promise<(RulesetExecutionEvent | RulesetExecutionErrorEvent)[] | undefined>; /** * Check if the ruleset is activ in the moment when the function is called * @param rulesetId * @returns True if the ruleset is active; False if the ruleset is inactive or it does not exist */ isRulesetActive(rulesetId: string): Promise<boolean>; /** * Get the list of rules executed for the specified ruleset * @param rulesetId */ getRulesEvaluationsForRuleset(rulesetId: string): Promise<import("../engine").RuleEvaluation[] | undefined>; /** * Get the list of input facts (name, current value) for the specified ruleset, at the moment when the function is called * @param rulesetId */ getInputFactsForRuleset(rulesetId: string): Promise<{ factName: string; value: import("../engine").Facts; }[] | undefined>; /** * Get the list of triggers for the specified ruleset * @param rulesetId */ getTriggersForRuleset(rulesetId: string): Promise<Record<string, import("../engine").EvaluationReason>[] | undefined>; /** * Get the list of outputed actions emitted by the given ruleset, at the moment when the function is called * @param rulesetId */ getOutputActionsForRuleset(rulesetId: string): Promise<import("../engine").ActionBlock[] | undefined>; /** Get the list of fact names and corresponding values */ getAllFactsSnapshot(): Promise<{ factName: string; value: any; }[]> | undefined; /** * Retrieve the ruleset information (rules, linkedComponents, validity range etc.) for a ruleset id * @param rulesetId */ getRulesetInformation(rulesetId: string): Promise<Ruleset | undefined>; static ɵfac: i0.ɵɵFactoryDeclaration<OtterRulesEngineDevtools, [null, null, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<OtterRulesEngineDevtools>; } //# sourceMappingURL=rules-engine-devtools.service.d.ts.map