lumenize
Version:
Illuminating the forest AND the trees in your data.
1 lines • 19.9 kB
JavaScript
Ext.data.JsonP.Lumenize_Store({"tagname":"class","name":"Lumenize.Store","autodetected":{},"files":[{"filename":"Store.coffee.js","href":"Store.coffee.html#Lumenize-Store"}],"members":[{"name":"defaultValues","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-defaultValues","meta":{}},{"name":"idField","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-idField","meta":{}},{"name":"tz","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-tz","meta":{}},{"name":"uniqueIDField","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-uniqueIDField","meta":{}},{"name":"validFromField","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-validFromField","meta":{}},{"name":"validToField","tagname":"cfg","owner":"Lumenize.Store","id":"cfg-validToField","meta":{}},{"name":"byUniqueID","tagname":"property","owner":"Lumenize.Store","id":"property-byUniqueID","meta":{}},{"name":"fields","tagname":"property","owner":"Lumenize.Store","id":"property-fields","meta":{}},{"name":"snapshots","tagname":"property","owner":"Lumenize.Store","id":"property-snapshots","meta":{}},{"name":"constructor","tagname":"method","owner":"Lumenize.Store","id":"method-constructor","meta":{}},{"name":"addSnapshots","tagname":"method","owner":"Lumenize.Store","id":"method-addSnapshots","meta":{"chainable":true}},{"name":"filtered","tagname":"method","owner":"Lumenize.Store","id":"method-filtered","meta":{}},{"name":"stateBoundaryCrossedFiltered","tagname":"method","owner":"Lumenize.Store","id":"method-stateBoundaryCrossedFiltered","meta":{}},{"name":"stateBoundaryCrossedFilteredBothWays","tagname":"method","owner":"Lumenize.Store","id":"method-stateBoundaryCrossedFilteredBothWays","meta":{}}],"alternateClassNames":[],"aliases":{},"id":"class-Lumenize.Store","short_doc":"An efficient, in-memory, datastore for snapshot data. ...","component":false,"superclasses":[],"subclasses":[],"mixedInto":[],"mixins":[],"parentMixins":[],"requires":[],"uses":[],"html":"<div><pre class=\"hierarchy\"><h4>Files</h4><div class='dependency'><a href='source/Store.coffee.html#Lumenize-Store' target='_blank'>Store.coffee.js</a></div></pre><div class='doc-contents'><p><strong>An efficient, in-memory, datastore for snapshot data.</strong></p>\n\n<p>Note, this store takes advantage of JavaScript's prototype inheritance to store snapshots in memory. Since the next snapshot might\nonly have one field different from the prior one, this saves a ton of space. There is some concern that this will\nslow down certain operations because the JavaScript engine has to search all fields in the current level before bumping up\nto the next. However, there is some evidence that modern JavaScript implementations handle this very efficiently.</p>\n\n<p>However, this choice means that each row in the snapshots array doesn't have all of the fields.</p>\n\n<p>Store keeps track of all of the fields it has seen so you can flatten a row(s) if necessary.</p>\n\n<p>Example:</p>\n\n<pre><code>{Store} = require('../')\n\nsnapshotCSVStyleArray = [\n ['RecordID', 'DefectID', 'Created_Date', 'Severity', 'Modified_Date', 'Status'],\n [ 1, 1, '2014-06-16', 5, '2014-06-16', 'New'],\n [ 100, 1, '2014-06-16', 5, '2014-07-17', 'In Progress'],\n [ 1000, 1, '2014-06-16', 5, '2014-08-18', 'Done'],\n]\n\ndefects = require('../').csvStyleArray_To_ArrayOfMaps(snapshotCSVStyleArray)\n\nconfig =\n uniqueIDField: 'DefectID'\n validFromField: 'Modified_Date'\n idField: 'RecordID'\n defaultValues:\n Severity: 4\n\nstore = new Store(config, defects)\n\nconsole.log(require('../').table.toString(store.snapshots, store.fields))\n# | Modified_Date | _ValidTo | _PreviousValues | DefectID | RecordID | Created_Date | Severity | Status |\n# | ------------------------ | ------------------------ | --------------- | -------- | -------- | ------------ | -------- | ----------- |\n# | 2014-06-16T00:00:00.000Z | 2014-07-17T00:00:00.000Z | [object Object] | 1 | 1 | 2014-06-16 | 5 | New |\n# | 2014-07-17T00:00:00.000Z | 2014-08-18T00:00:00.000Z | [object Object] | 1 | 100 | 2014-06-16 | 5 | In Progress |\n# | 2014-08-18T00:00:00.000Z | 9999-01-01T00:00:00.000Z | [object Object] | 1 | 1000 | 2014-06-16 | 5 | Done |\n</code></pre>\n\n<p>That's pretty boring. We pretty much got out what we put in. There are a few things to notice though. First,\nNotice how the <em>ValidTo field is automatically set. Also, notice that it added the </em>PreviousValues field. This is\na record of the immediately proceeding values for the fields that changed. In this way, the records not only\nrepresent the current snapshot; they also represent the state transition that occured to get into this snapshot\nstate. That's what stateBoundaryCrossedFilter and other methods key off of.</p>\n\n<p>Also, under the covers, the prototype of each snapshot is the prior snapshot and only the fields that changed\nare actually stored in the next snapshot. So:</p>\n\n<pre><code>console.log(store.snapshots[1] is store.snapshots[2].__proto__)\n# true\n</code></pre>\n\n<p>The Store also keeps the equivalent of a database index on uniqueIDField and keeps a pointer to the last snapshot\nfor each particular uniqueIDField. This provides a convenient way to do per entity analysis.</p>\n\n<pre><code>console.log(store.byUniqueID['1'].snapshots[0].RecordID)\n# 1\n\nconsole.log(store.byUniqueID['1'].lastSnapshot.RecordID)\n# 1000\n</code></pre>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-cfg'>Config options</h3><div class='subsection'><div id='cfg-defaultValues' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-defaultValues' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-defaultValues' class='name expandable'>defaultValues</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>In some datastores, null numeric fields may be assumed to be zero and null\n boolean fields may be assumed to be false. ...</div><div class='long'><p>In some datastores, null numeric fields may be assumed to be zero and null\n boolean fields may be assumed to be false. Lumenize makes no such assumption and will crash if a field value\n is missing. the defaultValues becomes the root of prototype inheritance hierarchy.</p>\n<p>Defaults to: <code>{}</code></p></div></div></div><div id='cfg-idField' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-idField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-idField' class='name expandable'>idField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"_id"</code></p></div></div></div><div id='cfg-tz' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-tz' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-tz' class='name expandable'>tz</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"GMT"</code></p></div></div></div><div id='cfg-uniqueIDField' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-uniqueIDField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-uniqueIDField' class='name expandable'>uniqueIDField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'>Specifies the field that identifies unique entities. ...</div><div class='long'><p>Specifies the field that identifies unique entities.</p>\n<p>Defaults to: <code>"_EntityID"</code></p></div></div></div><div id='cfg-validFromField' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-validFromField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-validFromField' class='name expandable'>validFromField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"_ValidFrom"</code></p></div></div></div><div id='cfg-validToField' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-cfg-validToField' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-cfg-validToField' class='name expandable'>validToField</a> : String<span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"_ValidTo"</code></p></div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-byUniqueID' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-property-byUniqueID' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-property-byUniqueID' class='name expandable'>byUniqueID</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>This is the database equivalent of an index by uniqueIDField. ...</div><div class='long'><p>This is the database equivalent of an index by uniqueIDField.</p>\n\n<p>An Object in the form:</p>\n\n<pre><code>{\n '1234': {\n snapshots: [...],\n lastSnapshot: <points to last snapshot for this uniqueID>\n },\n '7890': {\n ...\n },\n ...\n}\n</code></pre>\n</div></div></div><div id='property-fields' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-property-fields' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-property-fields' class='name expandable'>fields</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>An Array of Strings\n\nThe list of all fields that this Store has ever seen. ...</div><div class='long'><p>An Array of Strings</p>\n\n<p>The list of all fields that this Store has ever seen. Use to expand each row.</p>\n</div></div></div><div id='property-snapshots' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-property-snapshots' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-property-snapshots' class='name expandable'>snapshots</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'><p>An Array of Objects</p>\n\n<p>The snapshots in compressed (via JavaScript inheritance) format</p>\n</div><div class='long'><p>An Array of Objects</p>\n\n<p>The snapshots in compressed (via JavaScript inheritance) format</p>\n</div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-constructor' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-method-constructor' target='_blank' class='view-source'>view source</a></div><strong class='new-keyword'>new</strong><a href='#!/api/Lumenize.Store-method-constructor' class='name expandable'>Lumenize.Store</a>( <span class='pre'>config, [snapshots]</span> ) : <a href=\"#!/api/Lumenize.Store\" rel=\"Lumenize.Store\" class=\"docClass\">Lumenize.Store</a><span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : Object<div class='sub-desc'><p>See Config options for details.</p>\n</div></li><li><span class='pre'>snapshots</span> : Object[] (optional)<div class='sub-desc'><p>Optional parameter allowing the population of the Store at instantiation.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Lumenize.Store\" rel=\"Lumenize.Store\" class=\"docClass\">Lumenize.Store</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-addSnapshots' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-method-addSnapshots' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-method-addSnapshots' class='name expandable'>addSnapshots</a>( <span class='pre'>snapshots</span> ) : Store<span class=\"signature\"><span class='chainable' >chainable</span></span></div><div class='description'><div class='short'>Adds the snapshots to the Store ...</div><div class='long'><p>Adds the snapshots to the Store</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>snapshots</span> : Object[]<div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Store</span><div class='sub-desc'><p>Returns this</p>\n</div></li></ul></div></div></div><div id='method-filtered' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-method-filtered' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-method-filtered' class='name expandable'>filtered</a>( <span class='pre'>filter</span> ) : Object[]<span class=\"signature\"></span></div><div class='description'><div class='short'>Returns the subset of the snapshots that match the filter ...</div><div class='long'><p>Returns the subset of the snapshots that match the filter</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>filter</span> : Function<div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Object[]</span><div class='sub-desc'><p>An array of snapshots. Note, they will not be flattened so they have references to their prototypes</p>\n</div></li></ul></div></div></div><div id='method-stateBoundaryCrossedFiltered' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-method-stateBoundaryCrossedFiltered' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-method-stateBoundaryCrossedFiltered' class='name expandable'>stateBoundaryCrossedFiltered</a>( <span class='pre'>field, values, valueToTheRightOfBoundary, [forward], [assumeNullIsLowest]</span> ) : Object[]<span class=\"signature\"></span></div><div class='description'><div class='short'>Returns the subset of the snapshots where the field transitions from the left of valueToTheRightOfBoundary to\n the r...</div><div class='long'><p>Returns the subset of the snapshots where the field transitions from the left of valueToTheRightOfBoundary to\n the right (inclusive)</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>field</span> : String<div class='sub-desc'>\n</div></li><li><span class='pre'>values</span> : String[]<div class='sub-desc'>\n</div></li><li><span class='pre'>valueToTheRightOfBoundary</span> : String<div class='sub-desc'>\n</div></li><li><span class='pre'>forward</span> : Boolean (optional)<div class='sub-desc'><p>When true (the default), this will return the transitions from left to right\n However, if you set this to false, it will return the transitions right to left.</p>\n<p>Defaults to: <code>true</code></p></div></li><li><span class='pre'>assumeNullIsLowest</span> : Boolean (optional)<div class='sub-desc'><p>Set to false if you don't want to consider transitions out of null</p>\n<p>Defaults to: <code>true</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Object[]</span><div class='sub-desc'><p>An array or snapshots. Note, they will not be flattened so they have references to their prototypes</p>\n</div></li></ul></div></div></div><div id='method-stateBoundaryCrossedFilteredBothWays' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Lumenize.Store'>Lumenize.Store</span><br/><a href='source/Store.coffee.html#Lumenize-Store-method-stateBoundaryCrossedFilteredBothWays' target='_blank' class='view-source'>view source</a></div><a href='#!/api/Lumenize.Store-method-stateBoundaryCrossedFilteredBothWays' class='name expandable'>stateBoundaryCrossedFilteredBothWays</a>( <span class='pre'>field, values, valueToTheRightOfBoundary, [assumeNullIsLowest]</span> ) : Object<span class=\"signature\"></span></div><div class='description'><div class='short'>Shortcut to stateBoundaryCrossedFiltered for when you need both directions ...</div><div class='long'><p>Shortcut to stateBoundaryCrossedFiltered for when you need both directions</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>field</span> : String<div class='sub-desc'>\n</div></li><li><span class='pre'>values</span> : String[]<div class='sub-desc'>\n</div></li><li><span class='pre'>valueToTheRightOfBoundary</span> : String<div class='sub-desc'>\n</div></li><li><span class='pre'>assumeNullIsLowest</span> : Boolean (optional)<div class='sub-desc'><p>Set to false if you don't want to consider transitions out of null</p>\n<p>Defaults to: <code>true</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>Object</span><div class='sub-desc'><p>An object with two root keys: 1) forward, 2) backward. The values are the arrays that are returned\n from stateBoundaryCrossedFiltered</p>\n</div></li></ul></div></div></div></div></div></div></div>","meta":{}});