UNPKG

copious-transitions

Version:
1,225 lines (364 loc) 22 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: MimeHandling</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: MimeHandling</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span> <span class="ancestors"><a href="Contractual.html">Contractual</a>.</span>MimeHandling<span class="signature">()</span><span class="type-signature"></span></h2> <div class="class-description"><p>MimeHandling provides a collection of methods that serve an API made for retrieving assets which have some mime type, usually related to data stored in a file.</p> <p>The methods access either the <strong>static</strong> or the <strong>dynamic</strong> data providers. Usually, these providers are understood as those that provide static data, premaid and perhaps cached in memory, or they provide dynamically generated data (i.e. they use some processing power and time in order to generate the data to be transmitted on behalf of the request.)</p> <p>The methods call out to the session handler for authorization for delivery. In some cases, the methods make use of token sequencing to build the case for releasing data to the requester. These types of delivery rely on the <code>fetcher</code> method revealed by the static or dynamic provider. In the case of sequencing, provided data may be produced in a first step and then retrieved after some match condition (secret sharing) passes in a second step, where each step corresponds to a request.</p> <p>Note: none of these methods handle streaming. Data is sent back to the requested in JSON object, where the useful part of the object will be in a string or sub-object.</p> <p>The methods return a status code as part of the tupple returned. These codes are HTTP status codes.</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="MimeHandling"><span class="type-signature"></span>new MimeHandling<span class="signature">()</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line24">line 24</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="guarded_dynamic_asset_handler"><span class="type-signature">(async) </span>guarded_dynamic_asset_handler<span class="signature">(asset, body, transmision_headers)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> <p>This method calls the method <code>guarded_kindof_asset_handler</code> with the reference to the GeneralDynamic instance in the member variable <code>dynamics</code>.</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>asset</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>transmision_headers</code></td> <td class="type"> <span class="param-type">object</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="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line153">line 153</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>a tupple really, that has: 1) the status code, 2) the JSON response, 3) possibly data or boolean (false for not in use)</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="guarded_kindof_asset_handler"><span class="type-signature">(async) </span>guarded_kindof_asset_handler<span class="signature">(asset, body, transmision_headers, fetcher)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> <p>This method provide the same logic for both dynamic and static data. The only difference between a request for dynamic and static data, is that the fetcher method is on the static or dynamic instance. So, this method takes the <em>fetcher</em> as a paremeter.</p> <p>For both dynamic and static mime data, the session managers' guard is called. And, if the request passes the guard, then the asset can be processed in the sense that a token object will be made for it by the session manager. The transition object will specify whether or not the mime data will be cached and sent after a seconday transaction or if it will be sent right away.</p> <p>If the secondary action is used, the transition object components that are to be used by the requester (client) are sent along with the repsonse 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>asset</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>transmision_headers</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>fetcher</code></td> <td class="type"> <span class="param-type">function</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="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line100">line 100</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>a tupple really, that has: 1) the status code, 2) the JSON response, 3) possibly data or boolean (false for not in use)</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="guarded_secondary_asset_handler"><span class="type-signature">(async) </span>guarded_secondary_asset_handler<span class="signature">(body)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> <p>When the transition object returned from the session manager's <code>process_asset</code> method requires the <code>secondary_action</code>, it sets up the transition object in cache with the anticipation that this method will be called in response to another request from the client tied to the current session and the transition token set on the transition object by <code>process_asset</code>.</p> <p>This method will only operation if the request's body object has a recognizable token field. Given the token, the cached transition object can be retrieved from the cache. Once it is in hand, the data from the body object and the cached can transtion are passed to the application's matching methods to see if the body data passed tests allowing the request to gain access to previously produced data.</p> <p>For the mime type handlers, <code>key_mime_type_transition</code> can be used to see if the requested mime type is supported by the application.</p> <p>Given the tests pass, the <code>data</code> field of the cached transition is accessed to get the data that will be provided to the requesting client.</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>body</code></td> <td class="type"> <span class="param-type">object</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="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line175">line 175</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>a tupple really, that has: 1) the status code, 2) the JSON response, 3) possibly data or boolean (false for not in use)</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="guarded_static_asset_handler"><span class="type-signature">(async) </span>guarded_static_asset_handler<span class="signature">(asset, body, transmision_headers)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> <p>This method calls the method <code>guarded_kindof_asset_handler</code> with the reference to the GeneralStatic instance in the member variable <code>statics</code>.</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>asset</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>transmision_headers</code></td> <td class="type"> <span class="param-type">object</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="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line137">line 137</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>a tupple really, that has: 1) the status code, 2) the JSON response, 3) possibly data or boolean (false for not in use)</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="static_asset_handler"><span class="type-signature">(async) </span>static_asset_handler<span class="signature">(asset, body, transmision_headers)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> <p>This method sends the request body into session manager's <code>guard_static</code> to check access. Then, if access is allowed, this method calls upon the statics module to get the object.</p> <p>The statics module returns an object that should mention the mime type of the data along with the data. The object returned must have two fields:</p> <ul> <li><code>mime_type</code> - the kind of media being returned</li> <li><code>string</code> - the media being returned in string format</li> </ul> <p>The application must understand the relationship between the client and the server in how data delivered as a string should be processed for use.</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>asset</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>an identifier of the asset requested</p></td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>data relating to the user session and other data useful in finding the asset and establishing access</p></td> </tr> <tr> <td class="name"><code>transmision_headers</code></td> <td class="type"> <span class="param-type">object</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="contractual_mime_processing.js.html">contractual/mime_processing.js</a>, <a href="contractual_mime_processing.js.html#line56">line 56</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <ul> <li>a tupple really, that has: 1) the status code, 2) the JSON response, 3) possibly data or boolean (false for not in use)</li> </ul> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Contractual.html">Contractual</a></li><li><a href="CopiousTransitions.html">CopiousTransitions</a></li><li><a href="DefaultDB.html">DefaultDB</a></li><li><a href="base.html">base</a></li><li><a href="field_validators.html">field_validators</a></li></ul><h3>Classes</h3><ul><li><a href="Contractual.LocalTObjectCache.html">LocalTObjectCache</a></li><li><a href="Contractual.MimeHandling.html">MimeHandling</a></li><li><a href="Contractual.TransitionHandling.html">TransitionHandling</a></li><li><a href="Contractual.UserHandling.html">UserHandling</a></li><li><a href="CopiousTransitions.CopiousTransitions.html">CopiousTransitions</a></li><li><a href="DefaultDB.CustomizationMethodsByApplication.html">CustomizationMethodsByApplication</a></li><li><a href="DefaultDB.FauxInMemStore.html">FauxInMemStore</a></li><li><a href="DefaultDB.FileMapper.html">FileMapper</a></li><li><a href="DefaultDB.FilesAndRelays.html">FilesAndRelays</a></li><li><a href="DefaultDB.FilesAndRelays_base.html">FilesAndRelays_base</a></li><li><a href="DefaultDB.LocalStaticDB.html">LocalStaticDB</a></li><li><a href="DefaultDB.LocalStorageLifeCycle.html">LocalStorageLifeCycle</a></li><li><a href="DefaultDB.LocalStorageSerialization.html">LocalStorageSerialization</a></li><li><a href="DefaultDB.PageableMemStoreElement.html">PageableMemStoreElement</a></li><li><a href="DefaultDB.PersistenceContracts.html">PersistenceContracts</a></li><li><a href="DefaultDB.RemoteMessaging.html">RemoteMessaging</a></li><li><a href="DefaultDB.StaticDBDefault.html">StaticDBDefault</a></li><li><a href="GeneralUserDBWrapperImpl.html">GeneralUserDBWrapperImpl</a></li><li><a href="SessionTokenManager.html">SessionTokenManager</a></li><li><a href="base.DBClass.html">DBClass</a></li><li><a href="base.EndpointManager.html">EndpointManager</a></li><li><a href="base.GeneralAppLifeCycle.html">GeneralAppLifeCycle</a></li><li><a href="base.GeneralAuth.html">GeneralAuth</a></li><li><a href="base.GeneralBusiness.html">GeneralBusiness</a></li><li><a href="base.GeneralDynamic.html">GeneralDynamic</a></li><li><a href="base.GeneralMiddleWare.html">GeneralMiddleWare</a></li><li><a href="base.GeneralStatic.html">GeneralStatic</a></li><li><a href="base.GeneralTransitionEngImpl.html">GeneralTransitionEngImpl</a></li><li><a href="base.SessionManager.html">SessionManager</a></li><li><a href="base.SessionManager_Lite.html">SessionManager_Lite</a></li><li><a href="base.TaggedTransition.html">TaggedTransition</a></li><li><a href="base.TokenTables.html">TokenTables</a></li><li><a href="base.UserMessageEndpoint.html">UserMessageEndpoint</a></li><li><a href="base.WebSocketManager.html">WebSocketManager</a></li><li><a href="field_validators.DataLookupField.html">DataLookupField</a></li><li><a href="field_validators.EmailField.html">EmailField</a></li><li><a href="field_validators.EmailVerifyField.html">EmailVerifyField</a></li><li><a href="field_validators.FieldTest.html">FieldTest</a></li><li><a href="field_validators.FieldValidatorTools.html">FieldValidatorTools</a></li><li><a href="field_validators.ForeignAuth.html">ForeignAuth</a></li><li><a href="field_validators.GeneralValidator.html">GeneralValidator</a></li><li><a href="field_validators.LengthyAlphabetField.html">LengthyAlphabetField</a></li><li><a href="field_validators.LengthyDigitalField.html">LengthyDigitalField</a></li><li><a href="field_validators.LengthyField.html">LengthyField</a></li><li><a href="field_validators.LengthyStringField.html">LengthyStringField</a></li><li><a href="field_validators.PasswordField.html">PasswordField</a></li><li><a href="field_validators.PasswordVerifyField.html">PasswordVerifyField</a></li><li><a href="field_validators.TypeCheckField.html">TypeCheckField</a></li></ul><h3>Global</h3><ul><li><a href="global.html#generate_password_block">generate_password_block</a></li><li><a href="global.html#load_configuration">load_configuration</a></li><li><a href="global.html#load_parameters">load_parameters</a></li><li><a href="global.html#module_top">module_top</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue Oct 31 2023 17:32:59 GMT-0700 (Pacific Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>