UNPKG

periodicjs

Version:

Periodic is a rapid enterprise application framework for data driven web and mobile applications.

2,554 lines (576 loc) 26.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="_admin_prefix"><span class="type-signature"></span>_admin_prefix<span class="signature">(adminPath)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> <p>returns a route string without the precending '/'</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>adminPath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_utilities_routing.js.html">lib/utilities/routing.js</a>, <a href="lib_utilities_routing.js.html#line23">line 23</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="_manifest_prefix"><span class="type-signature"></span>_manifest_prefix<span class="signature">(adminPath)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> <p>returns a route string that always has a preceding '/' and a suffixed '/', this is typically used for specifiying links to paths as absolute urls</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>adminPath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_utilities_routing.js.html">lib/utilities/routing.js</a>, <a href="lib_utilities_routing.js.html#line33">line 33</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="_route_prefix"><span class="type-signature"></span>_route_prefix<span class="signature">(adminPath)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> <p>returns a string that's used in an express router that's always prefixed with a preceding '/'</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>adminPath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_utilities_routing.js.html">lib/utilities/routing.js</a>, <a href="lib_utilities_routing.js.html#line9">line 9</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>route used for express router, that's always prefixed with a &quot;/&quot;</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="all_prefixes"><span class="type-signature"></span>all_prefixes<span class="signature">(adminPath)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> <p>short hand function to return all prefix types</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>adminPath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_utilities_routing.js.html">lib/utilities/routing.js</a>, <a href="lib_utilities_routing.js.html#line46">line 46</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="configRuntimeEnvironment"><span class="type-signature"></span>configRuntimeEnvironment<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>sets the runtime environment correctly, there are multiple ways to set the runtime environment (via command line arguments, or via environment variables)<br>It will prioritize loading via command line argument first, and then environment variables, and finally it will use the last runtime environment</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_runtime.js.html">lib/init/runtime.js</a>, <a href="lib_init_runtime.js.html#line77">line 77</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>configRuntimeEnvironment sets up application config db</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="configureLogger"><span class="type-signature"></span>configureLogger<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>configures winston</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_logger.js.html">lib/init/logger.js</a>, <a href="lib_init_logger.js.html#line57">line 57</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>configureLogger sets up winston</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="configureLowkie"><span class="type-signature"></span>configureLowkie<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>configureLowkie creates a loki connection to store DB based configurations</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_config.js.html">lib/init/config.js</a>, <a href="lib_init_config.js.html#line24">line 24</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>connects to configuration db</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="configureMongoose"><span class="type-signature"></span>configureMongoose<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>configureMongoose creates a mongo connection to store DB based configurations</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_config.js.html">lib/init/config.js</a>, <a href="lib_init_config.js.html#line64">line 64</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>connects to configuration db</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="configureSequelize"><span class="type-signature"></span>configureSequelize<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>configureSequelize creates a mongo connection to store DB based configurations</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_config.js.html">lib/init/config.js</a>, <a href="lib_init_config.js.html#line122">line 122</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>connects to configuration db</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="configureViews"><span class="type-signature"></span>configureViews<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>configure express view rendering options</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_express.js.html">lib/init/express.js</a>, <a href="lib_init_express.js.html#line33">line 33</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="endTimer"><span class="type-signature"></span>endTimer<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Ends initialization console timer</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_consoleTimer.js.html">lib/init/consoleTimer.js</a>, <a href="lib_init_consoleTimer.js.html#line28">line 28</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Promise</p> </div> <h4 class="name" id="formatResponse"><span class="type-signature"></span>formatResponse<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> <p>Enforces the shape of an api response, by allow for three properties (result,status and data) all other properties are on data</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options.result</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>result of request (usually sucess or error)</p></td> </tr> <tr> <td class="name"><code>options.status</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>http resonse code equivalent</p></td> </tr> <tr> <td class="name"><code>options.data</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>data for response</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_utilities_routing.js.html">lib/utilities/routing.js</a>, <a href="lib_utilities_routing.js.html#line79">line 79</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>with the shape {result,status,data}</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="getEnv"><span class="type-signature"></span>getEnv<span class="signature">(argv)</span><span class="type-signature"> &rarr; {string|boolean}</span></h4> <div class="description"> <p>get the application environment from command line arguments</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>argv</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>parsed command line arguments</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_runtime.js.html">lib/init/runtime.js</a>, <a href="lib_init_runtime.js.html#line12">line 12</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>returns the value of the enviroment or false</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> | <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="handler"><span class="type-signature"></span>handler<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <div class="description"> <p>this is the proxy handler for periodic, provides access to native expess methods as well.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_periodicProxyHandler.js.html">lib/periodicProxyHandler.js</a>, <a href="lib_periodicProxyHandler.js.html#line3">line 3</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="initializeExpress"><span class="type-signature"></span>initializeExpress<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4> <div class="description"> <p>sets the runtime environment correctly</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_express.js.html">lib/init/express.js</a>, <a href="lib_init_express.js.html#line587">line 587</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>configRuntimeEnvironment sets up application config db</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="loadConfiguration"><span class="type-signature"></span>loadConfiguration<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>reads content/config/(config.json||config.js) for the configuration database</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_config.js.html">lib/init/config.js</a>, <a href="lib_init_config.js.html#line170">line 170</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Promise loadConfiguration sets up application config db</p> </div> <h4 class="name" id="setAppRunningEnv"><span class="type-signature"></span>setAppRunningEnv<span class="signature">(env, operation, processRuntimeConfig)</span><span class="type-signature"> &rarr; {boolean|Promise}</span></h4> <div class="description"> <p>sets the application runtime environment and save last run environment into configuration</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>env</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>this is the enviroment variable to set</p></td> </tr> <tr> <td class="name"><code>operation</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>either update the config db, or create a new entry for process.runtime</p></td> </tr> <tr> <td class="name"><code>processRuntimeConfig</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>existing runtime config from configuration database</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_runtime.js.html">lib/init/runtime.js</a>, <a href="lib_init_runtime.js.html#line36">line 36</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>returns a resolved promise after configuration database operation</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> | <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id="setUpFolderStructure"><span class="type-signature"></span>setUpFolderStructure<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>this will setup a periodic application folder structure if one doesnt exist, it will not overwrite existing configs</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_folderStructure.js.html">lib/init/folderStructure.js</a>, <a href="lib_init_folderStructure.js.html#line12">line 12</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Promise setUpFolderStructure will copy folders from the application __STRUCTURE directory to initialize the application</p> </div> <h4 class="name" id="startTimer"><span class="type-signature"></span>startTimer<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Starts intialization console timer</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_init_consoleTimer.js.html">lib/init/consoleTimer.js</a>, <a href="lib_init_consoleTimer.js.html#line12">line 12</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Promise</p> </div> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-periodic.html">periodic</a></li></ul><h3>Classes</h3><ul><li><a href="Periodic.html">Periodic</a></li><li><a href="Periodic.Periodic.html">Periodic</a></li></ul><h3>Global</h3><ul><li><a href="global.html#_admin_prefix">_admin_prefix</a></li><li><a href="global.html#_manifest_prefix">_manifest_prefix</a></li><li><a href="global.html#_route_prefix">_route_prefix</a></li><li><a href="global.html#all_prefixes">all_prefixes</a></li><li><a href="global.html#configRuntimeEnvironment">configRuntimeEnvironment</a></li><li><a href="global.html#configureLogger">configureLogger</a></li><li><a href="global.html#configureLowkie">configureLowkie</a></li><li><a href="global.html#configureMongoose">configureMongoose</a></li><li><a href="global.html#configureSequelize">configureSequelize</a></li><li><a href="global.html#configureViews">configureViews</a></li><li><a href="global.html#endTimer">endTimer</a></li><li><a href="global.html#formatResponse">formatResponse</a></li><li><a href="global.html#getEnv">getEnv</a></li><li><a href="global.html#handler">handler</a></li><li><a href="global.html#initializeExpress">initializeExpress</a></li><li><a href="global.html#loadConfiguration">loadConfiguration</a></li><li><a href="global.html#setAppRunningEnv">setAppRunningEnv</a></li><li><a href="global.html#setUpFolderStructure">setUpFolderStructure</a></li><li><a href="global.html#startTimer">startTimer</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Jul 18 2018 23:08:12 GMT-0400 (Eastern Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>