UNPKG

periodicjs.core.controller

Version:
1,096 lines (352 loc) 15.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: CORE</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">Class: CORE</h1> <section> <header> <h2>CORE</h2> <div class="class-description"><p>CoreController - a class that handles implementing API strategies and providing CRUD operation convenience methods and middleware</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="CORE"><span class="type-signature"></span>new CORE<span class="signature">(resources, options)</span><span class="type-signature"></span></h4> <div class="description"> <p>Contructs a new Core instance</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>resources</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Periodicjs shared resources</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>logger</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>A logger module that should be used in logging errors, info and warns</p></td> </tr> <tr> <td class="name"><code>settings</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Contains various application settings including theme and environment specific configurations</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>compatibility</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If strictly false compatibility mode CoreController will not be initialized and all alias methods will reference their v10 counterparts</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>app</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Should contain a locals property that has local data to be shared with constructed object</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configurable options for adapters and overrides</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>compatibility</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If strictly false compatibility mode CoreController will not be initialized and all alias methods will reference their v10 counterparts</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_core.js.html">lib/core.js</a>, <a href="lib_core.js.html#line87">line 87</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="initialize_db"><span class="type-signature"></span>initialize_db<span class="signature">(options)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> <p>Initializes database adapters for each given model in configuration and assigns them to the this.db object indexed by model name and assigns a default mongo adapter to the .default property on this.db</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</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configurable options for db adapters (see periodicjs.core.data for more details)</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>db_configuration</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configuration for db adapters</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_core.js.html">lib/core.js</a>, <a href="lib_core.js.html#line160">line 160</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>&quot;this&quot;</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="initialize_protocol"><span class="type-signature"></span>initialize_protocol<span class="signature">(options, utilities<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> <p>Initializes a protcol adapter and assigns it to the .protocol property on &quot;this&quot;. The active protocol adapter is used for sending responses to the client and for setting up an API strategy</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>Configurable options for protocol adapter (see periodicjs.core.protocols for more details)</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>protocol_configuration</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configuration for protocol adapter</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>utilities</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> CoreUtilities </td> <td class="description last"><p>A set of utility methods that should be accessible by protocol adapter</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_core.js.html">lib/core.js</a>, <a href="lib_core.js.html#line139">line 139</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>&quot;this&quot;</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="initialize_responder"><span class="type-signature"></span>initialize_responder<span class="signature">(options)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> <p>Initializes a responder and assigns it to the .responder property on &quot;this&quot;. The active responder will also be used as the responder for any protocol adapters initialized after this is called</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</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configurable options for responder (see periodicjs.core.responder for more details)</p> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>responder_configuration</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Configuration for response adapter</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="lib_core.js.html">lib/core.js</a>, <a href="lib_core.js.html#line127">line 127</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>&quot;this&quot;</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CORE.html">CORE</a></li></ul><h3>Global</h3><ul><li><a href="global.html#_createModel">_createModel</a></li><li><a href="global.html#_deleteModel">_deleteModel</a></li><li><a href="global.html#_getPluginViewDefaultTemplate">_getPluginViewDefaultTemplate</a></li><li><a href="global.html#_getViewModelProperties">_getViewModelProperties</a></li><li><a href="global.html#_handleDocumentQueryErrorResponse">_handleDocumentQueryErrorResponse</a></li><li><a href="global.html#_handleDocumentQueryRender">_handleDocumentQueryRender</a></li><li><a href="global.html#_INITIALIZE_ALIASED_UTILITIES">_INITIALIZE_ALIASED_UTILITIES</a></li><li><a href="global.html#_INITIALIZE_UTILITY_RESPONDER">_INITIALIZE_UTILITY_RESPONDER</a></li><li><a href="global.html#_loadModel">_loadModel</a></li><li><a href="global.html#_logError">_logError</a></li><li><a href="global.html#_logWarning">_logWarning</a></li><li><a href="global.html#_renderView">_renderView</a></li><li><a href="global.html#_respondInKind">_respondInKind</a></li><li><a href="global.html#_searchModel">_searchModel</a></li><li><a href="global.html#_STARTUP">_STARTUP</a></li><li><a href="global.html#_updateModel">_updateModel</a></li><li><a href="global.html#save_revision">save_revision</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Dec 23 2016 13:59:15 GMT-0500 (EST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>