File

src/engine/engine.ts

Description

Rules engine

Index

Properties
Methods
Accessors

Constructor

constructor(options?: RulesEngineOptions)

Rules engine

Parameters :
Name Type Optional Description
options RulesEngineOptions Yes

rules engine options

Properties

Public Readonly Optional engineDebug
Type : EngineDebugger

Instance of engine debug object; Undefined if debugMode is not active

Public Readonly events$
Type : Observable<ActionBlock[]>

List of events for the current state of the rules engine

Public Optional factDefaultDelay
Type : number

Delay before fact stream defaulting value

Public Readonly Optional logger
Type : Logger

Log the engine errors

Public operators
Type : Record<string | Operator<, >>

Map of available operators

Public Readonly performance

Performance reporter to use for performance measurements.

Public Readonly rulesEngineInstanceName
Type : string

Name of the rules engine instance

Methods

Public getEventStream
getEventStream()
Type parameters :
  • T

Operator to apply on a stream of rulesets ids Returns a stream of actions outputted by the rules engine, corresponding to the rulesetsIds

Returns : Observable<T[]>
Public getRegisteredFactsNames
getRegisteredFactsNames()

Get the list of registered facts names

Returns : any
Public retrieveFactValue
retrieveFactValue(id: string)
Type parameters :
  • T

Retrieve the promise of the latest value of a fact. Return undefined if the fact is not defined.

Parameters :
Name Type Optional Description
id string No

ID of the fact to retrieve

Public retrieveOrCreateFactStream
retrieveOrCreateFactStream(id: string, factValue$?: Observable)
Type parameters :
  • T

Create or retrieve a fact stream The fact stream created will be registered in the engine

Parameters :
Name Type Optional Description
id string No

ID of the fact to retrieve

factValue$ Observable<T> Yes

Value stream for the fact

Public upsertFacts
upsertFacts(facts: Fact<T> | Fact<T>[])
Type parameters :
  • T

Update or insert fact in rules engine

Parameters :
Name Type Optional Description
facts Fact<T> | Fact<T>[] No

fact list to add / update

Returns : void
Public upsertOperators
upsertOperators(operators: (Operator | UnaryOperator)[])

Update or insert operator in rules engine

Parameters :
Name Type Optional Description
operators (Operator<any | any> | UnaryOperator<any>)[] No

operator list to add / update

Returns : void
Public upsertRulesets
upsertRulesets(rulesets: Ruleset[])

Update or insert rule in rules engine

Parameters :
Name Type Optional
rulesets Ruleset[] No
Returns : void

Accessors

debugMode
getdebugMode()

Flag to check if the run is in debug mode or not

Returns : boolean

results matching ""

    No results matching ""