state-tokens
Version:
Classes and type definitions for state transition tokens for libraries that manage tokens as objects in sets and tables.
1,171 lines (271 loc) • 13 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: TransitionObject</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: TransitionObject</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>TransitionObject<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description"><p>Formalize the definition of a transition object.
A Transition Object is a record that pairs a transition token with a session token
and also that provides basic information about server side and client side operations
necessary to coordinate a transition of state between the two.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="TransitionObject"><span class="type-signature"></span>new TransitionObject<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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="add_extra_field"><span class="type-signature"></span>add_extra_field<span class="signature">(fld)</span><span class="type-signature"></span></h4>
<div class="description">
<p>The fields returned from <code>to_object</code> are by default just a few provided by the base classs.
For <strong>TransitionObject</strong> these are just the following: "token", "secondary_action", "session_token", "type"
Use this method to add more field to be included in the <code>to_object</code> report.</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>fld</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line84">line 84</a>
</li></ul></dd>
</dl>
<h4 class="name" id="add_extra_fields"><span class="type-signature"></span>add_extra_fields<span class="signature">(fld_list)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Call <code>add_extra_field</code> for each member of the <code>fld_list</code> parameter.</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>fld_list</code></td>
<td class="type">
<span class="param-type">Array.<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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line96">line 96</a>
</li></ul></dd>
</dl>
<h4 class="name" id="add_to_elements"><span class="type-signature"></span>add_to_elements<span class="signature">(obj)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Extend the elements object with more fields and info. These may overwrite existing fields.</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>obj</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line74">line 74</a>
</li></ul></dd>
</dl>
<h4 class="name" id="clear_session"><span class="type-signature"></span>clear_session<span class="signature">(token)</span><span class="type-signature"></span></h4>
<div class="description">
<p>If this token has been assigned to a session, then erase the session identifier and replace it with
a message of abandonment, 'sess+gone'.</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>token</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line65">line 65</a>
</li></ul></dd>
</dl>
<h4 class="name" id="set_session"><span class="type-signature"></span>set_session<span class="signature">(sess_id)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Set the session id with the expectation that this assertion declares that the token belong to a session.</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>sess_id</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line55">line 55</a>
</li></ul></dd>
</dl>
<h4 class="name" id="set_token"><span class="type-signature"></span>set_token<span class="signature">(token)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Fix the token of this 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>token</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line47">line 47</a>
</li></ul></dd>
</dl>
<h4 class="name" id="to_object"><span class="type-signature"></span>to_object<span class="signature">(extras<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {object}</span></h4>
<div class="description">
<p>Returns an object without class information containing a minimal set of top level fields refering to current values.
If the <em>extras</em> parameter is supplied, this method assumes that it is an array of field names.
The extra field will be added to the object produced by this method.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>extras</code></td>
<td class="type">
<span class="param-type">Array.<string></span>
</td>
<td class="attributes">
<optional><br>
</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="transition_token.js.html">transition_token.js</a>, <a href="transition_token.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<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="LoginTransitionObject.html">LoginTransitionObject</a></li><li><a href="LogoutTransitionObject.html">LogoutTransitionObject</a></li><li><a href="ProcessTransitionObject.html">ProcessTransitionObject</a></li><li><a href="RegistrationTransitionObject.html">RegistrationTransitionObject</a></li><li><a href="TransitionObject.html">TransitionObject</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Thu Jul 13 2023 16:36:02 GMT-0700 (Pacific Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>