UNPKG

periodicjs.core.controller

Version:
2,068 lines (464 loc) 23.6 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="_createModel"><span class="type-signature"></span>_createModel<span class="signature">()</span><span class="type-signature"> &rarr; {Fuction}</span></h4> <div class="description"> <p>Creates a function that takes configurable options and creates a document. Alias for CoreController.db.default.create or CoreController.meta.create</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_data.js.html">utility/aliased/aliased_data.js</a>, <a href="utility_aliased_aliased_data.js.html#line45">line 45</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that creates a document</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Fuction</span> </dd> </dl> <h4 class="name" id="_deleteModel"><span class="type-signature"></span>_deleteModel<span class="signature">()</span><span class="type-signature"> &rarr; {Fuction}</span></h4> <div class="description"> <p>Creates a function that takes configurable options and deletes a document. Alias for CoreController.db.default.delete or CoreController.meta.delete</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_data.js.html">utility/aliased/aliased_data.js</a>, <a href="utility_aliased_aliased_data.js.html#line81">line 81</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that deletes a document</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Fuction</span> </dd> </dl> <h4 class="name" id="_getPluginViewDefaultTemplate"><span class="type-signature"></span>_getPluginViewDefaultTemplate<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will resolve a template file path from a set of directories. Alias for CoreController._utility_responder.render</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line12">line 12</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will resolve a valid file path for a template</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_getViewModelProperties"><span class="type-signature"></span>_getViewModelProperties<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will get inflected values from a given string</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line189">line 189</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will get inflected values from a given string</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_handleDocumentQueryErrorResponse"><span class="type-signature"></span>_handleDocumentQueryErrorResponse<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will render an error view from a template. Alias for CoreController._utility_responder.error</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line121">line 121</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will render an error view from a template and send response</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_handleDocumentQueryRender"><span class="type-signature"></span>_handleDocumentQueryRender<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will render a template and send HTTP response to client. Alias for CoreController._utility_responder.render</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line82">line 82</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will render a template and send data to client</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_INITIALIZE_ALIASED_UTILITIES"><span class="type-signature"></span>_INITIALIZE_ALIASED_UTILITIES<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Initializes aliased utility methods and set the on &quot;this&quot;</p> </div> <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#line39">line 39</a> </li></ul></dd> </dl> <h4 class="name" id="_INITIALIZE_UTILITY_RESPONDER"><span class="type-signature"></span>_INITIALIZE_UTILITY_RESPONDER<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Initializes a utility HTML responder adapter that is used to render templates if protocol responder is not an HTML adapter and set it to the &quot;_utility_responder&quot; property. This property is not writable, configurable or enumerable</p> </div> <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#line27">line 27</a> </li></ul></dd> </dl> <h4 class="name" id="_loadModel"><span class="type-signature"></span>_loadModel<span class="signature">()</span><span class="type-signature"> &rarr; {Fuction}</span></h4> <div class="description"> <p>Creates a function that takes configurable options and queries the database for a single document. Alias for CoreController.db.default.load or CoreController.meta.load</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_data.js.html">utility/aliased/aliased_data.js</a>, <a href="utility_aliased_aliased_data.js.html#line9">line 9</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that queries the database for a single document</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Fuction</span> </dd> </dl> <h4 class="name" id="_logError"><span class="type-signature"></span>_logError<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Logs an error. Alias for CoreController.protocol.error or CoreController.meta.error</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_logger.js.html">utility/aliased/aliased_logger.js</a>, <a href="utility_aliased_aliased_logger.js.html#line9">line 9</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns a function which logs an error using the CoreController logger</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_logWarning"><span class="type-signature"></span>_logWarning<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Logs a warning. Alias for CoreController.protocol.warn or CoreController.meta.warn</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_logger.js.html">utility/aliased/aliased_logger.js</a>, <a href="utility_aliased_aliased_logger.js.html#line28">line 28</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Returns a function which logs warnings using CoreController logger</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_renderView"><span class="type-signature"></span>_renderView<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will render data from a view put can accept additional data for the template and always send a response. Alias for CoreController.protocol.respond</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line164">line 164</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will render a view from a template given template data</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_respondInKind"><span class="type-signature"></span>_respondInKind<span class="signature">()</span><span class="type-signature"> &rarr; {function}</span></h4> <div class="description"> <p>Creates a function that will send a HTTP response or return a formatted response object. Alias for CoreController.protocol.respond</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_protocol.js.html">utility/aliased/aliased_protocol.js</a>, <a href="utility_aliased_aliased_protocol.js.html#line37">line 37</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that will format response data and send a response</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">function</span> </dd> </dl> <h4 class="name" id="_searchModel"><span class="type-signature"></span>_searchModel<span class="signature">()</span><span class="type-signature"> &rarr; {Fuction}</span></h4> <div class="description"> <p>Creates a function that takes configurable options and queries the database for multiple documents. Alias for CoreController.db.default.search or CoreController.meta.search</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_data.js.html">utility/aliased/aliased_data.js</a>, <a href="utility_aliased_aliased_data.js.html#line27">line 27</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that queries the database for multiple documents</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Fuction</span> </dd> </dl> <h4 class="name" id="_STARTUP"><span class="type-signature"></span>_STARTUP<span class="signature">(options)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> <p>Called a initialization of a &quot;new&quot; CoreController. Implements the &quot;meta&quot; property which grants additional access to child adapter metods through a Proxy. Initialized adapters according to configurations and default adapters</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>Configuration options for adapters</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>skip_responder</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If true responder adapters will not be initialized</p></td> </tr> <tr> <td class="name"><code>skip_db</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last"><p>If true db adapters will not be initialized</p></td> </tr> <tr> <td class="name"><code>skip_protocol</code></td> <td class="type"> <span class="param-type">Booelean</span> </td> <td class="description last"><p>If true protocol adapter will not be initialized</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#line64">line 64</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="_updateModel"><span class="type-signature"></span>_updateModel<span class="signature">()</span><span class="type-signature"> &rarr; {Fuction}</span></h4> <div class="description"> <p>Creates a function that takes configurable options and updates a document. Alias for CoreController.db.default.update or CoreController.meta.update</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_aliased_aliased_data.js.html">utility/aliased/aliased_data.js</a>, <a href="utility_aliased_aliased_data.js.html#line63">line 63</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A function that updates a document</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Fuction</span> </dd> </dl> <h4 class="name" id="save_revision"><span class="type-signature"></span>save_revision<span class="signature">(req, res, next)</span><span class="type-signature"></span></h4> <div class="description"> <p>Express middleware that appends a saverevision flag to the req object</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>req</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Express request object</p></td> </tr> <tr> <td class="name"><code>res</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"><p>Express response object</p></td> </tr> <tr> <td class="name"><code>next</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>Express next function</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utility_middleware.js.html">utility/middleware.js</a>, <a href="utility_middleware.js.html#line9">line 9</a> </li></ul></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>