Module: main

Contains all customer facing functions to are used to interface with the rest of the application framework.

Author:
  • Seth Hollingsead
Source:

Requires

Methods

(inner) accouterFramework(data) → {boolean}

Equip and outfit this instance of the haystacks framework with an existing data structure. This function essentially allows plugins to inject a clone of the D-data structure from another instance of Haystacks into this instance of Haystacks, essentially creating a clone of the original instance of Haystacks. The purpose being to be able to call back to Haystacks and have it perform loading and parsing operations on files.

Parameters:
Name Type Description
data object

A JSON data structure, that is a clone of the D-data structure from another instance of Haystacks.

Author:
  • Seth Hollingsead
Source:
Returns:

A True or False value to indicate if the operation was completed successfully or not.

Type
boolean

(inner) clearAllPluginRegistry() → {boolean}

This is a wrapper function for warden.clearAllPluginRegistry. Which is in-turn a wrapper function for chiefPlugin.clearPluginRegistry. Which is in-turn a wrapper function for pluginBroker.unregisterAllPlugins.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin registry data hive was cleared successfully or not.

Type
boolean

(inner) consoleLog(theNamespacePrefix, theFunctionName, message) → {void}

A wrapper function to expose the loggers.consoleLog function to the client application.

Parameters:
Name Type Description
theNamespacePrefix string

The namespace of the log that is being sent. Ex: folder.filename

theFunctionName string

The name of the function that log is being called from.

message string | object

The message that should be logged.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) enqueueCommand(command) → {void}

Adds a command to the command queue. It is worth noting that a command could actually load a whole workflow of commands. So one command can spawn into many commands that cause the command queue to be very full with a very complicated workflow. This also acts as a wrapper for the warden.enqueueCommand function.

Parameters:
Name Type Description
command string

The command to add to the command queue for executing.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) executeBusinessRules(inputs, businessRules) → {string}

A wrapper call to a business rule from the warden.executeBusinessRules.

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

The array of inputs: inputs[0] = inputData - The input to the rule that is being called. inputs[1] = inputMetaData - Additional data the input to the rule.

businessRules array.<string>

The array of rule name(s) that should be executed.

Author:
  • Seth Hollingsead
Source:
Returns:

The value that is returned from the rule is also returned.

Type
string

(inner) getConfigurationSetting(configurationNamespace, configurationName) → {string|integer|boolean|double|object}

This is just a wrapper for the warden.getConfigurationSetting function.

Parameters:
Name Type Description
configurationNamespace string

The path in the configuration JSON object where the configuration setting should be found.

configurationName string

The key of the configuration setting.

Author:
  • Seth Hollingsead
Source:
Returns:

The value of whatever was stored in the D[configuration][configurationName].

Type
string | integer | boolean | double | object

(inner) getFrameworkData() → {object}

Returns all the contents of the framework data. Can be used to pull the data contents of a Haystacks instance to swap it out with mock data, then swap back afterward.

Author:
  • Seth Hollingsead
Source:
Returns:

A JSON object that contains the entire contents of the Haystacks D-data structure.

Type
object

(inner) getPluginsRegistryPath() → {string}

A wrapper call to the warden.getPluginsRegistryPath function. Which is in-turn a wrapper function for the chiefPlugin.getPluginsRegistryPath. Which is in-turn a wrapper function for pluginBroker.getPluginsRegistryPath.

Author:
  • Seth Hollingsead
Source:
Returns:

The path to the plugins listed in the plugin registry as meta-data.

Type
string

(inner) initFramework(clientConfiguration) → {void}

Initializes the framework systems.

Parameters:
Name Type Description
clientConfiguration object

A configuration data object that contains all the data needed to bootstrap the framework for a client application.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) isCommandQueueEmpty() → {boolean}

Determines if the command queue is empty or not empty. This is a wrapper function for the warden.isCommandQueueEmpty function.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the command execution queue is empty or not. Useful to determine if the command queue should continue executing or not.

Type
boolean

(inner) listAllPluginsInRegistry() → {array.<string>}

This is a wrapper function for warden.listAllPluginsInRegistry. Which is in-turn a wrapper function for chiefPlugin.getAllPluginsInRegistry. Which is in-turn a wrapper function for pluginBroker.listPluginsInRegistry.

Author:
  • Seth Hollingsead
Source:
Returns:

A list array of the names of the plugins in the plugin registry.

Type
array.<string>

(inner) listAllPluginsInRegistryPath() → {array.<string>}

This is a wrapper function for warden.listAllPluginsInRegistryPath. Which is in-turn a wrapper function for chiefPlugin.getAllPluginsInRegistryPath. Which is in-turn a wrapper function for pluginBroker.listPluginsInRegistryPath.

