Contains all of the lower level plugin processing functions, and also acts as an interface for loading, unloading, reloading, registering, unregistering plugins and plugin metaData.
- Copyright:
- Copyright © 2022-… by Seth Hollingsead. All rights reserved
- Source:
Requires
- module:constantBroker
- module:dataBroker
- module:ruleBroker
- module:workflowBroker
- module:loggers
- module:data
- @haystacks/constants
- url
- path
Methods
(inner) countPluginsInRegistry() → {integer}
Scans the plugin registry data hive and determines how many plugins are registered there.
- Source:
Returns:
The count of the number of plugins listed in the plugin registry data hive.
- Type
- integer
(inner) countPluginsInRegistryPath() → {integer}
Counts the number of sub-folders located at the path specified in the plugin registry data hive.
- Source:
Returns:
The count of the number of plugin sub-folders in the plugins path listed in the plugin registry data hive.
- Type
- integer
(inner) extractAndProcessPluginEntryPointURI(pluginMetaData, pluginPath) → {string}
Extracts the entry point path and file name for a plugin from the package.json data object. Processes the entry point path with a path.join to form a fully qualified path. Converts the resulting fully qualified path into a path URI string for importing later.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginMetaData |
object | The meta data for the given plugin loaded for the corresponding package.json. |
pluginPath |
string | The path to the plugin, used to form a fully-qualified path. NOTE: It could also be that the pluginPath just contains the name of the folder that is the plugin, and the path should be acquired from the plugin registry path. |
- Source:
Returns:
The path entry point to the plugin as a URI file path.
- Type
- string
(inner) getPluginsRegistryPath() → {string}
Looks up the plugin registry meta-data and finds the attribute that contains the plugins path.
- Source:
Returns:
The path to the plugins listed in the plugin registry as meta-data.
- Type
- string
(inner) integratePluginBusinessRules(pluginName, pluginBusinessRules) → {boolean}
Saves all of the plugin business rules to the D-data structure where business rules are stored and called from.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's business rules should be integrated with the haystacks business rules. |
pluginBusinessRules |
object | The business rules specific to this current plugin. |
- Source:
Returns:
True or False to indicate if this plugins business rules are successfully integrated or not.
- Type
- boolean
(inner) integratePluginCommandAliases(pluginName, pluginCommandAliases) → {boolean}
Saves all of the plugin command aliases to the D-data structure where command aliases data are stored.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's command aliases should be integrated with the haystacks command aliases data. |
pluginCommandAliases |
object | The JSON object that contains all of the command aliases specific to this current plugin. |
- Source:
Returns:
True or False to indicate if this plugins command aliases data are successfully integrated or not.
- Type
- boolean
(inner) integratePluginCommands(pluginName, pluginCommands) → {boolean}
Saves all of the plugin commands to the D-data structure where commands are stored and called from.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's commands should be integrated with the haystacks commands. |
pluginCommands |
object | The commands specific to this current plugin. |
- Source:
Returns:
True or False to indicate if this plugins commands are successfully integrated or not.
- Type
- boolean
(inner) integratePluginConfigurationData(pluginName, pluginConfigurationData) → {boolean}
Saves all of the plugin configuration data to the D-data structure where configuration data are stored.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's configuration data should be integrated with the haystacks configuration data. |
pluginConfigurationData |
object | The JSON object that contains all of the configuration data specific to this current plugin. |
- Source:
Returns:
True or False to indicate if this plugins configuration data are successfully integrated or not.
- Type
- boolean
(inner) integratePluginThemeData(pluginName, pluginThemeData) → {boolean}
Saves all of the plugin theme data to the D-data structure where theme data is stored.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's theme data should be integrated with the haystacks theme data. |
pluginThemeData |
object | The JSON object that contains all of the theme data specific to this current plugin. |
- Source:
Returns:
True or False to indicate if the plugins theme data are successfully integrated or not.
- Type
- boolean
(inner) integratePluginWorkflows(pluginName, pluginWorkflows) → {boolean}
Saves all of the plugin workflows to the D-data structure where workflow data are stored.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin who's workflows should be integrated with the haystacks workflows data. |
pluginWorkflows |
object | The JSON object that contains all of the workflows specific to this current plugin. |
- Source:
Returns:
True or False to indicate if the plugins workflows data are successfully integrated or not.
- Type
- boolean
(inner) listAllLoadedPlugins() → {array.<string>}
Builds a list array of the names of the plugins that are currently loaded.
- Source:
Returns:
A list array of the names of the plugins that are currently loaded in the Haystacks platform.
- Type
- array.<string>
(inner) listPluginsAttributeInRegistry(attributeName) → {array.<string>}
Builds a list array of the specified attribute out of the plugin objects in the plugin registry.
Parameters:
| Name | Type | Description |
|---|---|---|
attributeName |
string | The name of the attribute that should be looked up in the plugin object, for each of the plugin objects in the plugin registry. |
- Source:
Returns:
A list array of the attributes from the plugins in the plugin registry.
- Type
- array.<string>
(inner) listPluginsInRegistry() → {array.<string>}
Builds a list array of the names of the plugins in the plugin registry.
- Source:
Returns:
A list array of the names of the plugins in the plugin registry.
- Type
- array.<string>
(inner) listPluginsInRegistryPath() → {array.<string>}
In the plugin registry there should be an entry for the path of the plugins on the local system. This function will load that path and return a list of the sub-folders located at that path.
- Source:
Returns:
A list array of the names of the plugins located at the specified path on the local system from the plugins registry data hive.
- Type
- array.<string>
(inner) listPluginsPathsInRegistry() → {array.<string>}
Builds a list array of the paths of the plugins in the plugin registry.
- Source:
Returns:
A list array of the paths of the plugins in the plugin registry.
- Type
- array.<string>
(inner) loadPlugin(pluginExecutionPath) → {object}
Uses a combination of promises and a function call to import the specified plugin file at the specified URI path.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginExecutionPath |
string | The entry point for the plugin that should be loaded. |
- Source:
Returns:
The data that was returned and loaded from the plugin.
- Type
- object
(inner) loadPluginMetaData(pluginPath) → {object}
Loads the plugin meta data for the plugin at the specified path by looking for a package.json at the specified path and loading that file, and returning it as a JSON object.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginPath |
string | The path to a plugin where a package.json should be expected to be found for that plugin. It could also be that the pluginPath just contains the name of the folder that is the plugin, and the path should be acquired from the plugin registry path. |
- Source:
Returns:
The JSON data object loaded from the plugin package.json file, specified by the input parameter.
- Type
- object
(inner) loadPluginRegistry(pluginRegistryPath) → {object}
Loads the plugin registry file, which specified the data with the paths were plugins should be loaded from.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginRegistryPath |
string | Teh path to the plugin registry for the app that loaded the haystacks framework. |
- Source:
Returns:
The JSON data object loaded from the specified plugin registry path by the input parameter.
- Type
- object
(inner) registerPlugin(pluginName, pluginPath) → {boolean}
Manually registers a plugin with the plugin registry data hive. Allows for special case where plugins can be registered from a different path, then the path specified by the plugin registry. Caution should be emphasized when loading plugins from a custom path location, this should be used primarily for debugging and triage use cases.
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. |
- Source:
Returns:
True or False to indicate if the plugin was added to the plugin registry successfully or not.
- Type
- boolean
(inner) savePluginRegistry() → {boolean}
Exports the plugin registry data hive JSON object and saves it out to disk, over-writing any existing plugin registry JSON file at the location specified by the application.
- Source:
Returns:
True or False to indicate if the export to file was completed successfully or not.
- Type
- boolean
(inner) storePluginRegistryInDataStructure(pluginRegistryData) → {boolean}
Pushes the input plugin registry data to the D-data structure so it can be used by the rest of the framework.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginRegistryData |
object | The plugin registry data that should be stored in the D-data structure. |
- Source:
Returns:
A True or False value to indicate if the data was successfully stored in the D-data structure or not.
- Type
- boolean
(inner) syncPluginRegistryWithPluginRegistryPath() → {boolean}
performs a synchronization procedure on the plugin registry to ensure that the contents and plugins registered in the plugin registry match with the list of plugin folders located at the path specified in the plugin registry as the default plugin path. The updates are made to the plugin registry data hive.
- Source:
Returns:
True or False to indicate if the synchronization was performed successfully.
- Type
- boolean
(inner) unloadPlugin(pluginName) → {boolean}
Unloads a plugin by removing all of the plugin data and meta-data from all of the appropriate data structures in the D-data structure.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin that should have all its data unloaded from the D-data structure. |
- Source:
Returns:
True or False to indicate if the plugin was unloaded successfully or not.
- Type
- boolean
(inner) unregisterAllPlugins() → {boolean}
Removes all plugins from the list of registered plugins in the plugin registry. This removes all plugins in the plugins registry data hive.
- Source:
Returns:
True or False to indicate if the plugin registry data hive was cleared successfully or not.
- Type
- boolean
(inner) unregisterPlugin(pluginName) → {boolean}
Manually removes a plugin from the plugin registry data hive.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginName |
string | The name of the plugin that should be removed from the plugin registry. |
- Source:
Returns:
True or False to indicate if the plugin was removed from the plugin registry successfully or not.
- Type
- boolean
(inner) unregisterPlugins(pluginListArray) → {boolean}
Removes a list of plugins from the plugin registry data hive, by calling unregisterPlugin for each one.
Parameters:
| Name | Type | Description |
|---|---|---|
pluginListArray |
array.<string> | A list array of plugin names that should be removed from the plugin registry. |
- Source:
Returns:
True or False to indicate if all the plugins were removed from the plugin registry successfully or not.
- Type
- boolean