New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

microcosm

Package Overview
Dependencies
Maintainers
4
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microcosm - npm Package Compare versions

Comparing version 12.7.0-alpha.4 to 12.7.0-beta

docs/api/index.md

5

addons/indexing.js

@@ -32,7 +32,2 @@ 'use strict';

/**
* Determine if a value is defined within an object
*/
/**
* Non-destructively assign a value to a provided object at a given key. If the

@@ -39,0 +34,0 @@ * value is the same, don't do anything. Otherwise return a new object.

4

CHANGELOG.md
# Changelog
## 12.7.0-alpha
## 12.7.0-beta

@@ -18,3 +18,3 @@ - Remove PropType usage from addons to prevent React 15.5.x

`true`, high frequency change events will be batched together using
`requestIdleCallback`
`requestIdleCallback`. When not available, it falls back to setTimeout.

@@ -21,0 +21,0 @@ ### Auto-bound action status methods

## Introduction
1. [Quick Start](guides/quickstart.md)
2. [Architecture](guides/architecture.md)
3. [Contributing](guides/contributing.md)
2. [Installation](guides/installation.md)
3. [Architecture](guides/architecture.md)
4. [Contributing](guides/contributing.md)

@@ -7,0 +8,0 @@ ## API

@@ -5,4 +5,2 @@ 'use strict';

require('ric');
/**

@@ -73,4 +71,2 @@ * A key path is a list of property names that describe a pathway

var hasOwn = Object.prototype.hasOwnProperty;
/**

@@ -160,21 +156,2 @@ * Shallow copy an object

/**
* Determine if a value is defined within an object
*/
function has(object, key, fallback) {
var path = castPath(key);
for (var i = 0, len = path.length; i < len; i++) {
var key = path[i];
if (!object || hasOwn.call(object, key) === false) {
return false;
}
object = object[key];
}
return true;
}
/**
* Non-destructively assign a value to a provided object at a given key. If the

@@ -844,10 +821,25 @@ * value is the same, don't do anything. Otherwise return a new object.

// requestIdleCallback isn't supported everywhere
var batchOptions = { timeout: 36 };
/**
* requestIdleCallback isn't supported everywhere and is hard to
* polyfill. For environments that do not support it, just use a
* setTimeout.
*
* Note: To be fully compliant, we would invoke the callback with the
* time remaining. Given our usage, we don't need to do that.
*/
var scheduler = global.requestIdleCallback || function (update) {
return setTimeout(update, 4);
};
/**
* When using requestIdleCallback, batch together updates until the
* browser is ready for them, but never make the user wait longer than
* 36 milliseconds.
*/
var BATCH_OPTIONS = { timeout: 36 };
function defaultUpdateStrategy(options) {
return function (update) {
if (options.batch === true) {
global.requestIdleCallback(update, batchOptions);
scheduler(update, BATCH_OPTIONS);
} else {

@@ -1358,2 +1350,6 @@ update();

if (domain.teardown) {
this.repo.on('teardown', domain.teardown, domain);
}
return domain;

@@ -1384,3 +1380,3 @@ },

if (key.length && has(data, key)) {
if (key.length) {
next = set(next, key, get(data, key));

@@ -1427,14 +1423,2 @@ }

}, payload);
},
teardown: function teardown() {
for (var i = 0, len = this.domains.length; i < len; i++) {
var _domains$i4 = this.domains[i],
key = _domains$i4[0],
domain = _domains$i4[1];
if (domain.teardown) {
domain.teardown(this.repo);
}
}
}

@@ -1456,2 +1440,6 @@ };

if (effect.teardown) {
this.repo.on('teardown', effect.teardown, effect);
}
this.effects.push(effect);

