Module: ruleBroker

Contains all the functions necessary to manage the business rules system.

Author:
  • Seth Hollingsead
Source:

Requires

Methods

(inner) addClientRules(clientRules) → {void}

Merges client defined business rules with the system defined business rules.

Parameters:
Name Type Description
clientRules array.<object>

The client rules that should be merged with the system rules.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) bootStrapBusinessRules() → {void}

Captures all of the business rule string-to-function call map data in the rulesLibrary and migrates that data to the D-data structure. This is important now because we are going to allow the client to define their own business rules separate from the system defined business rules. So we need a way to merge all client defined and system defined business rules into one location. Then the rule broker will execute business rules from the D-data structure and not the rules library per-say. This will allow the system to expand much more dynamically and even be user-defined & flexible to client needs.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) processRules(inputs, rulesToExecute) → {string|integer|boolean|object|function}

Parse the given input Object/String/Integer/Data/Function through a set of business rules, (Some rules do not support chaining); where the rules are defined in the input rules array.

Parameters:
Name Type Description
inputs array.<(string|integer|boolean|object|function()), (string|integer|boolean|object|function())>

An array of inputs, inputData & inputMetaData. inputs[0] = inputData - The primary input data that should be processed by the business rule. inputs[1] = inputMetaData - Additional meta-data that should be used when processing the business rule.

rulesToExecute array.<string>

The name(s) of the rule(s) that should be executed for modding the input data.

Author:
  • Seth Hollingsead
Source:
Returns:

A modified data Object/String/Integer/Boolean/Function where the data has been modified based on the input data, input meta-data, and business rule that was executed.

Type
string | integer | boolean | object | function