# Module: chiefData

Contains all the functions to manage the loading and processing of data, such as XML files, CSV files or JSON files. Additional file type processing should be added in this module.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - controllers/chiefData.js, line 1

### Requires

- module:dataBroker
- module:themeBroker
- module:configurator
- module:loggers
- @haystacks/constants
- path

### Methods

#### (inner) addConstantsValidationData(arrayValidationData) → {void}

Calls the dataBroker to ad constants validation data to the constants validation data structure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`arrayValidationData` | array.<array.<string, object>> | An array of arrays that contains all of the constants library validation names and data objects.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 380

##### Returns:

Type
  void

#### (inner) addThemeData(themeData, contextName)

Adds theme data, theme names and theme paths for resource paths external to the framework. Ex: Application, Plugins

##### Parameters:

Name | Type | Description
--- | --- | ---
`themeData` | object | A JSON object that contains the externally defined theme data names and data paths.
`contextName` | string | A context name that indicates where the data is coming from. Ex: Application, Plugins

Source:
  - controllers/chiefData.js, line 82

#### (inner) determineThemeDebugConfigFilesToLoad(themeConfigPathName) → {array.<string>}

If the debugSettings flag is already set, then look up the specified path name and scan the path to determine all of the theme debug config files that should be loaded.

##### Parameters:

Name | Type | Description
--- | --- | ---
`themeConfigPathName` | string | The configuration name of the path that should be looked up for scanningg purposes.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 125

##### Returns:

An array of file names and paths that should be used when loading the theme debug configuration files.

Type
  array.<string>

#### (inner) generateThemeDataFromThemeRootPath(themesRootPath) → {object}

Scans the specified root path for folders and determines a list of theme names and theme paths, returns this data as a JSON data object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`themesRootPath` | string | The root path where the themes folders are located. This is the path that should be scanned.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 104

##### Returns:

A JSON object that contains the theme names and theme paths from the specified root path.

Type
  object

#### (inner) getAndProcessCsvData(pathAndFilename, contextName) → {object}

Loads the specified file, parses it and converts all the data to the appropriate format.

##### Parameters:

Name | Type | Description
--- | --- | ---
`pathAndFilename` | string | The path and file name of the CSV file that should be loaded and parsed into JSON objects.
`contextName` | string | The name that should be used when adding the objects to the D data structure for data-sharing.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 153

##### Returns:

A parsed CSV JSON object where all the values have been converted from their string representation into actual values of appropriate type.

Type
  object

#### (inner) getAndProcessXmlData(pathAndFilename) → {object}

Loads the specified file, parses it and converts all values into their appropriate data types.

##### Parameters:

Name | Type | Description
--- | --- | ---
`pathAndFilename` | string | The path and file name of the XML file that should be loaded and parsed into JSON objects.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 177

##### Returns:

A parsed XML JSON object where all the values have been converted from their string representation into actual values of appropriate type.

Type
  object

#### (inner) initializeConstantsValidationData() → {void}

Calls the dataBroker to initialize the constants verification data structure.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 366

##### Returns:

Type
  void

#### (inner) initThemes() → {void}

Initializes the theme data for the framework.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 68

##### Returns:

Type
  void

#### (inner) searchForUniversalDebugConfigSetting(appConfigPathName, frameworkConfigPathName) → {boolean}

Searches all of the config data files for a general solution to the debugSettings configuration setting.

##### Parameters:

Name | Type | Description
--- | --- | ---
`appConfigPathName` | string | The name of the configuration setting that has the path for the appConfigPath.
`frameworkConfigPathName` | string | The name of the configuration setting that has the path for the frameworkConfigPath.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 31

##### Returns:

A True or False to indicate if the debugSettings was found to be true in either of the configuration settings (appConfig Or frameworkConfig).

Type
  boolean

#### (inner) setupAllCsvData(dataPathConfigurationName, contextName) → {object}

Sets up all of the specified CSV data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataPathConfigurationName` | string | The name of the configuration setting that has the path we should search.
`contextName` | string | The context name that should be used when adding data to the D data structure.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 200

##### Returns:

A JSON object that contains all of the data that was loaded from all the CSV files and merged together.

Type
  object

#### (inner) setupAllJsonConfigData(dataPathConfigurationName, contextName) → {object}

Sets up all of the JSON data at the specified configuration path.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataPathConfigurationName` | string | The name of the configuration setting that has the path we should search.
`contextName` | string | The context name that should be used when adding data to the D data structure.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 290

##### Returns:

A JSON object that contains all of the data that was loaded and merged together.

Type
  object

#### (inner) setupAllJsonConfigPluginData(configFilesPath, contextName)

Sets up all of the JSON data at the specified configuration path with regard to plugin configuration data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`configFilesPath` | string | The path to the configuration files that should be loaded.
`contextName` | string | The type of configuration data that should be loaded.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 333

##### Returns:

A JSON object that contains all of the data that was loaded and merged together.

#### (inner) setupAllXmlData(dataPathConfigurationName, contextName) → {object}

Sets up all of the specified XML data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataPathConfigurationName` | string | The name of the configuration setting that has the path we should search.
`contextName` | string | The context name that should be used when adding data to the D data structure.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 231

##### Returns:

A JSON object that contains all of the data that was loaded from all the XML files and merged together.

Type
  object

#### (inner) setupAllXmlPluginData(dataPath, contextName) → {object}

Sets up all of the specified XML data for the plugin.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dataPath` | string | The fully qualified path to the data files that should be loaded and parsed.
`contextName` | string | The context name that should describe the kind of data that is being loaded and parsed.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefData.js, line 262

##### Returns:

A JSON object that contains all of the data that was loaded from all the XML files and merged together.

Type
  object