@@ -1461,11 +1449,2 @@

},
teardown: function teardown() {
for (var i = 0, len = this.effects.length; i < len; i++) {
var effect = this.effects[i];
if (effect.teardown) {
effect.teardown(this.repo);
}
}
},
dispatch: function dispatch(action) {

@@ -1509,2 +1488,6 @@ var command = action.command,

Node.getId = function (key, parent) {
return parent && parent.id ? parent.id + '.' + key : key;
};
Node.prototype = {

@@ -1585,3 +1568,3 @@ parent: null,

},
isEmpty: function isEmpty() {
isAlone: function isAlone() {
return this._events.length <= 0;

@@ -1593,3 +1576,2 @@ }

// counter-intuitive, so we keep track of them as a named constant.
var ROOT_KEY = '';
var ROOT_PATH = '';

@@ -1642,3 +1624,3 @@

if (query.isEmpty()) {
if (query.isAlone()) {
this.prune(query);

@@ -1660,6 +1642,10 @@ }

var root = this.nodes[ROOT_KEY];
var root = this.nodes[ROOT_PATH];
if (root) {
this.scan(root, last, snapshot);
var queries = this.scan(this.nodes[ROOT_PATH], last, snapshot, []);
for (var i = 0; i < queries.length; i++) {
queries[i].trigger(snapshot);
}
}

@@ -1676,3 +1662,5 @@ },

*/
addNode: function addNode(id, key, parent) {
addNode: function addNode(key, parent) {
var id = Node.getId(key, parent);
if (!this.nodes[id]) {

@@ -1751,9 +1739,6 @@ this.nodes[id] = new Node(id, key, parent);

addBranch: function addBranch(path, query) {
var last = this.addNode(ROOT_KEY, ROOT_PATH, null);
var keyBase = '';
var last = this.addNode(ROOT_PATH, null);
for (var i = 0, len = path.length; i < len; i++) {
keyBase = keyBase ? keyBase + '.' + path[i] : path[i];
last = this.addNode(keyBase, path[i], last);
last = this.addNode(path[i], last);
}

@@ -1772,36 +1757,21 @@

*/
scan: function scan(root, from, to) {
// Maintain a stack of nodes to process. As we traverse the tree,
// we'll push edges into this stack for processing
var stack = [{ node: root, last: from, next: to }];
scan: function scan(node, last, next, queries) {
if (last !== next) {
var edges = node.edges;
// Track the queries we've already triggered so queries with
// multiple subscriptions do not fire excessively
var triggered = [];
for (var i = 0, len = edges.length; i < len; i++) {
var edge = edges[i];
while (stack.length) {
var _stack$pop = stack.pop(),
node = _stack$pop.node,
last = _stack$pop.last,
next = _stack$pop.next;
if (edge instanceof Query && queries.indexOf(edge) < 0) {
queries.push(edge);
} else {
var edgeLast = last == null ? last : last[edge.key];
var edgeNext = next == null ? next : next[edge.key];
if (last !== next) {
var edges = node.edges;
for (var i = 0, len = edges.length; i < len; i++) {
var edge = edges[i];
if (edge instanceof Query && triggered.indexOf(edge) < 0) {
edge.trigger(this.snapshot);
triggered.push(edge);
} else {
stack.push({
node: edge,
last: last == null ? last : last[edge.key],
next: next == null ? next : next[edge.key]
});
}
this.scan(edge, edgeLast, edgeNext, queries);
}
}
}
return queries;
}

@@ -2146,5 +2116,2 @@ };

this.effects.teardown();
this.domains.teardown();
// Trigger a teardown event before completely shutting down

@@ -2151,0 +2118,0 @@ this._emit('teardown', this);

@@ -1,1 +0,1 @@

"use strict";function t(t){return""===t||null===t||void 0===t}function e(e){return Array.isArray(e)?e:t(e)?[]:d(e)?e.split(C):[e]}function n(t){var n=t;return Array.isArray(t)===!1&&(n=(""+n).split(L)),n.map(e)}function i(t){return t.join(C)}function r(t){return t.map(i).join(L)}function s(t){if(Array.isArray(t))return t.slice(0);if(l(t)===!1)return t;var e={};for(var n in t)e[n]=t[n];return e}function o(){for(var t=null,e=null,n=0,i=arguments.length;n<i;n++){t=t||arguments[n],e=e||t;var r=arguments[n];for(var o in r)t[o]!==r[o]&&(t===e&&(t=s(e)),t[o]=r[o])}return t}function a(t,e,n){return t.__proto__=e,t.prototype=o(Object.create(e.prototype),{constructor:t.prototype.constructor},n),t}function h(t,n,i){if(null==t)return i;for(var r=e(n),s=0,o=r.length;s<o;s++){var a=null==t?void 0:t[r[s]];if(void 0===a)return i;t=a}return t}function c(t,n,i){for(var r=e(n),s=0,o=r.length;s<o;s++){var n=r[s];if(!t||J.call(t,n)===!1)return!1;t=t[n]}return!0}function u(t,n,i){var r=e(n),o=r.length;if(o<=0)return i;if(h(t,r)===i)return t;for(var a=s(t),c=a,u=0;u<o;u++){var f=r[u],l=i;u<o-1&&(l=f in c?s(c[f]):{}),c[f]=l,c=c[f]}return a}function f(t){return(l(t)||p(t))&&p(t.then)}function l(t){return!!t&&"object"===(void 0===t?"undefined":M(t))}function p(t){return!!t&&"function"==typeof t}function d(t){return"string"==typeof t}function v(t){return"GeneratorFunction"===h(t,$,"")}function g(t,e,n){return p(t)?new t(e,n):Object.create(t)}function y(t,n,i,r){var s=e(n);return p(i)===!1?u(t,s,i):u(t,s,i(h(t,s,r)))}function m(t,e,n,i){this.event=t,this.fn=e,this.scope=n,this.once=i}function b(){this.a=[]}function w(t,e){if(t.b===!0)return t;d(t)&&(e=t,t=function(t){return t}),F+=1;var n=e||(t.name||G)+"."+F;return t.open=n+".open",t.loading=n+".loading",t.update=t.loading,t.done=n,t.resolve=t.done,t.error=n+".error",t.reject=t.error,t.cancel=n+".cancel",t.cancelled=t.cancel,t.toString=function(){return n},t.b=!0,t}function x(t,e){b.call(this),this.id=U++,this.command=w(t),this.timestamp=Date.now(),this.children=[],e&&this[e]()}function z(t,e){return function(){}}function S(t,e,n){return function(i){return t.status=e,t.complete=n,arguments.length>0&&(t.payload=i),t.c("change",t),t.c(e,t.payload),t}}function A(t,e,n){return t.complete?z(t,e):S(t,e,n)}function j(t){return function(e){t.batch===!0?global.requestIdleCallback(e,K):e()}}function k(t,e){return function(n,i){var r=t;if(e)try{r=i.deserialize(t)}catch(t){throw n.reject(t),t}var s=i.domains.sanitize(r);n.resolve(s)}}function O(t){var e=this;b.call(this);var n=o(tt,t);this.size=0,this.limit=Math.max(1,n.maxHistory),this.updater=n.updater(n),this.releasing=!1,this.release=function(){return e.closeRelease()},this.begin()}function D(){this.pool={}}function E(t,e){this.repo=e}function I(t,e,n){var i=et[n],r=t[e],s=e[n];return l(r)?r[i]||r[n]:t[s]}function P(t){this.repo=t,this.domains=[],this.registry={},this.add([],E)}function _(t){this.repo=t,this.effects=[]}function H(t,e,n){this.id=t,this.key=e,this.edges=[],n&&(this.parent=n,n.connect(this))}function q(t,e){b.call(this),this.id=t,this.keyPaths=n(e)}function N(t){this.snapshot=t,this.nodes={}}function R(t,e,n){function i(e){var n=s.next(e);n.done?t.resolve(e):r(n.value)}function r(e){e.onDone(i),e.onCancel(t.cancel,t),e.onError(t.reject,t)}t.open();var s=e(n);return i(),t}function B(t,e,n,i){var r=e.apply(null,n);return f(r)?(t.open.apply(t,n),r.then(function(e){return global.setTimeout(function(){return t.resolve(e)},0)},function(e){return global.setTimeout(function(){return t.reject(e)},0)}),t):v(r)?R(t,r,i):p(r)?(r(t,i),t):t.resolve(r)}function T(t,e,n){b.call(this);var i=o(T.defaults,this.constructor.defaults,t);this.parent=i.parent,this.initial=this.parent?this.parent.initial:{},this.state=this.parent?this.parent.state:this.initial,this.history=this.parent?this.parent.history:new O(i),this.archive=new D,this.domains=new P(this),this.effects=new _(this),this.changes=new N(this.state),this.history.on("append",this.createSnapshot,this),this.history.on("update",this.updateSnapshot,this),this.history.on("remove",this.removeSnapshot,this),this.history.on("reconcile",this.dispatchEffect,this),this.history.on("release",this.release,this),this.setup(i),e&&this.reset(e,n)}Object.defineProperty(exports,"__esModule",{value:!0}),require("ric");var C=".",L=",",M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J=Object.prototype.hasOwnProperty,Q="function"==typeof Symbol?Symbol:{},$=Q.toStringTag||"@@toStringTag";b.prototype={on:function(t,e,n){var i=new m(t,e,n,!1);return this.a.push(i),this},once:function(t,e,n){var i=new m(t,e,n,!0);return this.a.push(i),this},off:function(t,e,n){for(var i=null==e,r=0;r<this.a.length;){var s=this.a[r];s.event===t&&(i||s.fn===e&&s.scope===n)?this.a.splice(r,1):r+=1}return this},removeAllListeners:function(){this.a.length=0},c:function(t){for(var e=0,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];for(;e<this.a.length;){var s=this.a[e];s.event===t&&(s.fn.apply(s.scope||this,i),s.once)?this.a.splice(e,1):e+=1}return this},d:function(t){for(var e=0;e<this.a.length;)t!==this.a[e].scope?e+=1:this.a.splice(e,1)}};var F=0,G="_action",U=0;a(x,b,{status:"inactive",payload:void 0,disabled:!1,complete:!1,parent:null,next:null,onOpen:function(t,e){return this.e("open",t,e),this},onUpdate:function(t,e){return t&&this.on("update",t,e),this},onDone:function(t,e){return this.e("resolve",t,e),this},onError:function(t,e){return this.e("reject",t,e),this},onCancel:function(t,e){return this.e("cancel",t,e),this},is:function(t){return this.command[this.status]===this.command[t]},toggle:function(t){return this.disabled=!this.disabled,t||this.c("change",this),this},then:function(t,e){var n=this;return new Promise(function(t,e){n.onDone(t),n.onError(e)}).then(t,e)},isDisconnected:function(){return!this.parent},prune:function(){this.parent.parent=null},lead:function(t){this.next=t,t&&this.adopt(t)},adopt:function(t){this.children.indexOf(t)<0&&this.children.push(t),t.parent=this},remove:function(){this.parent.abandon(this),this.removeAllListeners()},abandon:function(t){var e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null),this.next===t&&this.lead(t.next)},e:function(t,e,n){e&&(this.is(t)?e.call(n,this.payload):this.once(t,e,n))}}),Object.defineProperties(x.prototype,{type:{get:function(){return this.command[this.status]}},open:{get:function(){return A(this,"open",!1)}},update:{get:function(){return A(this,"update",!1)}},resolve:{get:function(){return A(this,"resolve",!0)}},reject:{get:function(){return A(this,"reject",!0)}},cancel:{get:function(){return A(this,"cancel",!0)}}});var K={timeout:36},V=w(function(t,e){return k(t,e)},"$reset"),W=w(function(t,e){return k(t,e)},"$patch"),X=function(){},Y=function(){},Z=function(t){return t},tt={maxHistory:1,batch:!1,updater:j};a(O,b,{checkout:function(t){return this.head=t||this.head,this.setActiveBranch(),this.reconcile(this.head),this},toggle:function(t){var e=[].concat(t);e.forEach(function(t){return t.toggle("silently")}),this.reconcile(e[0])},toArray:function(){return this.map(function(t){return t})},map:function(t,e){for(var n=this.size,i=Array(n),r=this.head;n--;)i[n]=t.call(e,r),r=r.parent;return i},wait:function(){var t=this,e=this.toArray();return new Promise(function(n,i){var r=function r(){var s=e.every(function(t){return t.complete}),o=e.filter(function(t){return t.is("reject")});s&&(t.off("release",r),o.length?i(o[0].payload):n())};t.releasing===!1&&r(),t.on("release",r)})},then:function(t,e){return this.wait().then(t,e)},begin:function(){this.head=this.root=null,this.append(Y,"resolve")},append:function(t,e){var n=new x(t,e);return this.size>0?this.head.lead(n):(new x(X,"resolve").adopt(n),this.root=n),this.head=n,this.size+=1,this.c("append",n),n.on("change",this.reconcile,this),this.head},remove:function(t){if(!t.isDisconnected()){var e=t.next,n=t.parent;if(this.clean(t),this.size<=0)return void this.begin();e?t===this.root&&(this.root=e):e=this.head=n,t.disabled||this.reconcile(e)}},clean:function(t){this.size-=1,this.c("remove",t),t.remove()},reconcile:function(t){for(var e=t;e&&(this.c("update",e),e!==this.head);)e=e.next;this.archive(),this.c("reconcile",t),this.queueRelease()},queueRelease:function(){this.releasing===!1&&(this.releasing=!0,this.updater(this.release))},closeRelease:function(){this.releasing=!1,this.c("release")},archive:function(){for(var t=this.size,e=this.root;t>this.limit&&e.complete;)t-=1,this.c("remove",e.parent),e=e.next;e.prune(),this.root=e,this.size=t},setActiveBranch:function(){for(var t=this.head,e=1;t!==this.root;){var n=t.parent;n.next=t,t=n,e+=1}this.size=e}}),D.prototype={create:function(t){this.set(t,this.get(t.parent))},get:function(t,e){var n=this.pool[t.id];return void 0===n?e:n},set:function(t,e){this.pool[t.id]=e},remove:function(t){delete this.pool[t.id]}},E.prototype={reset:function(t,e){var n=this.repo.domains.sanitize(e);return o(t,this.repo.getInitialState(),n)},patch:function(t,e){return o(t,this.repo.domains.sanitize(e))},addDomain:function(t){return o(this.repo.getInitialState(),t)},register:function(){var t;return t={},t[V]=this.reset,t[W]=this.patch,t[Z]=this.addDomain,t}};var et={inactive:"inactive",open:"open",update:"loading",loading:"update",done:"resolve",resolve:"done",reject:"error",error:"reject",cancel:"cancelled",cancelled:"cancel"};P.prototype={getHandlers:function(t){for(var e=t.command,n=t.status,i=[],r=0,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];if(h.register){var c=I(h.register(),e,n);c&&i.push({key:a,domain:h,handler:c})}}return i},register:function(t){var e=t.type;return this.registry[e]||(this.registry[e]=this.getHandlers(t)),this.registry[e]},add:function(t,n,i){var r=g(n,i,this.repo);return this.domains.push([e(t),r]),this.registry={},r.setup&&r.setup(this.repo,i),r},reduce:function(t,e,n){for(var i=e,r=1,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];i=t.call(n,i,a,h)}return i},sanitize:function(t){for(var e={},n=0,i=this.domains.length;n<i;n++){var r=this.domains[n],s=r[0];s.length&&c(t,s)&&(e=u(e,s,h(t,s)))}return e},dispatch:function(t,e){for(var n=this.register(e),i=0,r=n.length;i<r;i++){var s=n[i],o=s.key,a=s.domain,c=s.handler,f=h(t,o);t=u(t,o,c.call(a,f,e.payload))}return t},deserialize:function(t){return this.reduce(function(e,n,i){return i.deserialize?u(e,n,i.deserialize(h(t,n))):e},t)},serialize:function(t,e){return this.reduce(function(e,n,i){return i.serialize?u(e,n,i.serialize(h(t,n))):e},e)},teardown:function(){for(var t=0,e=this.domains.length;t<e;t++){var n=this.domains[t],i=(n[0],n[1]);i.teardown&&i.teardown(this.repo)}}},_.prototype={add:function(t,e){var n=g(t,e,this.repo);return n.setup&&n.setup(this.repo,e),this.effects.push(n),n},teardown:function(){for(var t=0,e=this.effects.length;t<e;t++){var n=this.effects[t];n.teardown&&n.teardown(this.repo)}},dispatch:function(t){for(var e=t.command,n=t.payload,i=t.status,r=0,s=this.effects.length;r<s;r++){var o=this.effects[r];if(o.register){var a=I(o.register(),e,i);a&&a.call(o,this.repo,n)}}}},H.prototype={parent:null,connect:function(t){t!==this&&this.edges.indexOf(t)<0&&this.edges.push(t)},disconnect:function(t){var e=this.edges.indexOf(t);~e&&this.edges.splice(e,1)},isAlone:function(){return this.edges.length<=0},orphan:function(){this.parent&&this.parent.disconnect(this)}},q.getId=function(t){return"query:"+r(n(t))},a(q,b,{extract:function(t){for(var e=this.keyPaths.length,n=Array(e),i=0;i<e;i++)n[i]=h(t,this.keyPaths[i]);return n},trigger:function(t){var e=this.extract(t);this.c.apply(this,["change"].concat(e))},isEmpty:function(){return this.a.length<=0}});var nt="";N.prototype={on:function(t,e,i){for(var r=n(t),s=q.getId(t),o=this.addQuery(s,r),a=0;a<r.length;a++)this.addBranch(r[a],o);return o.on("change",e,i),o},off:function(t,e,n){var i=q.getId(t),r=this.nodes[i];r&&(r.off("change",e,n),r.isEmpty()&&this.prune(r))},update:function(t){var e=this.snapshot;this.snapshot=t;var n=this.nodes[nt];n&&this.scan(n,e,t)},addNode:function(t,e,n){return this.nodes[t]||(this.nodes[t]=new H(t,e,n)),this.nodes[t]},addQuery:function(t,e){return this.nodes[t]||(this.nodes[t]=new q(t,e)),this.nodes[t]},remove:function(t){delete this.nodes[t.id]},prune:function(t){for(var e=t.keyPaths.map(i),n=0,r=e.length;n<r;n++){var s=this.nodes[e[n]];s.disconnect(t);do{if(!s.isAlone())break;s.orphan(),this.remove(s),s=s.parent}while(s)}this.remove(t)},addBranch:function(t,e){for(var n=this.addNode(nt,"",null),i="",r=0,s=t.length;r<s;r++)i=i?i+"."+t[r]:t[r],n=this.addNode(i,t[r],n);n.connect(e)},scan:function(t,e,n){for(var i=[{node:t,last:e,next:n}],r=[];i.length;){var s=i.pop(),o=s.node,a=s.last,h=s.next;if(a!==h)for(var c=o.edges,u=0,f=c.length;u<f;u++){var l=c[u];l instanceof q&&r.indexOf(l)<0?(l.trigger(this.snapshot),r.push(l)):i.push({node:l,last:null==a?a:a[l.key],next:null==h?h:h[l.key]})}}}},T.defaults={maxHistory:0,parent:null,batch:!1},a(T,b,{setup:function(){},teardown:function(){},getInitialState:function(){return this.initial},recall:function(t,e){return this.archive.get(t,e)},createSnapshot:function(t){this.archive.create(t)},updateSnapshot:function(t){var e=this.recall(t.parent,this.initial);this.parent&&(e=o(e,this.parent.recall(t))),t.disabled||(e=this.domains.dispatch(e,t)),this.archive.set(t,e),this.state=e},removeSnapshot:function(t){this.archive.remove(t)},dispatchEffect:function(t){this.effects.dispatch(t)},release:function(){this.changes.update(this.state)},on:function(t,e,n){var i=t.split(":",2),r=i[0],s=i[1];switch(r){case"change":this.changes.on(s||"",e,n);break;default:b.prototype.on.apply(this,arguments)}return this},off:function(t,e,n){var i=t.split(":",2),r=i[0],s=i[1];switch(r){case"change":this.changes.off(s||"",e,n);break;default:b.prototype.off.apply(this,arguments)}return this},append:function(t,e){return this.history.append(t,e)},push:function(t){for(var e=this.append(t),n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return B(e,e.command,i,this),e},prepare:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.push.apply(t,n.concat(i))}},addDomain:function(t,e,n){var i=this.domains.add(t,e,n);return i.getInitialState&&(this.initial=u(this.initial,t,i.getInitialState())),this.push(Z,i),i},addEffect:function(t,e){return this.effects.add(t,e)},reset:function(t,e){return this.push(V,t,e)},patch:function(t,e){return this.push(W,t,e)},deserialize:function(t){var e=t;return this.parent?e=this.parent.deserialize(t):d(e)&&(e=JSON.parse(e)),this.domains.deserialize(e)},serialize:function(){var t=this.parent?this.parent.serialize():{};return this.domains.serialize(this.state,t)},toJSON:function(){return this.serialize()},checkout:function(t){return this.history.checkout(t),this},fork:function(){return new T({parent:this})},shutdown:function(){this.teardown(),this.effects.teardown(),this.domains.teardown(),this.c("teardown",this),this.history.d(this),this.removeAllListeners()}}),exports.default=T,exports.Microcosm=T,exports.Action=x,exports.History=O,exports.tag=w,exports.get=h,exports.set=u,exports.update=y,exports.merge=o,exports.inherit=a,exports.getRegistration=I;
"use strict";function t(t){return""===t||null===t||void 0===t}function e(e){return Array.isArray(e)?e:t(e)?[]:p(e)?e.split(B):[e]}function n(t){var n=t;return Array.isArray(t)===!1&&(n=(""+n).split(C)),n.map(e)}function i(t){return t.join(B)}function r(t){return t.map(i).join(C)}function s(t){if(Array.isArray(t))return t.slice(0);if(f(t)===!1)return t;var e={};for(var n in t)e[n]=t[n];return e}function o(){for(var t=null,e=null,n=0,i=arguments.length;n<i;n++){t=t||arguments[n],e=e||t;var r=arguments[n];for(var o in r)t[o]!==r[o]&&(t===e&&(t=s(e)),t[o]=r[o])}return t}function a(t,e,n){return t.__proto__=e,t.prototype=o(Object.create(e.prototype),{constructor:t.prototype.constructor},n),t}function h(t,n,i){if(null==t)return i;for(var r=e(n),s=0,o=r.length;s<o;s++){var a=null==t?void 0:t[r[s]];if(void 0===a)return i;t=a}return t}function c(t,n,i){var r=e(n),o=r.length;if(o<=0)return i;if(h(t,r)===i)return t;for(var a=s(t),c=a,u=0;u<o;u++){var f=r[u],l=i;u<o-1&&(l=f in c?s(c[f]):{}),c[f]=l,c=c[f]}return a}function u(t){return(f(t)||l(t))&&l(t.then)}function f(t){return!!t&&"object"===(void 0===t?"undefined":L(t))}function l(t){return!!t&&"function"==typeof t}function p(t){return"string"==typeof t}function d(t){return"GeneratorFunction"===h(t,J,"")}function v(t,e,n){return l(t)?new t(e,n):Object.create(t)}function g(t,n,i,r){var s=e(n);return l(i)===!1?c(t,s,i):c(t,s,i(h(t,s,r)))}function y(t,e,n,i){this.event=t,this.fn=e,this.scope=n,this.once=i}function m(){this.a=[]}function b(t,e){if(t.b===!0)return t;p(t)&&(e=t,t=function(t){return t}),Q+=1;var n=e||(t.name||$)+"."+Q;return t.open=n+".open",t.loading=n+".loading",t.update=t.loading,t.done=n,t.resolve=t.done,t.error=n+".error",t.reject=t.error,t.cancel=n+".cancel",t.cancelled=t.cancel,t.toString=function(){return n},t.b=!0,t}function w(t,e){m.call(this),this.id=F++,this.command=b(t),this.timestamp=Date.now(),this.children=[],e&&this[e]()}function x(t,e){return function(){}}function z(t,e,n){return function(i){return t.status=e,t.complete=n,arguments.length>0&&(t.payload=i),t.c("change",t),t.c(e,t.payload),t}}function A(t,e,n){return t.complete?x(t,e):z(t,e,n)}function S(t){return function(e){t.batch===!0?G(e,U):e()}}function j(t,e){return function(n,i){var r=t;if(e)try{r=i.deserialize(t)}catch(t){throw n.reject(t),t}var s=i.domains.sanitize(r);n.resolve(s)}}function k(t){var e=this;m.call(this);var n=o(Z,t);this.size=0,this.limit=Math.max(1,n.maxHistory),this.updater=n.updater(n),this.releasing=!1,this.release=function(){return e.closeRelease()},this.begin()}function O(){this.pool={}}function I(t,e){this.repo=e}function D(t,e,n){var i=tt[n],r=t[e],s=e[n];return f(r)?r[i]||r[n]:t[s]}function P(t){this.repo=t,this.domains=[],this.registry={},this.add([],I)}function E(t){this.repo=t,this.effects=[]}function _(t,e,n){this.id=t,this.key=e,this.edges=[],n&&(this.parent=n,n.connect(this))}function H(t,e){m.call(this),this.id=t,this.keyPaths=n(e)}function N(t){this.snapshot=t,this.nodes={}}function R(t,e,n){function i(e){var n=s.next(e);n.done?t.resolve(e):r(n.value)}function r(e){e.onDone(i),e.onCancel(t.cancel,t),e.onError(t.reject,t)}t.open();var s=e(n);return i(),t}function T(t,e,n,i){var r=e.apply(null,n);return u(r)?(t.open.apply(t,n),r.then(function(e){return global.setTimeout(function(){return t.resolve(e)},0)},function(e){return global.setTimeout(function(){return t.reject(e)},0)}),t):d(r)?R(t,r,i):l(r)?(r(t,i),t):t.resolve(r)}function q(t,e,n){m.call(this);var i=o(q.defaults,this.constructor.defaults,t);this.parent=i.parent,this.initial=this.parent?this.parent.initial:{},this.state=this.parent?this.parent.state:this.initial,this.history=this.parent?this.parent.history:new k(i),this.archive=new O,this.domains=new P(this),this.effects=new E(this),this.changes=new N(this.state),this.history.on("append",this.createSnapshot,this),this.history.on("update",this.updateSnapshot,this),this.history.on("remove",this.removeSnapshot,this),this.history.on("reconcile",this.dispatchEffect,this),this.history.on("release",this.release,this),this.setup(i),e&&this.reset(e,n)}Object.defineProperty(exports,"__esModule",{value:!0});var B=".",C=",",L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M="function"==typeof Symbol?Symbol:{},J=M.toStringTag||"@@toStringTag";m.prototype={on:function(t,e,n){var i=new y(t,e,n,!1);return this.a.push(i),this},once:function(t,e,n){var i=new y(t,e,n,!0);return this.a.push(i),this},off:function(t,e,n){for(var i=null==e,r=0;r<this.a.length;){var s=this.a[r];s.event===t&&(i||s.fn===e&&s.scope===n)?this.a.splice(r,1):r+=1}return this},removeAllListeners:function(){this.a.length=0},c:function(t){for(var e=0,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];for(;e<this.a.length;){var s=this.a[e];s.event===t&&(s.fn.apply(s.scope||this,i),s.once)?this.a.splice(e,1):e+=1}return this},d:function(t){for(var e=0;e<this.a.length;)t!==this.a[e].scope?e+=1:this.a.splice(e,1)}};var Q=0,$="_action",F=0;a(w,m,{status:"inactive",payload:void 0,disabled:!1,complete:!1,parent:null,next:null,onOpen:function(t,e){return this.e("open",t,e),this},onUpdate:function(t,e){return t&&this.on("update",t,e),this},onDone:function(t,e){return this.e("resolve",t,e),this},onError:function(t,e){return this.e("reject",t,e),this},onCancel:function(t,e){return this.e("cancel",t,e),this},is:function(t){return this.command[this.status]===this.command[t]},toggle:function(t){return this.disabled=!this.disabled,t||this.c("change",this),this},then:function(t,e){var n=this;return new Promise(function(t,e){n.onDone(t),n.onError(e)}).then(t,e)},isDisconnected:function(){return!this.parent},prune:function(){this.parent.parent=null},lead:function(t){this.next=t,t&&this.adopt(t)},adopt:function(t){this.children.indexOf(t)<0&&this.children.push(t),t.parent=this},remove:function(){this.parent.abandon(this),this.removeAllListeners()},abandon:function(t){var e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null),this.next===t&&this.lead(t.next)},e:function(t,e,n){e&&(this.is(t)?e.call(n,this.payload):this.once(t,e,n))}}),Object.defineProperties(w.prototype,{type:{get:function(){return this.command[this.status]}},open:{get:function(){return A(this,"open",!1)}},update:{get:function(){return A(this,"update",!1)}},resolve:{get:function(){return A(this,"resolve",!0)}},reject:{get:function(){return A(this,"reject",!0)}},cancel:{get:function(){return A(this,"cancel",!0)}}});var G=global.requestIdleCallback||function(t){return setTimeout(t,4)},U={timeout:36},K=b(function(t,e){return j(t,e)},"$reset"),V=b(function(t,e){return j(t,e)},"$patch"),W=function(){},X=function(){},Y=function(t){return t},Z={maxHistory:1,batch:!1,updater:S};a(k,m,{checkout:function(t){return this.head=t||this.head,this.setActiveBranch(),this.reconcile(this.head),this},toggle:function(t){var e=[].concat(t);e.forEach(function(t){return t.toggle("silently")}),this.reconcile(e[0])},toArray:function(){return this.map(function(t){return t})},map:function(t,e){for(var n=this.size,i=Array(n),r=this.head;n--;)i[n]=t.call(e,r),r=r.parent;return i},wait:function(){var t=this,e=this.toArray();return new Promise(function(n,i){var r=function r(){var s=e.every(function(t){return t.complete}),o=e.filter(function(t){return t.is("reject")});s&&(t.off("release",r),o.length?i(o[0].payload):n())};t.releasing===!1&&r(),t.on("release",r)})},then:function(t,e){return this.wait().then(t,e)},begin:function(){this.head=this.root=null,this.append(X,"resolve")},append:function(t,e){var n=new w(t,e);return this.size>0?this.head.lead(n):(new w(W,"resolve").adopt(n),this.root=n),this.head=n,this.size+=1,this.c("append",n),n.on("change",this.reconcile,this),this.head},remove:function(t){if(!t.isDisconnected()){var e=t.next,n=t.parent;if(this.clean(t),this.size<=0)return void this.begin();e?t===this.root&&(this.root=e):e=this.head=n,t.disabled||this.reconcile(e)}},clean:function(t){this.size-=1,this.c("remove",t),t.remove()},reconcile:function(t){for(var e=t;e&&(this.c("update",e),e!==this.head);)e=e.next;this.archive(),this.c("reconcile",t),this.queueRelease()},queueRelease:function(){this.releasing===!1&&(this.releasing=!0,this.updater(this.release))},closeRelease:function(){this.releasing=!1,this.c("release")},archive:function(){for(var t=this.size,e=this.root;t>this.limit&&e.complete;)t-=1,this.c("remove",e.parent),e=e.next;e.prune(),this.root=e,this.size=t},setActiveBranch:function(){for(var t=this.head,e=1;t!==this.root;){var n=t.parent;n.next=t,t=n,e+=1}this.size=e}}),O.prototype={create:function(t){this.set(t,this.get(t.parent))},get:function(t,e){var n=this.pool[t.id];return void 0===n?e:n},set:function(t,e){this.pool[t.id]=e},remove:function(t){delete this.pool[t.id]}},I.prototype={reset:function(t,e){var n=this.repo.domains.sanitize(e);return o(t,this.repo.getInitialState(),n)},patch:function(t,e){return o(t,this.repo.domains.sanitize(e))},addDomain:function(t){return o(this.repo.getInitialState(),t)},register:function(){var t;return t={},t[K]=this.reset,t[V]=this.patch,t[Y]=this.addDomain,t}};var tt={inactive:"inactive",open:"open",update:"loading",loading:"update",done:"resolve",resolve:"done",reject:"error",error:"reject",cancel:"cancelled",cancelled:"cancel"};P.prototype={getHandlers:function(t){for(var e=t.command,n=t.status,i=[],r=0,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];if(h.register){var c=D(h.register(),e,n);c&&i.push({key:a,domain:h,handler:c})}}return i},register:function(t){var e=t.type;return this.registry[e]||(this.registry[e]=this.getHandlers(t)),this.registry[e]},add:function(t,n,i){var r=v(n,i,this.repo);return this.domains.push([e(t),r]),this.registry={},r.setup&&r.setup(this.repo,i),r.teardown&&this.repo.on("teardown",r.teardown,r),r},reduce:function(t,e,n){for(var i=e,r=1,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];i=t.call(n,i,a,h)}return i},sanitize:function(t){for(var e={},n=0,i=this.domains.length;n<i;n++){var r=this.domains[n],s=r[0];s.length&&(e=c(e,s,h(t,s)))}return e},dispatch:function(t,e){for(var n=this.register(e),i=0,r=n.length;i<r;i++){var s=n[i],o=s.key,a=s.domain,u=s.handler,f=h(t,o);t=c(t,o,u.call(a,f,e.payload))}return t},deserialize:function(t){return this.reduce(function(e,n,i){return i.deserialize?c(e,n,i.deserialize(h(t,n))):e},t)},serialize:function(t,e){return this.reduce(function(e,n,i){return i.serialize?c(e,n,i.serialize(h(t,n))):e},e)}},E.prototype={add:function(t,e){var n=v(t,e,this.repo);return n.setup&&n.setup(this.repo,e),n.teardown&&this.repo.on("teardown",n.teardown,n),this.effects.push(n),n},dispatch:function(t){for(var e=t.command,n=t.payload,i=t.status,r=0,s=this.effects.length;r<s;r++){var o=this.effects[r];if(o.register){var a=D(o.register(),e,i);a&&a.call(o,this.repo,n)}}}},_.getId=function(t,e){return e&&e.id?e.id+"."+t:t},_.prototype={parent:null,connect:function(t){t!==this&&this.edges.indexOf(t)<0&&this.edges.push(t)},disconnect:function(t){var e=this.edges.indexOf(t);~e&&this.edges.splice(e,1)},isAlone:function(){return this.edges.length<=0},orphan:function(){this.parent&&this.parent.disconnect(this)}},H.getId=function(t){return"query:"+r(n(t))},a(H,m,{extract:function(t){for(var e=this.keyPaths.length,n=Array(e),i=0;i<e;i++)n[i]=h(t,this.keyPaths[i]);return n},trigger:function(t){var e=this.extract(t);this.c.apply(this,["change"].concat(e))},isAlone:function(){return this.a.length<=0}});var et="";N.prototype={on:function(t,e,i){for(var r=n(t),s=H.getId(t),o=this.addQuery(s,r),a=0;a<r.length;a++)this.addBranch(r[a],o);return o.on("change",e,i),o},off:function(t,e,n){var i=H.getId(t),r=this.nodes[i];r&&(r.off("change",e,n),r.isAlone()&&this.prune(r))},update:function(t){var e=this.snapshot;if(this.snapshot=t,this.nodes[et])for(var n=this.scan(this.nodes[et],e,t,[]),i=0;i<n.length;i++)n[i].trigger(t)},addNode:function(t,e){var n=_.getId(t,e);return this.nodes[n]||(this.nodes[n]=new _(n,t,e)),this.nodes[n]},addQuery:function(t,e){return this.nodes[t]||(this.nodes[t]=new H(t,e)),this.nodes[t]},remove:function(t){delete this.nodes[t.id]},prune:function(t){for(var e=t.keyPaths.map(i),n=0,r=e.length;n<r;n++){var s=this.nodes[e[n]];s.disconnect(t);do{if(!s.isAlone())break;s.orphan(),this.remove(s),s=s.parent}while(s)}this.remove(t)},addBranch:function(t,e){for(var n=this.addNode(et,null),i=0,r=t.length;i<r;i++)n=this.addNode(t[i],n);n.connect(e)},scan:function(t,e,n,i){if(e!==n)for(var r=t.edges,s=0,o=r.length;s<o;s++){var a=r[s];if(a instanceof H&&i.indexOf(a)<0)i.push(a);else{var h=null==e?e:e[a.key],c=null==n?n:n[a.key];this.scan(a,h,c,i)}}return i}},q.defaults={maxHistory:0,parent:null,batch:!1},a(q,m,{setup:function(){},teardown:function(){},getInitialState:function(){return this.initial},recall:function(t,e){return this.archive.get(t,e)},createSnapshot:function(t){this.archive.create(t)},updateSnapshot:function(t){var e=this.recall(t.parent,this.initial);this.parent&&(e=o(e,this.parent.recall(t))),t.disabled||(e=this.domains.dispatch(e,t)),this.archive.set(t,e),this.state=e},removeSnapshot:function(t){this.archive.remove(t)},dispatchEffect:function(t){this.effects.dispatch(t)},release:function(){this.changes.update(this.state)},on:function(t,e,n){var i=t.split(":",2),r=i[0],s=i[1];switch(r){case"change":this.changes.on(s||"",e,n);break;default:m.prototype.on.apply(this,arguments)}return this},off:function(t,e,n){var i=t.split(":",2),r=i[0],s=i[1];switch(r){case"change":this.changes.off(s||"",e,n);break;default:m.prototype.off.apply(this,arguments)}return this},append:function(t,e){return this.history.append(t,e)},push:function(t){for(var e=this.append(t),n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return T(e,e.command,i,this),e},prepare:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.push.apply(t,n.concat(i))}},addDomain:function(t,e,n){var i=this.domains.add(t,e,n);return i.getInitialState&&(this.initial=c(this.initial,t,i.getInitialState())),this.push(Y,i),i},addEffect:function(t,e){return this.effects.add(t,e)},reset:function(t,e){return this.push(K,t,e)},patch:function(t,e){return this.push(V,t,e)},deserialize:function(t){var e=t;return this.parent?e=this.parent.deserialize(t):p(e)&&(e=JSON.parse(e)),this.domains.deserialize(e)},serialize:function(){var t=this.parent?this.parent.serialize():{};return this.domains.serialize(this.state,t)},toJSON:function(){return this.serialize()},checkout:function(t){return this.history.checkout(t),this},fork:function(){return new q({parent:this})},shutdown:function(){this.teardown(),this.c("teardown",this),this.history.d(this),this.removeAllListeners()}}),exports.default=q,exports.Microcosm=q,exports.Action=w,exports.History=k,exports.tag=b,exports.get=h,exports.set=c,exports.update=g,exports.merge=o,exports.inherit=a,exports.getRegistration=D;
{
"name": "microcosm",
"version": "12.7.0-alpha.4",
"version": "12.7.0-beta",
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.",

@@ -21,5 +21,4 @@ "main": "microcosm.js",

"dependencies": {
"form-serialize": "0.7.1",
"ric": "1.3.0"
"form-serialize": "0.7.1"
}
}
{
"name": "microcosm",
"version": "12.7.0-alpha.4",
"version": "12.7.0-beta",
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.",

@@ -21,5 +21,4 @@ "main": "microcosm.js",

"dependencies": {
"form-serialize": "0.7.1",
"ric": "1.3.0"
"form-serialize": "0.7.1"
}
}

@@ -32,7 +32,2 @@ 'use strict';

/**
* Determine if a value is defined within an object
*/
/**
* Non-destructively assign a value to a provided object at a given key. If the

@@ -39,0 +34,0 @@ * value is the same, don't do anything. Otherwise return a new object.

@@ -5,4 +5,2 @@ 'use strict';

require('ric');
/**

@@ -73,4 +71,2 @@ * A key path is a list of property names that describe a pathway

var hasOwn = Object.prototype.hasOwnProperty;
/**

@@ -160,21 +156,2 @@ * Shallow copy an object

/**
* Determine if a value is defined within an object
*/
function has(object, key, fallback) {
var path = castPath(key);
for (var i = 0, len = path.length; i < len; i++) {
var key = path[i];
if (!object || hasOwn.call(object, key) === false) {
return false;
}
object = object[key];
}
return true;
}
/**
* Non-destructively assign a value to a provided object at a given key. If the

@@ -851,10 +828,25 @@ * value is the same, don't do anything. Otherwise return a new object.

// requestIdleCallback isn't supported everywhere
var batchOptions = { timeout: 36 };
/**
* requestIdleCallback isn't supported everywhere and is hard to
* polyfill. For environments that do not support it, just use a
* setTimeout.
*
* Note: To be fully compliant, we would invoke the callback with the
* time remaining. Given our usage, we don't need to do that.
*/
var scheduler = global.requestIdleCallback || function (update) {
return setTimeout(update, 4);
};
/**
* When using requestIdleCallback, batch together updates until the
* browser is ready for them, but never make the user wait longer than
* 36 milliseconds.
*/
var BATCH_OPTIONS = { timeout: 36 };
function defaultUpdateStrategy(options) {
return function (update) {
if (options.batch === true) {
global.requestIdleCallback(update, batchOptions);
scheduler(update, BATCH_OPTIONS);
} else {

@@ -1377,2 +1369,6 @@ update();

if (domain.teardown) {
this.repo.on('teardown', domain.teardown, domain);
}
return domain;

@@ -1403,3 +1399,3 @@ },

if (key.length && has(data, key)) {
if (key.length) {
next = set(next, key, get(data, key));

@@ -1446,14 +1442,2 @@ }

}, payload);
},
teardown: function teardown() {
for (var i = 0, len = this.domains.length; i < len; i++) {
var _domains$i4 = this.domains[i],
key = _domains$i4[0],
domain = _domains$i4[1];
if (domain.teardown) {
domain.teardown(this.repo);
}
}
}

@@ -1475,2 +1459,6 @@ };