Author:
  • Seth Hollingsead
Source:
Returns:

A list array of the names of the plugins in the plugin registry.

Type
array.<string>

(inner) listLoadedPlugins() → {array.<string>}

This is a wrapper function for warden.listLoadedPlugins. Which is in-turn a wrapper function for chiefPlugin.listLoadedPlugins. Which is in-turn a wrapper function for pluginBroker.listAllLoadedPlugins.

Author:
  • Seth Hollingsead
Source:
Returns:

A list array of the names of the plugins that are currently loaded.

Type
array.<string>

(inner) loadCommandAliases(commandAliasesPath, contextName) → {void}

Loads and merges a set of client command aliases with the framework command aliases. This function acts as a wrapper for calling the warden.loadCommandAliases function.

Parameters:
Name Type Description
commandAliasesPath string

The path to where the commands aliases XML file is stored, that should be loaded.

contextName string

A name for the set of command aliases that should be used to store the path in the configuration system so it can be loaded by the framework.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) loadCommandWorkflows(workflowPath, contextName) → {void}

Loads and merges a set of client workflows with the framework workflows. This function acts as a wrapper for calling the warden.loadCommandWorkflows function.

Parameters:
Name Type Description
workflowPath string

The path to where the workflows file is stored, that should be loaded.

contextName string

A name for the workflows that should be used to store the path in the configuration system so it can be loaded by the framework.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) loadPlugin(pluginPath) → {boolean}

A wrapper call to the warden.loadPlugin function. Calls various functions in the chiefPlugn and pluginBroker to load plugin metaData and data: Business rules, Commands, Workflows, Constants, Configurations, dependencies ist(dependant plugins), etc...

Parameters:
Name Type Description
pluginPath string

The fully qualified path where to load the plugin from.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin was loaded or not.

Type
boolean

(inner) loadPluginResourceData(contextName, pluginConfigPath) → {object}

A wrapper call to the warden.loadPluginResourceData function.

Parameters:
Name Type Description
contextName string

The type of resource that is being loaded, eg: configuration, commandAliases, workflows, ect...

pluginConfigPath string

The fully qualified path to where the plugin data is located and should be loaded from.

Author:
  • Seth Hollingsead
Source:
Returns:

The JSON data that is loaded and parsed from the plugin path.

Type
object

(inner) loadPlugins(pluginsPaths) → {boolean}

A wrapper call to the warden.loadPlugins function. Calls various functions in the chiefPlugin and pluginBroker to load plugin metaData and data: Business rules, Commands, Workflows, Constants, Configurations, dependencies list (dependant plugins), etc...

Parameters:
Name Type Description
pluginsPaths array.<string>

The fully qualified paths where to load the plugins from.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if all the plugins were loaded or not.

Type
boolean

(inner) loadPluginsFromRegistry() → {boolean}

A wrapper call to warden.loadPluginsFromRegistry function. Calls various functions in the chief Plugin and pluginBroker to oad plugin metaData and data: Business rules, Commands, Workflows, Constants, Configurations, dependencies ist (dependant plugns), etc...

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if all the plugins were loaded or not.

Type
boolean

(inner) mergeClientBusinessRules(clientBusinessRules) → {void}

A wrapper function to expose the warden.mergeClientBusinessRules functionality.

Parameters:
Name Type Description
clientBusinessRules object

A map of client defined business rule names and client defined business rule function calls.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) mergeClientCommands(clientCommands) → {void}

A wrapper function to expose the warden.mergeClientCommands functionality.

Parameters:
Name Type Description
clientCommands object

A map of client defined command names and client defined command function calls.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) numberOfPluginsInRegistry() → {integer}

This is a wrapper function for warden.numberOfPluginsInRegistry. Which is in-turn a wrapper function for chiefPlugin.countAllPluginsInRegistry. Which is in-turn a wrapper function for pluginBroker.countPluginsInRegistry.

Author:
  • Seth Hollingsead
Source:
Returns:

The count of the number of plugins listed in the plugin registry data hive.

Type
integer

(inner) numberOfPluginsInRegistryPath() → {integer}

This is a wrapper function for warden.numberOfPluginsInRegistryPath. Which is in-turn a wrapper function for chiefPlugin.countAllPluginsInRegistryPath. Which is in-turn a wrapper function for pluginBroker.countPluginsInRegistryPath.

Author:
  • Seth Hollingsead
Source:
Returns:

Teh count of the number of plugin sub-folders in the plugins path listed in the plugn registry data hive.

Type
integer

(inner) processCommandQueue() → {array.<boolean, (string|integer|boolean|object|array)>}

This is a wrapper function for the warden.processCommandQueue. This leads to a call to the chiefCommander.processCommand to process an individual command. This is because a command could actually invoke a command workflow that might enqueue a bunch of commands to the command queue. All of them must be executed in sequence as part of the main application loop.

Author:
  • Seth Hollingsead
Source:
Returns:

An array with a boolean True or False value to indicate if the application should exit or not exit, followed by the command output.

Type
array.<boolean, (string|integer|boolean|object|array)>

(inner) registerPluginByNameAndPath(pluginName, pluginPath) → {boolean}

This is a wrapper function for warden.registerPluginByNameAndPath. Which is in-turn a wrapper function for chiefPlugin.registerNamedPlugin. Which is in-turn a wrapper function for pluginBroker.registerPlugin.

Parameters:
Name Type Description
pluginName string

The name of the plugin that should be registered.

pluginPath string

The path to the plugin, to be added to the plugin registry. This should be the path to the plugin/package.json file, but not including the package.json as part of the path URI.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin was added to the plugin registry successfully or not.

Type
boolean

(inner) setConfigurationSetting(configurationNamespace, configurationName, configurationValue) → {void}

This is just a wrapper for the warden.setConfigurationSetting function.

Parameters:
Name Type Description
configurationNamespace string

The path in the configuration JSON object where the configuration setting should be set. Ex: businessRules.rules.stringParsing.countCamelCaseWords

configurationName string

The key of the configuration setting.

configurationValue string | integer | boolean | double | object

The value of the configuration setting.

Author:
  • Seth Hollingsead
Source:
Returns:
Type
void

(inner) syncPluginRegistryWithPath() → {boolean}

This is a wrapper function for warden.syncPluginRegistryWithPath. Which is in-turn a wrapper function for chiefPlugin.synchronizePluginRegistryWithPath. Which is in-turn a wrapper function for pluginBroker.synchPluginRegistryWithPluginRegistryPath.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the synchronization was performed successfully or not.

Type
boolean

(inner) unloadAllPlugins() → {boolean}

A wrapper call to the warden.unloadAllPlugins function. Calls various functions in the chiefPlugin and pluginBroker to unload and remove all plugin metaData and data: Business rules, Commands, Workflows, Constants, Configurations, dependencies list (dependant plugins), etc...

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if all the plugins were unloaded successfully or not.

Type
boolean

(inner) unloadPlugin(pluginName) → {boolean}

A wrapper call to the warden.unloadPlugin function. Calls various functions in the chiefPlugin and pluginBroker to unload and remove metaData and data: Business rules, Commands, Workflows, Constants, Configurations, dependencies list (dependant plugins), etc...

Parameters:
Name Type Description
pluginName string

The name of the plugin that should be unloaded.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin was unloaded successfully or not.

Type
boolean

(inner) unloadPlugins(pluginNames) → {boolean}

A wrapper call to the warden.unloadPlugins function. Calls various functions in the chiefPlugin and pluginBroker to unload and remove all the metaData and data for a list of plugins: Business rules, Commands, Workflows, Constants, Configurations, dependencies list (dependant plugins), etc...

Parameters:
Name Type Description
pluginNames array.<string>

An array list of names of plugins that should be unloaded.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if all the plugins were unloaded successfully or not.

Type
boolean

(inner) unregisterPluginByName(pluginName) → {boolean}

This is a wrapper function for warden.unregisterPluginByName. Which is in-turn a wrapper function for chiefPlugin.unregisterNamedPlugin. Which is in-turn a wrapper function for pluginBroker.unregisterPlugin.

Parameters:
Name Type Description
pluginName string

The name of the plugin that should be removed from the plugin registry.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin was removed from the plugin registry successfully or not.

Type
boolean

(inner) unregisterPlugins(pluginsListArray) → {boolean}

This is a wrapper function for warden.unregisterPlugins. Which is in-turn a wrapper function for chiefPlugin.unregisterPlugins. Which is in-turn a wrapper function for pluginBroker.unregisterPlugins.

Parameters:
Name Type Description
pluginsListArray string | array.<string>

A string or list array of plugin names that should be removed from the plugin registry.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if all the plugins were successfully removed from the plugin registry or not.

Type
boolean

(inner) writePluginRegistryToDisk() → {boolean}

This is a wrapper function for warden.writePluginRegistryToDisk. Which is in-turn a wrapper function for chiefPlugin.savePluginRegistryDisk. Which is in-turn a wrapper function for pluginBroker.savePluginRegistry.

Author:
  • Seth Hollingsead
Source:
Returns:

True or False to indicate if the plugin registry was successfully saved to the disk or not.

Type
boolean