if (effect.teardown) {
this.repo.on('teardown', effect.teardown, effect);
}
this.effects.push(effect);

@@ -1480,11 +1468,2 @@

},
teardown: function teardown() {
for (var i = 0, len = this.effects.length; i < len; i++) {
var effect = this.effects[i];
if (effect.teardown) {
effect.teardown(this.repo);
}
}
},
dispatch: function dispatch(action) {

@@ -1528,2 +1507,6 @@ var command = action.command,

Node.getId = function (key, parent) {
return parent && parent.id ? parent.id + '.' + key : key;
};
Node.prototype = {

@@ -1604,3 +1587,3 @@ parent: null,

},
isEmpty: function isEmpty() {
isAlone: function isAlone() {
return this._events.length <= 0;

@@ -1612,3 +1595,2 @@ }

// counter-intuitive, so we keep track of them as a named constant.
var ROOT_KEY = '';
var ROOT_PATH = '';

@@ -1661,3 +1643,3 @@

if (query.isEmpty()) {
if (query.isAlone()) {
this.prune(query);

@@ -1679,6 +1661,10 @@ }

var root = this.nodes[ROOT_KEY];
var root = this.nodes[ROOT_PATH];
if (root) {
this.scan(root, last, snapshot);
var queries = this.scan(this.nodes[ROOT_PATH], last, snapshot, []);
for (var i = 0; i < queries.length; i++) {
queries[i].trigger(snapshot);
}
}

@@ -1695,3 +1681,5 @@ },

*/
addNode: function addNode(id, key, parent) {
addNode: function addNode(key, parent) {
var id = Node.getId(key, parent);
if (!this.nodes[id]) {

@@ -1770,9 +1758,6 @@ this.nodes[id] = new Node(id, key, parent);

addBranch: function addBranch(path, query) {
var last = this.addNode(ROOT_KEY, ROOT_PATH, null);
var keyBase = '';
var last = this.addNode(ROOT_PATH, null);
for (var i = 0, len = path.length; i < len; i++) {
keyBase = keyBase ? keyBase + '.' + path[i] : path[i];
last = this.addNode(keyBase, path[i], last);
last = this.addNode(path[i], last);
}

@@ -1791,36 +1776,21 @@

*/
scan: function scan(root, from, to) {
// Maintain a stack of nodes to process. As we traverse the tree,
// we'll push edges into this stack for processing
var stack = [{ node: root, last: from, next: to }];
scan: function scan(node, last, next, queries) {
if (last !== next) {
var edges = node.edges;
// Track the queries we've already triggered so queries with
// multiple subscriptions do not fire excessively
var triggered = [];
for (var i = 0, len = edges.length; i < len; i++) {
var edge = edges[i];
while (stack.length) {
var _stack$pop = stack.pop(),
node = _stack$pop.node,
last = _stack$pop.last,
next = _stack$pop.next;
if (edge instanceof Query && queries.indexOf(edge) < 0) {
queries.push(edge);
} else {
var edgeLast = last == null ? last : last[edge.key];
var edgeNext = next == null ? next : next[edge.key];
if (last !== next) {
var edges = node.edges;
for (var i = 0, len = edges.length; i < len; i++) {
var edge = edges[i];
if (edge instanceof Query && triggered.indexOf(edge) < 0) {
edge.trigger(this.snapshot);
triggered.push(edge);
} else {
stack.push({
node: edge,
last: last == null ? last : last[edge.key],
next: next == null ? next : next[edge.key]
});
}
this.scan(edge, edgeLast, edgeNext, queries);
}
}
}
return queries;
}

@@ -2166,5 +2136,2 @@ };

this.effects.teardown();
this.domains.teardown();
// Trigger a teardown event before completely shutting down

@@ -2171,0 +2138,0 @@ this._emit('teardown', this);

{
"name": "microcosm",
"version": "12.7.0-alpha.4",
"version": "12.7.0-beta",
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.",

@@ -21,5 +21,4 @@ "main": "microcosm.js",

"dependencies": {
"form-serialize": "0.7.1",
"ric": "1.3.0"
"form-serialize": "0.7.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc