diff --git a/.travis.yml b/.travis.yml
index 4cf6f163..9ae50c30 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,8 +3,7 @@ branches:
except:
- debug
node_js:
- - 8
- 10
cache:
directories:
- - node_modules
\ No newline at end of file
+ - node_modules
diff --git a/README.md b/README.md
index c584a776..2ad4399d 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,9 @@
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Famark%2Fgun?ref=badge_shield)
[](https://gitter.im/amark/gun)
-**GUN** is an _ecosystem_ of tools that let you build tomorrow's dApps, today.
+**GUN** is an _ecosystem_ of tools that let you build [community run](https://www.nbcnews.com/tech/tech-news/these-technologists-think-internet-broken-so-they-re-building-another-n1030136) and encrypted applications.
+
+Currently, [Internet Archive](https://news.ycombinator.com/item?id=17685682) and HackerNoon run GUN in production.
Decentralized alternatives to [Reddit](https://notabug.io/t/whatever/comments/36588a16b9008da4e3f15663c2225e949eca4a15/gpu-bot-test), [YouTube](https://d.tube/), [Wikipedia](https://news.ycombinator.com/item?id=17685682), etc. are already pushing terabytes of daily P2P traffic on GUN. We are a [friendly community](https://gitter.im/amark/gun) creating a free fun future for freedom:
diff --git a/examples/stats.html b/examples/stats.html
index e8ee7944..b6dfe27d 100644
--- a/examples/stats.html
+++ b/examples/stats.html
@@ -45,6 +45,10 @@
+
+
@@ -130,6 +134,18 @@ stats.show = async function(data){ //$.getJSON(url.value||(location.origin+'/gun
}});
}catch(e){}
+ try{
+ stats.daml = Object.values(data.dam['in'].long).map(function(n){ return n });
+ new Chartist.Line('.ct-daml', {
+ // A labels array that can contain any sort of values
+ //labels: ['-1min', '-45s', '-30s', '-15s', '0'],
+ // Our series array that contains series objects or in this case series data arrays
+ series: [stats.daml]
+ }, {fullWidth: true, axisY: {
+ labelInterpolationFnc: function(v) { return v+'ms' }
+ }});
+ }catch(e){}
+
new Chartist.Line('.ct-cpu', {
// A labels array that can contain any sort of values
labels: ['-15min', '-5min', '1min'],
diff --git a/examples/style.css b/examples/style.css
index 56274bf0..e7dd1ee4 100644
--- a/examples/style.css
+++ b/examples/style.css
@@ -135,7 +135,7 @@ ul, li {
.red { background: #ea3224; }
.green { background: #33cc33; }
.blue { background: #4D79D8; }
-.yellow { background: #f2b919; }
+.yellow { background: #d3a438; }
.black { background: black; }
.white { background: white; }
@@ -145,7 +145,7 @@ ul, li {
.redt { color: #ea3224; }
.greent { color: #33cc33; }
.bluet { color: #4D79D8; }
-.yellowt { color: #f2b919; }
+.yellowt { color: #d3a438; }
.blackt { color: black; }
.whitet { color: white; }
@@ -156,13 +156,13 @@ ul, li {
} @keyframes hue {
0% {background-color: #4D79D8;}
25% {background-color: #33cc33;}
- 50% {background-color: #f2b919;}
+ 50% {background-color: #d3a438;}
75% {background-color: #ea3224;}
100% {background-color: #4D79D8;}
} @-webkit-keyframes hue {
0% {background-color: #4D79D8;}
25% {background-color: #33cc33;}
- 50% {background-color: #f2b919;}
+ 50% {background-color: #d3a438;}
75% {background-color: #ea3224;}
100% {background-color: #4D79D8;}
}
@@ -174,13 +174,13 @@ ul, li {
} @keyframes huet {
0% {color: #4D79D8;}
25% {color: #33cc33;}
- 50% {color: #f2b919;}
+ 50% {color: #d3a438;}
75% {color: #ea3224;}
100% {color: #4D79D8;}
} @-webkit-keyframes huet {
0% {color: #4D79D8;}
25% {color: #33cc33;}
- 50% {color: #f2b919;}
+ 50% {color: #d3a438;}
75% {color: #ea3224;}
100% {color: #4D79D8;}
}
@@ -193,13 +193,13 @@ ul, li {
0% {background-color: #ea3224;}
25% {background-color: #4D79D8;}
50% {background-color: #33cc33;}
- 75% {background-color: #f2b919;}
+ 75% {background-color: #d3a438;}
100% {background-color: #ea3224;}
} @-webkit-keyframes hue2 {
0% {background-color: #ea3224;}
25% {background-color: #4D79D8;}
50% {background-color: #33cc33;}
- 75% {background-color: #f2b919;}
+ 75% {background-color: #d3a438;}
100% {background-color: #ea3224;}
}
@@ -211,13 +211,13 @@ ul, li {
0% {color: #ea3224;}
25% {color: #4D79D8;}
50% {color: #33cc33;}
- 75% {color: #f2b919;}
+ 75% {color: #d3a438;}
100% {color: #ea3224;}
} @-webkit-keyframes huet2 {
0% {color: #ea3224;}
25% {color: #4D79D8;}
50% {color: #33cc33;}
- 75% {color: #f2b919;}
+ 75% {color: #d3a438;}
100% {color: #ea3224;}
}
@@ -227,13 +227,13 @@ ul, li {
animation: hue3 900s infinite;
} @keyframes hue3 {
0% {background-color: #33cc33;}
- 25% {background-color: #f2b919;}
+ 25% {background-color: #d3a438;}
50% {background-color: #ea3224;}
75% {background-color: #4D79D8;}
100% {background-color: #33cc33;}
} @-webkit-keyframes hue3 {
0% {background-color: #33cc33;}
- 25% {background-color: #f2b919;}
+ 25% {background-color: #d3a438;}
50% {background-color: #ea3224;}
75% {background-color: #4D79D8;}
100% {background-color: #33cc33;}
@@ -245,52 +245,52 @@ ul, li {
animation: huet3 900s infinite;
} @keyframes huet3 {
0% {color: #33cc33;}
- 25% {color: #f2b919;}
+ 25% {color: #d3a438;}
50% {color: #ea3224;}
75% {color: #4D79D8;}
100% {color: #33cc33;}
} @-webkit-keyframes huet3 {
0% {color: #33cc33;}
- 25% {color: #f2b919;}
+ 25% {color: #d3a438;}
50% {color: #ea3224;}
75% {color: #4D79D8;}
100% {color: #33cc33;}
}
.hue4 {
- background: #f2b919;
+ background: #d3a438;
-webkit-animation: hue4 900s infinite;
animation: hue4 900s infinite;
} @keyframes hue4 {
- 0% {background-color: #f2b919;}
+ 0% {background-color: #d3a438;}
25% {background-color: #ea3224;}
50% {background-color: #4D79D8;}
75% {background-color: #33cc33;}
- 100% {background-color: #f2b919;}
+ 100% {background-color: #d3a438;}
} @-webkit-keyframes hue4 {
- 0% {background-color: #f2b919;}
+ 0% {background-color: #d3a438;}
25% {background-color: #ea3224;}
50% {background-color: #4D79D8;}
75% {background-color: #33cc33;}
- 100% {background-color: #f2b919;}
+ 100% {background-color: #d3a438;}
}
.huet4 {
- color: #f2b919;
+ color: #d3a438;
-webkit-animation: huet4 900s infinite;
animation: huet4 900s infinite;
} @keyframes huet4 {
- 0% {color: #f2b919;}
+ 0% {color: #d3a438;}
25% {color: #ea3224;}
50% {color: #4D79D8;}
75% {color: #33cc33;}
- 100% {color: #f2b919;}
+ 100% {color: #d3a438;}
} @-webkit-keyframes huet4 {
- 0% {color: #f2b919;}
+ 0% {color: #d3a438;}
25% {color: #ea3224;}
50% {color: #4D79D8;}
75% {color: #33cc33;}
- 100% {color: #f2b919;}
+ 100% {color: #d3a438;}
}
.pulse {
diff --git a/gun.js b/gun.js
index fe857936..a06a6c75 100644
--- a/gun.js
+++ b/gun.js
@@ -858,7 +858,7 @@
var state_lex = Gun.state.lex, _soul = Gun.val.link._, _has = '.', node_ = Gun.node._, rel_is = Gun.val.link.is;
var empty = {}, u;
- console.debug = function(i, s){ return (console.debug.i && i === console.debug.i && console.debug.i++) && (console.log.apply(console, arguments) || s) };
+ console.only = function(i, s){ return (console.only.i && i === console.only.i && console.only.i++) && (console.log.apply(console, arguments) || s) };
Gun.log = function(){ return (!Gun.log.off && console.log.apply(console, arguments)), [].slice.call(arguments).join(' ') }
Gun.log.once = function(w,s,o){ return (o = Gun.log.once)[w] = o[w] || 0, o[w]++ || Gun.log(s) }
@@ -1235,7 +1235,7 @@
gun = gun.$;
} else
if(key instanceof Function){
- if(true === cb){ return soul(this, key, cb, as) }
+ if(true === cb){ return soul(this, key, cb, as), this }
gun = this;
var at = gun._, root = at.root, tmp = root.now, ev;
as = cb || {};
@@ -1292,15 +1292,22 @@
}
function soul(gun, cb, opt, as){
var cat = gun._, acks = 0, tmp;
- if(tmp = cat.soul || cat.link || cat.dub){ return cb(tmp, as, cat), gun }
- gun.get(function(msg, ev){
+ if(tmp = cat.soul || cat.link || cat.dub){ return cb(tmp, as, cat) }
+ if(cat.jam){ return cat.jam.push([cb, as]) }
+ cat.jam = [[cb,as]];
+ gun.get(function(msg, eve){
if(u === msg.put && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks < tmp){
return;
}
- ev.rid(msg);
+ eve.rid(msg);
var at = ((at = msg.$) && at._) || {};
- tmp = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put) || at.dub;
- cb(tmp, as, msg, ev);
+ tmp = cat.jam; Gun.obj.del(cat, 'jam');
+ Gun.obj.map(tmp, function(as, cb){
+ cb = as[0]; as = as[1];
+ if(!cb){ return }
+ var id = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put) || at.dub;
+ cb(id, as, msg, eve);
+ });
}, {out: {get: {'.':true}}});
return gun;
}
@@ -1361,9 +1368,9 @@
Gun.chain.put = function(data, cb, as){
// #soul.has=value>state
// ~who#where.where=what>when@was
- // TODO: BUG! Put probably cannot handle plural chains!
+ // TODO: BUG! Put probably cannot handle plural chains! `!as` is quickfix test.
var gun = this, at = (gun._), root = at.root.$, ctx = root._, M = 100, tmp;
- if(!ctx.puta){ if(tmp = ctx.puts){ if(tmp > M){ // without this, when synchronous, writes to a 'not found' pile up, when 'not found' resolves it recursively calls `put` which incrementally resolves each write. Stack overflow limits can be as low as 10K, so this limit is hardcoded to 1% of 10K.
+ /*if(!ctx.puta && !as){ if(tmp = ctx.puts){ if(tmp > M){ // without this, when synchronous, writes to a 'not found' pile up, when 'not found' resolves it recursively calls `put` which incrementally resolves each write. Stack overflow limits can be as low as 10K, so this limit is hardcoded to 1% of 10K.
(ctx.stack || (ctx.stack = [])).push([gun, data, cb, as]);
if(ctx.puto){ return }
ctx.puto = setTimeout(function drain(){
@@ -1373,7 +1380,7 @@
ctx.stack = ctx.puts = ctx.puto = null;
}, 0);
return gun;
- } ++ctx.puts } else { ctx.puts = 1 } }
+ } ++ctx.puts } else { ctx.puts = 1 } }*/
as = as || {};
as.data = data;
as.via = as.$ = as.via || as.$ || gun;
@@ -1496,6 +1503,7 @@
ref = ref.get(path[i]);
}
if(is){ ref = v }
+ //if(as.not){ (ref._).dub = Gun.text.random() } // This might optimize stuff? Maybe not needed anymore. Make sure it doesn't introduce bugs.
var id = (ref._).dub;
if(id || (id = Gun.node.soul(at.obj))){
ref.back(-1).get(id);
@@ -1556,6 +1564,7 @@
if(at.link || at.soul){ return at.link || at.soul }
as.data = obj_put({}, at.get, as.data);
});
+ as.not = true; // maybe consider this?
}
tmp = tmp || at.soul || at.link || at.dub;// || at.get;
at = tmp? (at.root.$.get(tmp)._) : at;
@@ -1815,7 +1824,7 @@
// See the next 'opt' code below for actual saving of data.
var ev = this.to, opt = root.opt;
if(root.once){ return ev.next(root) }
- //if(false === opt.localStorage){ return ev.next(root) } // we want offline resynce queue regardless!
+ if(false === opt.localStorage){ return ev.next(root) } // we want offline resynce queue regardless! // actually, this doesn't help, per @go1dfish 's observation. Disabling for now, will need better solution later.
opt.prefix = opt.file || 'gun/';
var gap = Gun.obj.ify(store.getItem('gap/'+opt.prefix)) || {};
var empty = Gun.obj.empty, id, to, go;
@@ -1964,9 +1973,11 @@
try{msg = JSON.parse(raw);}catch(e){opt.log('DAM JSON parse error', e)}
if(!msg){ return }
var i = 0, m;
+ var S = +new Date; // STATS!
while(m = msg[i++]){
mesh.hear(m, peer);
}
+ (mesh.hear.long || (mesh.hear.long = [])).push(+new Date - S);
return;
}
if('{' === tmp || (Type.obj.is(raw) && (msg = raw))){
diff --git a/gun.min.js b/gun.min.js
index 51508f79..274f7345 100644
--- a/gun.min.js
+++ b/gun.min.js
@@ -1 +1 @@
-!function(){var t;"undefined"!=typeof window&&(t=window),"undefined"!=typeof global&&(t=global);var b=(t=t||{}).console||{log:function(){}};function _(o,t){return t?require(o):o.slice?_[e(o)]:function(t,n){o(t={exports:{}}),_[e(n)]=t.exports};function e(t){return t.split("/").slice(-1).toString().replace(".js","")}}if("undefined"!=typeof module)var o=module;_(function(t){var p={fn:{is:function(t){return!!t&&"function"==typeof t}}};p.bi={is:function(t){return t instanceof Boolean||"boolean"==typeof t}},p.num={is:function(t){return!d(t)&&(0<=t-parseFloat(t)+1||1/0===t||-1/0===t)}},p.text={is:function(t){return"string"==typeof t}},p.text.ify=function(t){return p.text.is(t)?t:"undefined"!=typeof JSON?JSON.stringify(t):t&&t.toString?t.toString():t},p.text.random=function(t,n){var o="";for(t=t||24,n=n||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";0"]||n["<"])||e===n["="]&&(o=n["*"]||n[">"]||n["<"],t.slice(0,(o||"").length)===o||e===n["*"]&&(e!==n[">"]&&e!==n["<"]?t>=n[">"]&&t<=n["<"]:e!==n[">"]&&t>=n[">"]||e!==n["<"]&&t<=n["<"])))},p.list={is:function(t){return t instanceof Array}},p.list.slit=Array.prototype.slice,p.list.sort=function(o){return function(t,n){return t&&n?(t=t[o])<(n=n[o])?-1:n",s.drift=0,s.is=function(t,n,o){var e=n&&t&&t[m]&&t[m][s._]||o;if(e)return g(e=e[n])?e:-1/0},s.lex=function(){return s().toString(36).replace(".","")},s.ify=function(t,n,o,e,i){if(!t||!t[m]){if(!i)return;t=a.soul.ify(t,i)}var r=c(t[m],s._);return void 0!==n&&n!==m&&(g(o)&&(r[n]=o),void 0!==e&&(t[n]=e)),t},s.to=function(t,n,o){var e=(t||{})[n];return p(e)&&(e=d(e)),s.ify(o,n,s.is(t,n),e,a.soul(t))},function(){function u(t,n){m!==n&&s.ify(this.o,n,this.s)}s.map=function(i,r,a){var t=p(t=i||r)?t:null;return i=v(i=i||r)?i:null,t&&!i?(r=g(r)?r:s(),t[m]=t[m]||{},h(t,u,{o:t,s:r}),t):(a=a||p(r)?r:void 0,r=g(r)?r:s(),function(t,n,o,e){if(!i)return u.call({o:o,s:r},t,n),t;i.call(a||this||{},t,n,o,e),l(o,n)&&void 0===o[n]||u.call({o:o,s:r},t,n)})}}();var f=n.obj,c=f.as,l=f.has,p=f.is,h=f.map,d=f.copy,g=n.num.is,v=n.fn.is,m=a._;t.exports=s})(_,"./state"),_(function(t){var a=_("./type"),f=_("./val"),c=_("./node"),r={};!function(){function i(t,n){if(!t||n!==c.soul(t)||!c.is(t,this.fn,this.as))return!0;this.cb&&(o.n=t,o.as=this.as,this.cb.call(o.as,t,n,o))}function o(t){t&&c.is(o.n,t,o.as)}r.is=function(t,n,o,e){return!(!t||!l(t)||u(t))&&!s(t,i,{cb:n,fn:o,as:e})}}(),function(){function u(t,n){var o;return(o=function(t,n){var o,e=t.seen,i=e.length;for(;i--;)if(o=e[i],n.obj===o.obj)return o;e.push(n)}(t,n))?o:(n.env=t,n.soul=i,c.ify(n.obj,e,n)&&(n.link=n.link||f.link.ify(c.soul(n.node)),n.obj!==t.shell&&(t.graph[f.link.is(n.link)]=n.node)),n)}function e(t,n,o){var e,i,r=this,a=r.env;if(c._===n&&h(t,f.link._))return o._;if(e=s(t,n,o,r,a)){if(n||(r.node=r.node||o||{},h(t,c._)&&c.soul(t)&&(r.node._=d(t._)),r.node=c.soul.ify(r.node,f.link.is(r.link)),r.link=r.link||f.link.ify(c.soul(r.node))),(i=a.map)&&(i.call(a.as||{},t,n,o,r),h(o,n))){if(void 0===(t=o[n]))return void p(o,n);if(!(e=s(t,n,o,r,a)))return}if(!n)return r.node;if(!0===e)return t;if((i=u(a,{obj:t,path:r.path.concat(n)})).node)return i.link}}function i(t){var n=this,o=f.link.is(n.link),e=n.env.graph;n.link=n.link||f.link.ify(t),n.link[f.link._]=t,n.node&&n.node[c._]&&(n.node[c._][f.link._]=t),h(e,o)&&(e[t]=e[o],p(e,o))}function s(t,n,o,e,i){var r;return!!f.is(t)||(l(t)?1:(r=i.invalid)?s(t=r.call(i.as||{},t,n,o),n,o,e,i):(i.err="Invalid value at '"+e.path.concat(n).join(".")+"'!",void(a.list.is(t)&&(i.err+=" Use `.set(item)` instead of an Array."))))}r.ify=function(t,n,o){var e={path:[],obj:t};return n?"string"==typeof n?n={soul:n}:n instanceof Function&&(n.map=n):n={},n.soul&&(e.link=f.link.ify(n.soul)),n.shell=(o||{}).shell,n.graph=n.graph||{},n.seen=n.seen||[],n.as=n.as||o,u(n,e),n.root=e.node,n.graph}}(),r.node=function(t){var n=c.soul(t);if(n)return o({},n,t)},function(){function i(t,n){var o,e;if(c._!==n)(o=f.link.is(t))?(e=this.opt.seen[o])?this.obj[n]=e:this.obj[n]=this.opt.seen[o]=r.to(this.graph,o,this.opt):this.obj[n]=t;else{if(u(t,f.link._))return;this.obj[n]=d(t)}}r.to=function(t,n,o){if(t){var e={};return o=o||{seen:{}},s(t[n],i,{obj:e,graph:t,opt:o}),e}}}();a.fn.is;var n=a.obj,l=n.is,p=n.del,h=n.has,u=n.empty,o=n.put,s=n.map,d=n.copy;t.exports=r})(_,"./graph"),_(function(t){_("./onto"),t.exports=function(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var o=t["#"]||t,e=(this.tag||empty)[o];if(!e)return;return e=this.on(o,n),clearTimeout(e.err),!0}o=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return o;var i=this.on(o,t,n);return i.err=i.err||setTimeout(function(){i.next({err:"Error: No ACK received yet.",lack:!0}),i.off()},(this.opt||{}).lack||9e3),o}}})(_,"./ask"),_(function(t){var r=_("./type");var a=r.time.is;t.exports=function(e){var i={s:{}};return e=e||{max:1e3,age:9e3},i.check=function(t){var n;return!!(n=i.s[t])&&(n.pass?n.pass=!1:i.track(t))},i.track=function(t,n){var o=i.s[t]||(i.s[t]={});return o.was=a(),n&&(o.pass=!0),i.to||(i.to=setTimeout(function(){var o=a();r.obj.map(i.s,function(t,n){t&&e.age>o-t.was||r.obj.del(i.s,n)}),i.to=null},e.age+9)),o},i}})(_,"./dup"),_(function(t){function c(t){return t instanceof c?(this._={gun:this,$:this}).$:this instanceof c?c.create(this._={gun:this,$:this,opt:t}):new c(t)}c.is=function(t){return t instanceof c||t&&t._&&t===t._.$||!1},c.version=.9,(c.chain=c.prototype).toJSON=function(){};var n=_("./type");n.obj.to(n,c),c.HAM=_("./HAM"),c.val=_("./val"),c.node=_("./node"),c.state=_("./state"),c.graph=_("./graph"),c.on=_("./onto"),c.ask=_("./ask"),c.dup=_("./dup"),function(){function a(t){var n,o,e=this.as,i=e.at||e,r=i.$;(o=t["#"])||(o=t["#"]=u(9)),(n=i.dup).check(o)?e.out===t.out&&(t.out=void 0,this.to.next(t)):(n.track(o),i.ask(t["@"],t)||(t.get&&c.on.get(t,r),t.put&&c.on.put(t,r)),this.to.next(t),e.out||(t.out=a,i.on("out",t)))}c.create=function(t){t.root=t.root||t,t.graph=t.graph||{},t.on=t.on||c.on,t.ask=t.ask||c.ask,t.dup=t.dup||c.dup();var n=t.$.opt(t.opt);return t.once||(t.on("in",a,t),t.on("out",a,{at:t,out:a}),c.on("create",t),t.on("create",t)),t.once=1,n}}(),function(){function i(t,n,o,e){var i=this,r=c.state.is(o,n);if(!r)return i.err="Error: No state on '"+n+"' in node '"+e+"'!";var a=i.graph[e]||v,u=c.state.is(a,n,!0),s=a[n],f=c.HAM(i.machine,r,u,t,s);f.incoming?(i.put[e]=c.state.to(o,n,i.put[e]),(i.diff||(i.diff={}))[e]=c.state.to(o,n,i.diff[e]),i.souls[e]=!0):f.defer&&(i.defer=r<(i.defer||1/0)?r:i.defer)}function r(t,n){var o=this,e=o.$._,i=(e.next||v)[n];if(!i){if(!(e.opt||v).super)return void(o.souls[n]=!1);i=o.$.get(n)._}var r=o.map[n]={put:t,get:n,$:i.$},a={ctx:o,msg:r};o.async=!!e.tag.node,o.ack&&(r["@"]=o.ack),h(t,u,a),o.async&&(o.and||e.on("node",function(t){this.to.next(t),t===o.map[t.get]&&(o.souls[t.get]=!1,h(t.put,s,t),h(o.souls,function(t){if(t)return t})||o.c||(o.c=1,this.off(),h(o.map,f,o)))}),o.and=!0,e.on("node",r))}function u(t,n){var o=this.ctx,e=o.graph,i=this.msg,r=i.get,a=i.put,u=i.$._;e[r]=c.state.to(a,n,e[r]),o.async||(u.put=c.state.to(a,n,u.put))}function s(t,n){var o=this.put,e=this.$._;e.put=c.state.to(o,n,e.put)}function f(t,n){t.$&&(this.cat.stop=this.stop,t.$._.on("in",t),this.cat.stop=null)}c.on.put=function(t,n){var o=n._,e={$:n,graph:o.graph,put:{},map:{},souls:{},machine:c.state(),ack:t["@"],cat:o,stop:{}};if(c.graph.is(t.put,null,i,e)||(e.err="Error: Invalid graph!"),e.err)return o.on("in",{"@":t["#"],err:c.log(e.err)});h(e.put,r,e),e.async||h(e.map,f,e),void 0!==e.defer&&setTimeout(function(){c.on.put(t,n)},e.defer-e.machine),e.diff&&o.on("put",p(t,{put:e.diff}))},c.on.get=function(t,n){var o=n._,e=t.get,i=e[d],r=o.graph[i],a=e[g],u=(o.next||(o.next={}))[i];if(!r)return o.on("get",t);if(a){if("string"!=typeof a||!l(r,a))return o.on("get",t);r=c.state.to(r,a)}else r=c.obj.copy(r);r=c.graph.node(r),(u||v).ack,o.on("in",{"@":t["#"],how:"mem",put:r,$:n}),o.on("get",t)}}(),c.chain.opt=function(t){t=t||{};var n=this._,o=t.peers||t;return s(t)||(t={}),s(n.opt)||(n.opt=t),r(o)&&(o=[o]),e(o)&&(o=h(o,function(t,n,o){(n={}).id=n.url=t,o(t,n)}),s(n.opt.peers)||(n.opt.peers={}),n.opt.peers=p(o,n.opt.peers)),n.opt.peers=n.opt.peers||{},h(t,function t(n,o){!l(this,o)||i.is(n)||a.empty(n)?this[o]=n:h(n,t,this[o])},n.opt),c.on("opt",n),n.opt.uuid=n.opt.uuid||function(){return f()+u(12)},this};var e=c.list.is,i=c.text,r=i.is,u=i.random,a=c.obj,s=a.is,l=a.has,p=a.to,h=a.map,f=(a.copy,c.state.lex),d=c.val.link._,g=".",v=(c.node._,c.val.link.is,{});b.debug=function(t,n){return b.debug.i&&t===b.debug.i&&b.debug.i++&&(b.log.apply(b,arguments)||n)},(c.log=function(){return!c.log.off&&b.log.apply(b,arguments),[].slice.call(arguments).join(" ")}).once=function(t,n,o){return(o=c.log.once)[t]=o[t]||0,o[t]++||c.log(n)},c.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=c).window=window);try{void 0!==o&&(o.exports=c)}catch(t){}t.exports=c})(_,"./root"),_(function(t){var u=_("./root");u.chain.back=function(t,n){if(-1===(t=t||1)||1/0===t)return this._.root.$;if(1===t)return(this._.back||this._).$;var o=this._;if("string"==typeof t&&(t=t.split(".")),t instanceof Array){for(var e=0,i=t.length,r=o;e(r.acks||0)&&this.off(),r.ack&&r.ack(t,this)},r.opt),o=0,e=n.root.now;u.del(n.root,"now");var i=n.root.mum;n.root.mum={},r.ref._.on("out",{$:r.ref,put:r.out=r.env.graph,opt:r.opt,"#":t}),n.root.mum=i?u.to(i,n.root.mum):i,n.root.now=e},r),r.res&&r.res())}function n(t,n){if(t)return!0}function l(r,t,n,a){var u=this,s=f.is(r);!t&&a.path.length&&(u.res||e)(function(){for(var t=a.path,n=u.ref,o=(u.opt,0),e=t.length;o .once, apologies unexpected."),this.once(t,n)},f.chain.once=function(t,n){var o=this,e=o._,i=e.put;if(0=(e.batch||1e3))return f();i||(i=setTimeout(f,e.wait||1))}),r.on("get",function(n){this.to.next(n);var o,e,i=n.get;function t(){if(i&&(o=i["#"])){var t=i["."];(e=s[o]||void 0)&&t&&(e=Gun.state.to(e,t)),r.on("in",{"@":n["#"],put:Gun.graph.node(e),how:"lS",lS:n.$})}}Gun.debug?setTimeout(t,1):t()});var n=function(t,n,o,e){s[e]=Gun.state.to(o,n,s[e])},f=function(t){var o;u=0,clearTimeout(i),i=!1;var n=a;a={},t&&(s=t);try{p.setItem(e.prefix,JSON.stringify(s))}catch(t){Gun.log(o=(t||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"),r.on("localStorage:error",{err:o,file:e.prefix,flush:s,retry:f})}(o||Gun.obj.empty(e.peers))&&Gun.obj.map(n,function(t,n){r.on("in",{"@":n,err:o,ok:0})})}}})}})(_,"./adapters/localStorage"),_(function(t){var d=_("../type");!function(){d.text.hash=function(t){if("string"!=typeof t)return{err:1};var n=0;if(!t.length)return n;for(var o=0,e=t.length;o<"])&&(o._.to=d.obj.map(r.split(","),f)),o.dam?void((r=c.hear[o.dam])&&r(o,n,s)):void s.on("in",o)}}else{try{o=JSON.parse(t)}catch(t){l.log("DAM JSON parse error",t)}if(!o)return;for(var a,u=0;a=o[u++];)c.hear(a,n)}}};var f=function(t,n,o){o(t,!0)};function h(n,o){try{var t=o.wire;o.say?o.say(n):t.send&&t.send(n),c.say.d+=n.length||0,++c.say.c}catch(t){(o.queue=o.queue||[]).push(n)}}c.hear.c=c.hear.d=0,function(){var u;function s(t){c.say(u,t)}function f(t){var n=t.batch;if(t.batch=t.tail=null,n&&n.length){try{n=1===n.length?n[0]:JSON.stringify(n)}catch(t){return l.log("DAM JSON stringify error",t)}n&&h(n,t)}}c.say=function(t,n){if(this.to&&this.to.next(t),!t)return!1;var o,e,i,r,a=t._||(t._=function(){});if((o=t["#"])||(o=t["#"]=d.text.random(9)),(e=t["##"])||void 0===t.put||(e=t["##"]=d.obj.hash(t.put)),!(r=a.raw)&&(r=a.raw=c.raw(t),e&&(i=t["@"])&&(p.track(i+e).it=t,i=(p.s[i]||!0).it))){if(e===i["##"])return!1;i["##"]=e}if(p.track(o).it=t,n||(n=(i=p.s[t["@"]])&&(i=i.it)&&(i=i._)&&(i=i.via)),!n&&c.way)return c.way(t);if(!n||!n.id)return u=t,!!d.obj.is(n||l.peers)&&void d.obj.map(n||l.peers,s);if(!n.wire&&c.wire&&c.wire(n),o!==n.last){if(n.last=o,n===a.via)return!1;if((i=a.to)&&(i[n.url]||i[n.pid]||i[n.id]))return!1;if(n.batch){if(n.tail=(i=n.tail||0)+r.length,n.tail<=l.pack)return void n.batch.push(r);f(n)}n.batch=[],setTimeout(function(){f(n)},l.gap),h(r,n)}},c.say.c=c.say.d=0}(),function(){c.raw=function(t){if(!t)return"";var n,o=t._||{};if(n=o.raw)return n;if("string"==typeof t)return t;if(!t.dam){var e=0,i=[];d.obj.map(l.peers,function(t){if(i.push(t.url||t.pid||t.id),9<++e)return!0}),1<"]=i.join())}var r=a(t);return o&&(o.raw=r),r};var a=JSON.stringify}(),c.hi=function(n){var t=n.wire||{};n.id?l.peers[n.url||n.id]=n:(t=n.id=n.id||d.text.random(9),c.say({dam:"?"},l.peers[t]=n)),n.met=n.met||+new Date,t.hied||s.on(t.hied="hi",n),t=n.queue,n.queue=[],d.obj.map(t,function(t){h(t,n)})},c.bye=function(t){s.on("bye",t);var n=+new Date;n-=t.met||n,c.bye.time=((c.bye.time||n)+n)/2},c.hear["!"]=function(t,n){l.log("Error:",t.err)},c.hear["?"]=function(t,n){t.pid?n.pid||(n.pid=t.pid):c.say({dam:"?",pid:l.pid,"@":t["#"]},n)},s.on("create",function(t){t.opt.pid=t.opt.pid||d.text.random(9),this.to.next(t),t.on("out",c.say)}),s.on("bye",function(t,n){t=l.peers[t.id||t]||t,this.to.next(t),t.bye?t.bye():(n=t.wire)&&n.close&&n.close(),d.obj.del(l.peers,t.id),t.wire=null});var i={};return s.on("bye",function(t,n){this.to.next(t),(n=t.url)&&(i[n]=!0,setTimeout(function(){delete i[n]},l.lack||9e3))}),s.on("hi",function(o,e){this.to.next(o),(e=o.url)&&i[e]&&(delete i[e],d.obj.map(s.next,function(t,n){(e={})[n]=s.graph[n],c.say({"##":d.obj.hash(e),get:{"#":n}},o)}))}),c}}catch(t){}})(_,"./adapters/mesh"),_(function(t){var f=_("../index");f.Mesh=_("./mesh"),f.on("opt",function(t){this.to.next(t);var e=t.opt;if(!t.once&&!1!==e.WebSocket){var n;"undefined"!=typeof window&&(n=window),"undefined"!=typeof global&&(n=global),n=n||{};var o=e.WebSocket||n.WebSocket||n.webkitWebSocket||n.mozWebSocket;if(o){e.WebSocket=o;var i=e.mesh=e.mesh||f.Mesh(t);i.wire||e.wire;i.wire=e.wire=u;var r=2e3,a="undefined"!=typeof document&&document}}function u(n){try{if(!n||!n.url)return o&&o(n);var t=n.url.replace("http","ws"),o=n.wire=new e.WebSocket(t);return o.onclose=function(){e.mesh.bye(n),s(n)},o.onerror=function(t){s(n)},o.onopen=function(){e.mesh.hi(n)},o.onmessage=function(t){t&&e.mesh.hear(t.data||t,n)},o}catch(t){}}function s(n){clearTimeout(n.defer),a&&n.retry<=0||(n.retry=(n.retry||e.retry||60)-1,n.defer=setTimeout(function t(){if(a&&a.hidden)return setTimeout(t,r);u(n)},r))}})})(_,"./adapters/websocket")}();
\ No newline at end of file
+!function(){var t;"undefined"!=typeof window&&(t=window),"undefined"!=typeof global&&(t=global);var j=(t=t||{}).console||{log:function(){}};function $(o,t){return t?require(o):o.slice?$[e(o)]:function(t,n){o(t={exports:{}}),$[e(n)]=t.exports};function e(t){return t.split("/").slice(-1).toString().replace(".js","")}}if("undefined"!=typeof module)var o=module;$(function(t){var n,c,l={};function o(t,n){v(this,n)&&void 0!==this[n]||(this[n]=t)}function e(t,n){var o=this.n;if(!o||!(n===o||g(o)&&v(o,n)))return!!n||void 0}function p(t,n){2!==arguments.length?(p.r=p.r||[]).push(t):(p.r=p.r||{})[t]=n}l.fn={is:function(t){return!!t&&"function"==typeof t}},l.bi={is:function(t){return t instanceof Boolean||"boolean"==typeof t}},l.num={is:function(t){return!d(t)&&(0<=t-parseFloat(t)+1||1/0===t||-1/0===t)}},l.text={is:function(t){return"string"==typeof t}},l.text.ify=function(t){return l.text.is(t)?t:"undefined"!=typeof JSON?JSON.stringify(t):t&&t.toString?t.toString():t},l.text.random=function(t,n){var o="";for(t=t||24,n=n||"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZabcdefghijklmnopqrstuvwxyz";0"]||n["<"])||e===n["="]&&(o=n["*"]||n[">"]||n["<"],t.slice(0,(o||"").length)===o||e===n["*"]&&(e!==n[">"]&&e!==n["<"]?t>=n[">"]&&t<=n["<"]:e!==n[">"]&&t>=n[">"]||e!==n["<"]&&t<=n["<"])))},l.list={is:function(t){return t instanceof Array}},l.list.slit=Array.prototype.slice,l.list.sort=function(o){return function(t,n){return t&&n?(t=t[o])<(n=n[o])?-1:n",u.drift=0,u.is=function(t,n,o){var e=n&&t&&t[k]&&t[k][u._]||o;if(e)return v(e=e[n])?e:-1/0},u.lex=function(){return u().toString(36).replace(".","")},u.ify=function(t,n,o,e,i){if(!t||!t[k]){if(!i)return;t=a.soul.ify(t,i)}var r=l(t[k],u._);return void 0!==n&&n!==k&&(v(o)&&(r[n]=o),void 0!==e&&(t[n]=e)),t},u.to=function(t,n,o){var e=(t||{})[n];return h(e)&&(e=g(e)),u.ify(o,n,u.is(t,n),e,a.soul(t))},u.map=function(i,r,a){var t=h(t=i||r)?t:null;return i=m(i=i||r)?i:null,t&&!i?(r=v(r)?r:u(),t[k]=t[k]||{},d(t,f,{o:t,s:r}),t):(a=a||h(r)?r:void 0,r=v(r)?r:u(),function(t,n,o,e){if(!i)return f.call({o:o,s:r},t,n),t;i.call(a||this||{},t,n,o,e),p(o,n)&&void 0===o[n]||f.call({o:o,s:r},t,n)})};var c=n.obj,l=c.as,p=c.has,h=c.is,d=c.map,g=c.copy,v=n.num.is,m=n.fn.is,k=a._;t.exports=u})($,"./state"),$(function(t){var a=$("./type"),u=$("./val"),s=$("./node"),i={};function r(t,n){if(!t||n!==s.soul(t)||!s.is(t,this.fn,this.as))return!0;this.cb&&(o.n=t,o.as=this.as,this.cb.call(o.as,t,n,o))}function o(t){t&&s.is(o.n,t,o.as)}function f(t,n){var o;return(o=function(t,n){var o,e=t.seen,i=e.length;for(;i--;)if(o=e[i],n.obj===o.obj)return o;e.push(n)}(t,n))?o:(n.env=t,n.soul=c,s.ify(n.obj,e,n)&&(n.link=n.link||u.link.ify(s.soul(n.node)),n.obj!==t.shell&&(t.graph[u.link.is(n.link)]=n.node)),n)}function e(t,n,o){var e,i,r=this,a=r.env;if(s._===n&&g(t,u.link._))return o._;if(e=l(t,n,o,r,a)){if(n||(r.node=r.node||o||{},g(t,s._)&&s.soul(t)&&(r.node._=b(t._)),r.node=s.soul.ify(r.node,u.link.is(r.link)),r.link=r.link||u.link.ify(s.soul(r.node))),(i=a.map)&&(i.call(a.as||{},t,n,o,r),g(o,n))){if(void 0===(t=o[n]))return void d(o,n);if(!(e=l(t,n,o,r,a)))return}if(!n)return r.node;if(!0===e)return t;if((i=f(a,{obj:t,path:r.path.concat(n)})).node)return i.link}}function c(t){var n=this,o=u.link.is(n.link),e=n.env.graph;n.link=n.link||u.link.ify(t),n.link[u.link._]=t,n.node&&n.node[s._]&&(n.node[s._][u.link._]=t),g(e,o)&&(e[t]=e[o],d(e,o))}function l(t,n,o,e,i){var r;return!!u.is(t)||(h(t)?1:(r=i.invalid)?l(t=r.call(i.as||{},t,n,o),n,o,e,i):(i.err="Invalid value at '"+e.path.concat(n).join(".")+"'!",void(a.list.is(t)&&(i.err+=" Use `.set(item)` instead of an Array."))))}function p(t,n){var o,e;if(s._!==n)(o=u.link.is(t))?(e=this.opt.seen[o])?this.obj[n]=e:this.obj[n]=this.opt.seen[o]=i.to(this.graph,o,this.opt):this.obj[n]=t;else{if(v(t,u.link._))return;this.obj[n]=b(t)}}i.is=function(t,n,o,e){return!(!t||!h(t)||v(t)||k(t,r,{cb:n,fn:o,as:e}))},i.ify=function(t,n,o){var e={path:[],obj:t};return n?"string"==typeof n?n={soul:n}:n instanceof Function&&(n.map=n):n={},n.soul&&(e.link=u.link.ify(n.soul)),n.shell=(o||{}).shell,n.graph=n.graph||{},n.seen=n.seen||[],n.as=n.as||o,f(n,e),n.root=e.node,n.graph},i.node=function(t){var n=s.soul(t);if(n)return m({},n,t)},i.to=function(t,n,o){if(t){var e={};return o=o||{seen:{}},k(t[n],p,{obj:e,graph:t,opt:o}),e}};a.fn.is;var n=a.obj,h=n.is,d=n.del,g=n.has,v=n.empty,m=n.put,k=n.map,b=n.copy;t.exports=i})($,"./graph"),$(function(t){$("./onto"),t.exports=function(t,n){if(this.on){if(!(t instanceof Function)){if(!t||!n)return;var o=t["#"]||t,e=(this.tag||empty)[o];if(!e)return;return e=this.on(o,n),clearTimeout(e.err),!0}o=n&&n["#"]||Math.random().toString(36).slice(2);if(!t)return o;var i=this.on(o,t,n);return i.err=i.err||setTimeout(function(){i.next({err:"Error: No ACK received yet.",lack:!0}),i.off()},(this.opt||{}).lack||9e3),o}}})($,"./ask"),$(function(t){var r=$("./type");var a=r.time.is;t.exports=function(e){var i={s:{}};return e=e||{max:1e3,age:9e3},i.check=function(t){var n;return!!(n=i.s[t])&&(n.pass?n.pass=!1:i.track(t))},i.track=function(t,n){var o=i.s[t]||(i.s[t]={});return o.was=a(),n&&(o.pass=!0),i.to||(i.to=setTimeout(function(){var o=a();r.obj.map(i.s,function(t,n){t&&e.age>o-t.was||r.obj.del(i.s,n)}),i.to=null},e.age+9)),o},i}})($,"./dup"),$(function(t){function c(t){return t instanceof c?(this._={gun:this,$:this}).$:this instanceof c?c.create(this._={gun:this,$:this,opt:t}):new c(t)}c.is=function(t){return t instanceof c||t&&t._&&t===t._.$||!1},c.version=.9,(c.chain=c.prototype).toJSON=function(){};var n=$("./type");function a(t){var n,o,e=this.as,i=e.at||e,r=i.$;(o=t["#"])||(o=t["#"]=h(9)),(n=i.dup).check(o)?e.out===t.out&&(t.out=void 0,this.to.next(t)):(n.track(o),i.ask(t["@"],t)||(t.get&&c.on.get(t,r),t.put&&c.on.put(t,r)),this.to.next(t),e.out||(t.out=a,i.on("out",t)))}function i(t,n,o,e){var i=this,r=c.state.is(o,n);if(!r)return i.err="Error: No state on '"+n+"' in node '"+e+"'!";var a=i.graph[e]||x,u=c.state.is(a,n,!0),s=a[n],f=c.HAM(i.machine,r,u,t,s);f.incoming?(i.put[e]=c.state.to(o,n,i.put[e]),(i.diff||(i.diff={}))[e]=c.state.to(o,n,i.diff[e]),i.souls[e]=!0):f.defer&&(i.defer=r<(i.defer||1/0)?r:i.defer)}function r(t,n){var o=this,e=o.$._,i=(e.next||x)[n];if(!i){if(!(e.opt||x).super)return void(o.souls[n]=!1);i=o.$.get(n)._}var r=o.map[n]={put:t,get:n,$:i.$},a={ctx:o,msg:r};o.async=!!e.tag.node,o.ack&&(r["@"]=o.ack),k(t,u,a),o.async&&(o.and||e.on("node",function(t){this.to.next(t),t===o.map[t.get]&&(o.souls[t.get]=!1,k(t.put,s,t),k(o.souls,function(t){if(t)return t})||o.c||(o.c=1,this.off(),k(o.map,f,o)))}),o.and=!0,e.on("node",r))}function u(t,n){var o=this.ctx,e=o.graph,i=this.msg,r=i.get,a=i.put,u=i.$._;e[r]=c.state.to(a,n,e[r]),o.async||(u.put=c.state.to(a,n,u.put))}function s(t,n){var o=this.put,e=this.$._;e.put=c.state.to(o,n,e.put)}function f(t,n){t.$&&(this.cat.stop=this.stop,t.$._.on("in",t),this.cat.stop=null)}n.obj.to(n,c),c.HAM=$("./HAM"),c.val=$("./val"),c.node=$("./node"),c.state=$("./state"),c.graph=$("./graph"),c.on=$("./onto"),c.ask=$("./ask"),c.dup=$("./dup"),c.create=function(t){t.root=t.root||t,t.graph=t.graph||{},t.on=t.on||c.on,t.ask=t.ask||c.ask,t.dup=t.dup||c.dup();var n=t.$.opt(t.opt);return t.once||(t.on("in",a,t),t.on("out",a,{at:t,out:a}),c.on("create",t),t.on("create",t)),t.once=1,n},c.on.put=function(t,n){var o=n._,e={$:n,graph:o.graph,put:{},map:{},souls:{},machine:c.state(),ack:t["@"],cat:o,stop:{}};if(c.graph.is(t.put,null,i,e)||(e.err="Error: Invalid graph!"),e.err)return o.on("in",{"@":t["#"],err:c.log(e.err)});k(e.put,r,e),e.async||k(e.map,f,e),void 0!==e.defer&&setTimeout(function(){c.on.put(t,n)},e.defer-e.machine),e.diff&&o.on("put",m(t,{put:e.diff}))},c.on.get=function(t,n){var o=n._,e=t.get,i=e[y],r=o.graph[i],a=e[_],u=(o.next||(o.next={}))[i];if(!r)return o.on("get",t);if(a){if("string"!=typeof a||!v(r,a))return o.on("get",t);r=c.state.to(r,a)}else r=c.obj.copy(r);r=c.graph.node(r),(u||x).ack,o.on("in",{"@":t["#"],how:"mem",put:r,$:n}),o.on("get",t)},c.chain.opt=function(t){t=t||{};var n=this._,o=t.peers||t;return g(t)||(t={}),g(n.opt)||(n.opt=t),p(o)&&(o=[o]),e(o)&&(o=k(o,function(t,n,o){(n={}).id=n.url=t,o(t,n)}),g(n.opt.peers)||(n.opt.peers={}),n.opt.peers=m(o,n.opt.peers)),n.opt.peers=n.opt.peers||{},k(t,function t(n,o){!v(this,o)||l.is(n)||d.empty(n)?this[o]=n:n&&n.constructor!==Object&&!e(n)||k(n,t,this[o])},n.opt),c.on("opt",n),n.opt.uuid=n.opt.uuid||function(){return b()+h(12)},this};var e=c.list.is,l=c.text,p=l.is,h=l.random,d=c.obj,g=d.is,v=d.has,m=d.to,k=d.map,b=(d.copy,c.state.lex),y=c.val.link._,_=".",x=(c.node._,c.val.link.is,{});j.only=function(t,n){return j.only.i&&t===j.only.i&&j.only.i++&&(j.log.apply(j,arguments)||n)},(c.log=function(){return c.log.off||j.log.apply(j,arguments),[].slice.call(arguments).join(" ")}).once=function(t,n,o){return(o=c.log.once)[t]=o[t]||0,o[t]++||c.log(n)},c.log.once("welcome","Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow questions tagged with 'gun'!"),"undefined"!=typeof window&&((window.GUN=window.Gun=c).window=window);try{void 0!==o&&(o.exports=c)}catch(t){}t.exports=c})($,"./root"),$(function(t){var u=$("./root");u.chain.back=function(t,n){if(-1===(t=t||1)||1/0===t)return this._.root.$;if(1===t)return(this._.back||this._).$;var o=this._;if("string"==typeof t&&(t=t.split(".")),t instanceof Array){for(var e=0,i=t.length,r=o;e(r.acks||0)&&this.off(),r.ack&&r.ack(t,this)},r.opt),o=0,e=n.root.now;h.del(n.root,"now");var i=n.root.mum;n.root.mum={},r.ref._.on("out",{$:r.ref,put:r.out=r.env.graph,opt:r.opt,"#":t}),n.root.mum=i?h.to(i,n.root.mum):i,n.root.now=e},r),r.res&&r.res())}function n(t,n){if(t)return!0}function c(r,t,n,a){var u=this,s=f.is(r);!t&&a.path.length&&(u.res||e)(function(){for(var t=a.path,n=u.ref,o=(u.opt,0),e=t.length;o .once, apologies unexpected."),this.once(t,n)},f.chain.once=function(t,n){var o=this,e=o._,i=e.put;if(0=(e.batch||1e3))return f();i=i||setTimeout(f,e.wait||1)}),a.on("get",function(n){this.to.next(n);var o,e,i,r=n.get;function t(){if(r&&(o=r["#"])){var t=r["."];(e=s[o]||i)&&t&&(e=Gun.state.to(e,t)),a.on("in",{"@":n["#"],put:Gun.graph.node(e),how:"lS",lS:n.$})}}Gun.debug?setTimeout(t,1):t()});var n=function(t,n,o,e){s[e]=Gun.state.to(o,n,s[e])},f=function(t){var o;u=0,clearTimeout(i),i=!1;var n=r;r={},t&&(s=t);try{p.setItem(e.prefix,JSON.stringify(s))}catch(t){Gun.log(o=(t||"localStorage failure")+" Consider using GUN's IndexedDB plugin for RAD for more storage space, https://gun.eco/docs/RAD#install"),a.on("localStorage:error",{err:o,file:e.prefix,flush:s,retry:f})}(o||Gun.obj.empty(e.peers))&&Gun.obj.map(n,function(t,n){a.on("in",{"@":n,err:o,ok:0})})}}})}})($,"./adapters/localStorage"),$(function(t){var v=$("../type");!function(){v.text.hash=function(t){if("string"!=typeof t)return{err:1};var n=0;if(!t.length)return n;for(var o=0,e=t.length;o<"])&&(o._.to=v.obj.map(r.split(","),p)),o.dam?void((r=f.hear[o.dam])&&r(o,n,s)):void s.on("in",o)}}else{try{o=JSON.parse(t)}catch(t){c.log("DAM JSON parse error",t)}if(!o)return;for(var a,u=0;a=o[u++];)f.hear(a,n)}}};var u,p=function(t,n,o){o(t,!0)};function h(t){f.say(u,t)}function d(t){var n=t.batch;if(t.batch=t.tail=null,n&&n.length){try{n=1===n.length?n[0]:JSON.stringify(n)}catch(t){return c.log("DAM JSON stringify error",t)}n&&g(n,t)}}function g(n,o){try{var t=o.wire;o.say?o.say(n):t.send&&t.send(n),f.say.d+=n.length||0,++f.say.c}catch(t){(o.queue=o.queue||[]).push(n)}}f.hear.c=f.hear.d=0,f.say=function(t,n){if(this.to&&this.to.next(t),!t)return!1;var o,e,i,r,a=t._||(t._=function(){});if((o=t["#"])||(o=t["#"]=v.text.random(9)),(e=t["##"])||void 0===t.put||(e=t["##"]=v.obj.hash(t.put)),!(r=a.raw)&&(r=a.raw=f.raw(t),e&&(i=t["@"])&&(l.track(i+e).it=t,i=(l.s[i]||!0).it))){if(e===i["##"])return!1;i["##"]=e}if(l.track(o).it=t,!(n=n||(i=l.s[t["@"]])&&(i=i.it)&&(i=i._)&&(i=i.via))&&f.way)return f.way(t);if(!n||!n.id)return u=t,!!v.obj.is(n||c.peers)&&void v.obj.map(n||c.peers,h);if(!n.wire&&f.wire&&f.wire(n),o!==n.last){if(n.last=o,n===a.via)return!1;if((i=a.to)&&(i[n.url]||i[n.pid]||i[n.id]))return!1;if(n.batch){if(n.tail=(i=n.tail||0)+r.length,n.tail<=c.pack)return void n.batch.push(r);d(n)}n.batch=[],setTimeout(function(){d(n)},c.gap),g(r,n)}},f.say.c=f.say.d=0,function(){f.raw=function(t){if(!t)return"";var n,o=t._||{};if(n=o.raw)return n;if("string"==typeof t)return t;if(!t.dam){var e=0,i=[];v.obj.map(c.peers,function(t){if(i.push(t.url||t.pid||t.id),9<++e)return!0}),1<"]=i.join())}var r=a(t);return o&&(o.raw=r),r};var a=JSON.stringify}(),f.hi=function(n){var t=n.wire||{};n.id?c.peers[n.url||n.id]=n:(t=n.id=n.id||v.text.random(9),f.say({dam:"?"},c.peers[t]=n)),n.met=n.met||+new Date,t.hied||s.on(t.hied="hi",n),t=n.queue,n.queue=[],v.obj.map(t,function(t){g(t,n)})},f.bye=function(t){s.on("bye",t);var n=+new Date;n-=t.met||n,f.bye.time=((f.bye.time||n)+n)/2},f.hear["!"]=function(t,n){c.log("Error:",t.err)},f.hear["?"]=function(t,n){t.pid?n.pid||(n.pid=t.pid):f.say({dam:"?",pid:c.pid,"@":t["#"]},n)},s.on("create",function(t){t.opt.pid=t.opt.pid||v.text.random(9),this.to.next(t),t.on("out",f.say)}),s.on("bye",function(t,n){t=c.peers[t.id||t]||t,this.to.next(t),t.bye?t.bye():(n=t.wire)&&n.close&&n.close(),v.obj.del(c.peers,t.id),t.wire=null});var i={};return s.on("bye",function(t,n){this.to.next(t),(n=t.url)&&(i[n]=!0,setTimeout(function(){delete i[n]},c.lack||9e3))}),s.on("hi",function(o,e){this.to.next(o),(e=o.url)&&i[e]&&(delete i[e],v.obj.map(s.next,function(t,n){(e={})[n]=s.graph[n],f.say({"##":v.obj.hash(e),get:{"#":n}},o)}))}),f}}catch(t){}})($,"./adapters/mesh"),$(function(t){var f=$("../index");f.Mesh=$("./mesh"),f.on("opt",function(t){this.to.next(t);var e=t.opt;if(!t.once&&!1!==e.WebSocket){var n;"undefined"!=typeof window&&(n=window),"undefined"!=typeof global&&(n=global),n=n||{};var o=e.WebSocket||n.WebSocket||n.webkitWebSocket||n.mozWebSocket;if(o){e.WebSocket=o;var i=e.mesh=e.mesh||f.Mesh(t);i.wire||e.wire;i.wire=e.wire=u;var r=2e3,a="undefined"!=typeof document&&document}}function u(n){try{if(!n||!n.url)return o&&o(n);var t=n.url.replace("http","ws"),o=n.wire=new e.WebSocket(t);return o.onclose=function(){e.mesh.bye(n),s(n)},o.onerror=function(t){s(n)},o.onopen=function(){e.mesh.hi(n)},o.onmessage=function(t){t&&e.mesh.hear(t.data||t,n)},o}catch(t){}}function s(n){clearTimeout(n.defer),a&&n.retry<=0||(n.retry=(n.retry||e.retry||60)-1,n.defer=setTimeout(function t(){if(a&&a.hidden)return setTimeout(t,r);u(n)},r))}})})($,"./adapters/websocket")}();
\ No newline at end of file
diff --git a/lib/multicast.js b/lib/multicast.js
index bcfd2185..75ebb9a0 100644
--- a/lib/multicast.js
+++ b/lib/multicast.js
@@ -22,7 +22,7 @@ Gun.on('create', function(root){
socket.bind(udp.port);
socket.on("listening", function(){
- socket.addMembership(udp.address);
+ try { socket.addMembership(udp.address) }catch(e){ return }
udp.peer = {id: udp.address + ':' + udp.port, wire: socket};
udp.peer.say = function(raw){
diff --git a/lib/radisk.js b/lib/radisk.js
index 2e0b6a24..5f6a5f09 100644
--- a/lib/radisk.js
+++ b/lib/radisk.js
@@ -14,12 +14,12 @@
opt.chunk = opt.chunk || (1024 * 1024 * 10); // 10MB
opt.code = opt.code || {};
opt.code.from = opt.code.from || '!';
- //opt.jsonify = true; // TODO: REMOVE!!!!
+ //opt.jsonify = true; if(opt.jsonify){ console.log("JSON RAD!!!") } // TODO: REMOVE!!!!
function ename(t){ return encodeURIComponent(t).replace(/\*/g, '%2A') }
function atomic(v){ return u !== v && (!v || 'object' != typeof v) }
var map = Gun.obj.map;
- var LOG = false;
+ var LOG = false;//true;
if(!opt.store){
return opt.log("ERROR: Radisk needs `opt.store` interface with `{get: fn, put: fn (, list: fn)}`!");
@@ -83,12 +83,13 @@
r.batch = Radix();
r.batch.acks = [];
r.batch.ed = 0;
- //var id = Gun.text.random(2), S = (+new Date); console.log("<<<<<<<<<<<<", id);
+ //console.debug(99); var ID = Gun.text.random(2), S = (+new Date); console.log("[[[[[[[[", ID, batch.acks.length);
r.save(batch, function(err, ok){
if(++i > 1){ opt.log('RAD ERR: Radisk has callbacked multiple times, please report this as a BUG at github.com/amark/gun/issues ! ' + i); return }
if(err){ opt.log('err', err) }
- //console.log(">>>>>>>>>>>>", id, ((+new Date) - S), batch.acks.length);
+ //console.debug(99); var TMP; console.log("]]]]]]]]", ID, batch.acks.length, (TMP = +new Date) - S, 'more?', thrash.more);
map(batch.acks, function(cb){ cb(err, ok) });
+ //console.log("][", +new Date - TMP, thrash.more);
thrash.at = null;
thrash.ing = false;
if(thrash.more){ thrash() }
@@ -171,9 +172,9 @@
}
f.write = function(){
var tmp = ename(file);
- var start; LOG && (start = (+new Date)); // comment this out!
+ var start; LOG && (start = +new Date); // comment this out!
opt.store.put(tmp, f.text, function(err){
- LOG && console.log("wrote JSON in", (+new Date) - start); // comment this out!
+ LOG && console.log("wrote to disk in", (+new Date) - start, tmp); // comment this out!
if(err){ return cb(err) }
r.list.add(tmp, cb);
});
@@ -202,10 +203,10 @@
r.write.jsonify = function(f, file, rad, cb, o){
var raw;
- var start; LOG && (start = (+new Date)); // comment this out!
+ var start; LOG && (start = +new Date); // comment this out!
try{raw = JSON.stringify(rad.$);
}catch(e){ return cb("Record too big!") }
- LOG && console.log("stringified JSON in", (+new Date) - start); // comment this out!
+ LOG && console.log("stringified JSON in", +new Date - start); // comment this out!
if(opt.chunk < raw.length && !o.force){
if(Radix.map(rad, f.each, true)){ return }
}
@@ -220,7 +221,7 @@
var sub = Radix();
Radix.map(tree, function(v,k){
sub(k,v);
- }, o)
+ }, o);
return sub('');
}
@@ -266,7 +267,7 @@
}
g.ack = function(as){
if(!as.ack){ return }
- var tmp = as.key, o = as.opt, info = g.info, rad = g.disk || noop, data = r.range(rad(tmp), o), last = rad.last;
+ var tmp = as.key, o = as.opt, info = g.info, rad = g.disk || noop, data = r.range(rad(tmp), o), last = rad.last || Radix.map(rad, rev, revo);
o.parsed = (o.parsed || 0) + (info.parsed||0);
o.chunks = (o.chunks || 0) + 1;
if(!o.some){ o.some = (u !== data) }
@@ -283,6 +284,8 @@
if(o.reverse){ g.lex.reverse = true }
r.list(g.lex);
}
+ function rev(a,b){ return b }
+ var revo = {reverse: true};
}());
;(function(){
@@ -299,6 +302,7 @@
var p = function Parse(){}, info = {};
p.disk = Radix();
p.read = function(err, data){ var tmp;
+ LOG && console.log('read disk in', +new Date - start, ename(file)); // keep this commented out in
delete Q[file];
if((p.err = err) || (p.not = !data)){
return map(q, p.ack);
@@ -315,12 +319,12 @@
}
info.parsed = data.length;
- var start; LOG && (start = (+new Date)); // keep this commented out in production!
+ LOG && (start = +new Date); // keep this commented out in production!
if(opt.jsonify){ // temporary testing idea
try{
var json = JSON.parse(data);
p.disk.$ = json;
- LOG && console.log('parsed JSON in', (+new Date) - start); // keep this commented out in production!
+ LOG && console.log('parsed JSON in', +new Date - start); // keep this commented out in production!
map(q, p.ack);
return;
}catch(e){ tmp = e }
@@ -329,7 +333,7 @@
return map(q, p.ack);
}
}
- var start; LOG && (start = (+new Date)); // keep this commented out in production!
+ LOG && (start = +new Date); // keep this commented out in production!
var tmp = p.split(data), pre = [], i, k, v;
if(!tmp || 0 !== tmp[1]){
p.err = "File '"+file+"' does not have root radix! ";
@@ -352,7 +356,7 @@
if(u !== k && u !== v){ p.disk(pre.join(''), v) }
tmp = p.split(tmp[2]);
}
- LOG && console.log('parsed JSON in', (+new Date) - start); // keep this commented out in production!
+ LOG && console.log('parsed RAD in', +new Date - start); // keep this commented out in production!
//cb(err, p.disk);
map(q, p.ack);
};
@@ -372,6 +376,7 @@
if(p.err || p.not){ return cb(p.err, u, info) }
cb(u, p.disk, info);
}
+ var start; LOG && (start = +new Date); // keep this commented out in production!
if(raw){ return p.read(null, raw) }
opt.store.get(ename(file), p.read);
}
@@ -504,6 +509,7 @@
} else {
var Gun = require('../gun');
var Radix = require('./radix');
+ //var Radix = require('./radix2'); Radisk = require('./radisk2');
try{ module.exports = Radisk }catch(e){}
}
diff --git a/lib/radisk2.js b/lib/radisk2.js
index 0858d376..87fc7be0 100644
--- a/lib/radisk2.js
+++ b/lib/radisk2.js
@@ -1,4 +1,5 @@
;(function(){
+ console.log("RADISK 2!!!!");
function Radisk(opt){
@@ -515,7 +516,7 @@
window.Radisk = Radisk;
} else {
var Gun = require('../gun');
- var Radix = require('./radix');
+ var Radix = require('./radix2');
try{ module.exports = Radisk }catch(e){}
}
diff --git a/lib/radix.js b/lib/radix.js
index 8a5b59a0..e4533f32 100644
--- a/lib/radix.js
+++ b/lib/radix.js
@@ -54,10 +54,10 @@
Radix.map = function map(radix, cb, opt, pre){ pre = pre || [];
var t = ('function' == typeof radix)? radix.$ || {} : radix;
if(!t){ return }
- var keys = (t[_]||no).sort || (t[_] = function $(){ $.sort = Object.keys(t).sort(); return $ }()).sort;
+ var keys = (t[_]||no).sort || (t[_] = function $(){ $.sort = Object.keys(t).sort(); return $ }()).sort, rev;
//var keys = Object.keys(t).sort();
opt = (true === opt)? {branch: true} : (opt || {});
- if(opt.reverse){ keys = keys.slice().reverse() }
+ if(rev = opt.reverse){ keys = keys.slice().reverse() }
var start = opt.start, end = opt.end;
var i = 0, l = keys.length;
for(;i < l; i++){ var key = keys[i], tree = t[key], tmp, p, pt;
@@ -66,6 +66,10 @@
pt = p.join('');
if(u !== start && pt < (start||'').slice(0,pt.length)){ continue }
if(u !== end && (end || '\uffff') < pt){ continue }
+ if(rev){ // children must be checked first when going in reverse.
+ tmp = map(tree, cb, opt, p);
+ if(u !== tmp){ return tmp }
+ }
if(u !== (tmp = tree[''])){
tmp = cb(tmp, pt, key, pre);
if(u !== tmp){ return tmp }
@@ -75,8 +79,10 @@
if(u !== tmp){ return tmp }
}
pre = p;
- tmp = map(tree, cb, opt, pre);
- if(u !== tmp){ return tmp }
+ if(!rev){
+ tmp = map(tree, cb, opt, pre);
+ if(u !== tmp){ return tmp }
+ }
pre.pop();
}
};
diff --git a/lib/stats.js b/lib/stats.js
index 2e7a943a..5039f05d 100644
--- a/lib/stats.js
+++ b/lib/stats.js
@@ -41,9 +41,10 @@ Gun.on('opt', function(root){
stats.node.count = Object.keys(root.graph||{}).length;
var dam = root.opt.mesh;
if(dam){
- stats.dam = {'in': {count: dam.hear.c, done: dam.hear.d}, 'out': {count: dam.say.c, done: dam.say.d}};
+ stats.dam = {'in': {count: dam.hear.c, done: dam.hear.d, long: dam.hear.long}, 'out': {count: dam.say.c, done: dam.say.d}};
dam.hear.c = dam.hear.d = dam.say.c = dam.say.d = 0; // reset
stats.peers.time = dam.bye.time || 0;
+ dam.hear.long = [];
}
var rad = root.opt.store; rad = rad && rad.stats;
if(rad){
diff --git a/lib/store.js b/lib/store.js
index c58aa256..56c4dcda 100644
--- a/lib/store.js
+++ b/lib/store.js
@@ -67,14 +67,12 @@ Gun.on('create', function(root){
o.limit = (tmp <= (o.pack || (1000 * 100)))? tmp : 1;
}
if(has['-'] || (soul||{})['-']){ o.reverse = true }
- //console.log("RAD get:", key, o);
var start = (+new Date); // STATS! // console.log("GET!", id, JSON.stringify(key));
rad(key||'', function(err, data, o){
try{opt.store.stats.get.time[statg % 50] = (+new Date) - start; ++statg;
opt.store.stats.get.count++;
if(err){ opt.store.stats.get.err = err }
}catch(e){} // STATS!
- //console.log("RAD gat:", err, data, o);
if(data){
if(typeof data !== 'string'){
if(o.atom){
@@ -85,7 +83,6 @@ Gun.on('create', function(root){
}
if(!graph && data){ each(data, '') }
}
- //console.log("GOT!", id, JSON.stringify(key), ((+new Date) - start));
root.on('in', {'@': id, put: graph, err: err? err : u, rad: Radix});
}, o);
function each(val, has, a,b){
diff --git a/package-lock.json b/package-lock.json
index fa4e2009..9ec96bb0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "gun",
- "version": "1.0.0-beta.8",
+ "version": "0.2019.910",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -74,6 +74,36 @@
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=",
"dev": true
},
+ "ansi-colors": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz",
+ "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
"arraybuffer.slice": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz",
@@ -244,10 +274,64 @@
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=",
"dev": true
},
- "commander": {
- "version": "2.15.1",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
- "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
+ "camelcase": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "cliui": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
+ "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^2.1.1",
+ "strip-ansi": "^4.0.0",
+ "wrap-ansi": "^2.0.0"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"compare-versions": {
@@ -286,6 +370,43 @@
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=",
"dev": true
},
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
+ "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
+ "dev": true,
+ "requires": {
+ "object-keys": "^1.0.12"
+ }
+ },
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
@@ -319,6 +440,21 @@
"text-encoding": "^0.7.0"
}
},
+ "emoji-regex": {
+ "version": "7.0.3",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
+ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
+ "dev": true
+ },
+ "end-of-stream": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
+ "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
"engine.io": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.5.tgz",
@@ -443,12 +579,47 @@
"wtf-8": "1.0.0"
}
},
+ "es-abstract": {
+ "version": "1.14.2",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz",
+ "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "^1.2.0",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.0",
+ "is-callable": "^1.1.4",
+ "is-regex": "^1.0.4",
+ "object-inspect": "^1.6.0",
+ "object-keys": "^1.1.1",
+ "string.prototype.trimleft": "^2.0.0",
+ "string.prototype.trimright": "^2.0.0"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz",
+ "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.4",
+ "is-date-object": "^1.0.1",
+ "is-symbol": "^1.0.2"
+ }
+ },
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
+ "dev": true
+ },
"events": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
@@ -470,10 +641,31 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "get-stream": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+ "dev": true,
+ "requires": {
+ "pump": "^3.0.0"
+ }
+ },
"glob": {
- "version": "7.1.2",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
- "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
+ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -490,6 +682,15 @@
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
"dev": true
},
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
"has-binary": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz",
@@ -519,10 +720,16 @@
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
+ "has-symbols": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
+ "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=",
+ "dev": true
+ },
"he": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
- "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true
},
"ieee754": {
@@ -547,9 +754,15 @@
}
},
"inherits": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
- "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "invert-kv": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
+ "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
"dev": true
},
"invariant": {
@@ -567,12 +780,60 @@
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
"dev": true
},
+ "is-buffer": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
+ "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==",
+ "dev": true
+ },
+ "is-callable": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
+ "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==",
+ "dev": true
+ },
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
"is-promise": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
"dev": true
},
+ "is-regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.1"
+ }
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true
+ },
+ "is-symbol": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz",
+ "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==",
+ "dev": true,
+ "requires": {
+ "has-symbols": "^1.0.0"
+ }
+ },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@@ -615,6 +876,25 @@
"integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=",
"dev": true
},
+ "lcid": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
+ "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
+ "dev": true,
+ "requires": {
+ "invert-kv": "^2.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+ "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^3.0.0",
+ "path-exists": "^3.0.0"
+ }
+ },
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
@@ -629,6 +909,35 @@
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
+ "log-symbols": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
+ "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.0.1"
+ }
+ },
+ "map-age-cleaner": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
+ "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
+ "dev": true,
+ "requires": {
+ "p-defer": "^1.0.0"
+ }
+ },
+ "mem": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
+ "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
+ "dev": true,
+ "requires": {
+ "map-age-cleaner": "^0.1.1",
+ "mimic-fn": "^2.0.0",
+ "p-is-promise": "^2.0.0"
+ }
+ },
"mime-db": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
@@ -644,6 +953,12 @@
"mime-db": "~1.33.0"
}
},
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+ "dev": true
+ },
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@@ -669,39 +984,40 @@
}
},
"mocha": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz",
- "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==",
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz",
+ "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==",
"dev": true,
"requires": {
+ "ansi-colors": "3.2.3",
"browser-stdout": "1.3.1",
- "commander": "2.15.1",
- "debug": "3.1.0",
+ "debug": "3.2.6",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
- "glob": "7.1.2",
+ "find-up": "3.0.0",
+ "glob": "7.1.3",
"growl": "1.10.5",
- "he": "1.1.1",
+ "he": "1.2.0",
+ "js-yaml": "3.13.1",
+ "log-symbols": "2.2.0",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
- "supports-color": "5.4.0"
- },
- "dependencies": {
- "debug": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
- "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
- "dev": true,
- "requires": {
- "ms": "2.0.0"
- }
- }
+ "ms": "2.1.1",
+ "node-environment-flags": "1.0.5",
+ "object.assign": "4.1.0",
+ "strip-json-comments": "2.0.1",
+ "supports-color": "6.0.0",
+ "which": "1.3.1",
+ "wide-align": "1.1.3",
+ "yargs": "13.2.2",
+ "yargs-parser": "13.0.0",
+ "yargs-unparser": "1.5.0"
}
},
"ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true
},
"msrcrypto": {
@@ -728,6 +1044,40 @@
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=",
"dev": true
},
+ "object-inspect": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz",
+ "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true
+ },
+ "object.assign": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
+ "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "function-bind": "^1.1.1",
+ "has-symbols": "^1.0.0",
+ "object-keys": "^1.0.11"
+ }
+ },
+ "object.getownpropertydescriptors": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
+ "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "es-abstract": "^1.5.1"
+ }
+ },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -743,6 +1093,59 @@
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=",
"dev": true
},
+ "os-locale": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
+ "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
+ "dev": true,
+ "requires": {
+ "execa": "^1.0.0",
+ "lcid": "^2.0.0",
+ "mem": "^4.0.0"
+ }
+ },
+ "p-defer": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
+ "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
+ "dev": true
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true
+ },
+ "p-is-promise": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
+ "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
+ "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
+ "dev": true,
+ "requires": {
+ "p-try": "^2.0.0"
+ }
+ },
+ "p-locate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+ "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^2.0.0"
+ }
+ },
+ "p-try": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
+ "dev": true
+ },
"panic-client": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/panic-client/-/panic-client-1.0.2.tgz",
@@ -813,12 +1216,24 @@
"better-assert": "~1.0.0"
}
},
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ },
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "dev": true
+ },
"platform": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.1.tgz",
@@ -897,6 +1312,39 @@
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=",
"dev": true
},
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true
+ },
"socket.io": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.4.tgz",
@@ -1046,9 +1494,9 @@
"optional": true
},
"supports-color": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
- "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz",
+ "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@@ -1163,6 +1611,130 @@
"integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=",
"dev": true
},
+ "y18n": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
+ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "13.2.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz",
+ "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==",
+ "dev": true,
+ "requires": {
+ "cliui": "^4.0.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^2.0.1",
+ "os-locale": "^3.1.0",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^2.0.0",
+ "set-blocking": "^2.0.0",
+ "string-width": "^3.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^4.0.0",
+ "yargs-parser": "^13.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^7.0.1",
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
+ "yargs-parser": {
+ "version": "13.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz",
+ "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ },
+ "yargs-unparser": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz",
+ "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==",
+ "dev": true,
+ "requires": {
+ "flat": "^4.1.0",
+ "lodash": "^4.17.11",
+ "yargs": "^12.0.5"
+ },
+ "dependencies": {
+ "get-caller-file": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
+ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
+ "dev": true
+ },
+ "lodash": {
+ "version": "4.17.15",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
+ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
+ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
+ "dev": true
+ },
+ "yargs": {
+ "version": "12.0.5",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz",
+ "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^4.0.0",
+ "decamelize": "^1.2.0",
+ "find-up": "^3.0.0",
+ "get-caller-file": "^1.0.1",
+ "os-locale": "^3.0.0",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^1.0.1",
+ "set-blocking": "^2.0.0",
+ "string-width": "^2.0.0",
+ "which-module": "^2.0.0",
+ "y18n": "^3.2.1 || ^4.0.0",
+ "yargs-parser": "^11.1.1"
+ }
+ },
+ "yargs-parser": {
+ "version": "11.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
+ "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ }
+ }
+ },
"yeast": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
diff --git a/package.json b/package.json
index a4eab2f9..335ccc7c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gun",
- "version": "1.0.0-beta.8",
+ "version": "0.2019.915",
"description": "A realtime, decentralized, offline-first, graph data synchronization engine.",
"main": "index.js",
"browser": "browser.js",
@@ -57,14 +57,12 @@
"optionalDependencies": {
"text-encoding": "^0.7.0",
"isomorphic-webcrypto": "^2.3.2",
- "atob": "^2.1.2",
- "btoa": "^1.2.1",
"emailjs": "^2.2.0"
},
"devDependencies": {
"aws-sdk": "^2.528.0",
"ip": "^1.1.5",
- "mocha": "^5.2.0",
+ "mocha": "^6.2.0",
"panic-manager": "^1.2.0",
"panic-server": "^1.1.1",
"uglify-js": "^3.6.0"
diff --git a/sea.js b/sea.js
index b5db61ac..d8d3dace 100644
--- a/sea.js
+++ b/sea.js
@@ -54,6 +54,15 @@
})(USE, './https');
;USE(function(module){
+ if(typeof global !== "undefined"){
+ var g = global;
+ g.btoa = function (data) { return Buffer.from(data, "binary").toString("base64"); };
+ g.atob = function (data) { return Buffer.from(data, "base64").toString("binary"); };
+ }
+ })(USE, './base64');
+
+ ;USE(function(module){
+ USE('./base64');
// This is Array extended to have .toString(['utf8'|'hex'|'base64'])
function SeaArray() {}
Object.assign(SeaArray, { from: Array.from })
@@ -79,6 +88,7 @@
})(USE, './array');
;USE(function(module){
+ USE('./base64');
// This is Buffer implementation used in SEA. Functionality is mostly
// compatible with NodeJS 'safe-buffer' and is used for encoding conversions
// between binary and 'hex' | 'utf8' | 'base64'
@@ -614,7 +624,7 @@
var epriv = pair.epriv;
var ecdhSubtle = shim.ossl || shim.subtle;
var pubKeyData = keysToEcdhJwk(pub);
- var props = Object.assign(S.ecdh, { public: await ecdhSubtle.importKey(...pubKeyData, true, []) });
+ var props = Object.assign({ public: await ecdhSubtle.importKey(...pubKeyData, true, []) },S.ecdh); // Thanks to @sirpy !
var privKeyData = keysToEcdhJwk(epub, epriv);
var derived = await ecdhSubtle.importKey(...privKeyData, false, ['deriveBits']).then(async (privKey) => {
// privateKey scope doesn't leak out from here!
diff --git a/sea/array.js b/sea/array.js
index fecdde5d..e6fa5765 100644
--- a/sea/array.js
+++ b/sea/array.js
@@ -1,4 +1,5 @@
+ require('./base64');
// This is Array extended to have .toString(['utf8'|'hex'|'base64'])
function SeaArray() {}
Object.assign(SeaArray, { from: Array.from })
diff --git a/sea/base64.js b/sea/base64.js
new file mode 100644
index 00000000..5a87f29e
--- /dev/null
+++ b/sea/base64.js
@@ -0,0 +1,7 @@
+
+ if(typeof global !== "undefined"){
+ var g = global;
+ g.btoa = function (data) { return Buffer.from(data, "binary").toString("base64"); };
+ g.atob = function (data) { return Buffer.from(data, "base64").toString("binary"); };
+ }
+
\ No newline at end of file
diff --git a/sea/buffer.js b/sea/buffer.js
index 1854bd1c..77915f1e 100644
--- a/sea/buffer.js
+++ b/sea/buffer.js
@@ -1,4 +1,5 @@
+ require('./base64');
// This is Buffer implementation used in SEA. Functionality is mostly
// compatible with NodeJS 'safe-buffer' and is used for encoding conversions
// between binary and 'hex' | 'utf8' | 'base64'
diff --git a/sea/secret.js b/sea/secret.js
index 4009ee31..4a1c63ac 100644
--- a/sea/secret.js
+++ b/sea/secret.js
@@ -13,7 +13,7 @@
var epriv = pair.epriv;
var ecdhSubtle = shim.ossl || shim.subtle;
var pubKeyData = keysToEcdhJwk(pub);
- var props = Object.assign(S.ecdh, { public: await ecdhSubtle.importKey(...pubKeyData, true, []) });
+ var props = Object.assign({ public: await ecdhSubtle.importKey(...pubKeyData, true, []) },S.ecdh); // Thanks to @sirpy !
var privKeyData = keysToEcdhJwk(epub, epriv);
var derived = await ecdhSubtle.importKey(...privKeyData, false, ['deriveKey']).then(async (privKey) => {
// privateKey scope doesn't leak out from here!
diff --git a/src/adapters/localStorage.js b/src/adapters/localStorage.js
index 5cf6b718..1d0e60cf 100644
--- a/src/adapters/localStorage.js
+++ b/src/adapters/localStorage.js
@@ -17,7 +17,7 @@ Gun.on('create', function(root){
// See the next 'opt' code below for actual saving of data.
var ev = this.to, opt = root.opt;
if(root.once){ return ev.next(root) }
- //if(false === opt.localStorage){ return ev.next(root) } // we want offline resynce queue regardless!
+ if(false === opt.localStorage){ return ev.next(root) } // we want offline resynce queue regardless! // actually, this doesn't help, per @go1dfish 's observation. Disabling for now, will need better solution later.
opt.prefix = opt.file || 'gun/';
var gap = Gun.obj.ify(store.getItem('gap/'+opt.prefix)) || {};
var empty = Gun.obj.empty, id, to, go;
diff --git a/src/get.js b/src/get.js
index 3725896b..e29e62db 100644
--- a/src/get.js
+++ b/src/get.js
@@ -11,7 +11,7 @@ Gun.chain.get = function(key, cb, as){
gun = gun.$;
} else
if(key instanceof Function){
- if(true === cb){ return soul(this, key, cb, as) }
+ if(true === cb){ return soul(this, key, cb, as), this }
gun = this;
var at = gun._, root = at.root, tmp = root.now, ev;
as = cb || {};
@@ -68,15 +68,22 @@ function cache(key, back){
}
function soul(gun, cb, opt, as){
var cat = gun._, acks = 0, tmp;
- if(tmp = cat.soul || cat.link || cat.dub){ return cb(tmp, as, cat), gun }
- gun.get(function(msg, ev){
+ if(tmp = cat.soul || cat.link || cat.dub){ return cb(tmp, as, cat) }
+ if(cat.jam){ return cat.jam.push([cb, as]) }
+ cat.jam = [[cb,as]];
+ gun.get(function(msg, eve){
if(u === msg.put && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks < tmp){
return;
}
- ev.rid(msg);
+ eve.rid(msg);
var at = ((at = msg.$) && at._) || {};
- tmp = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put) || at.dub;
- cb(tmp, as, msg, ev);
+ tmp = cat.jam; Gun.obj.del(cat, 'jam');
+ Gun.obj.map(tmp, function(as, cb){
+ cb = as[0]; as = as[1];
+ if(!cb){ return }
+ var id = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put) || at.dub;
+ cb(id, as, msg, eve);
+ });
}, {out: {get: {'.':true}}});
return gun;
}
diff --git a/src/put.js b/src/put.js
index c4a759d4..b74ee08c 100644
--- a/src/put.js
+++ b/src/put.js
@@ -3,9 +3,9 @@ var Gun = require('./root');
Gun.chain.put = function(data, cb, as){
// #soul.has=value>state
// ~who#where.where=what>when@was
- // TODO: BUG! Put probably cannot handle plural chains!
+ // TODO: BUG! Put probably cannot handle plural chains! `!as` is quickfix test.
var gun = this, at = (gun._), root = at.root.$, ctx = root._, M = 100, tmp;
- if(!ctx.puta){ if(tmp = ctx.puts){ if(tmp > M){ // without this, when synchronous, writes to a 'not found' pile up, when 'not found' resolves it recursively calls `put` which incrementally resolves each write. Stack overflow limits can be as low as 10K, so this limit is hardcoded to 1% of 10K.
+ /*if(!ctx.puta && !as){ if(tmp = ctx.puts){ if(tmp > M){ // without this, when synchronous, writes to a 'not found' pile up, when 'not found' resolves it recursively calls `put` which incrementally resolves each write. Stack overflow limits can be as low as 10K, so this limit is hardcoded to 1% of 10K.
(ctx.stack || (ctx.stack = [])).push([gun, data, cb, as]);
if(ctx.puto){ return }
ctx.puto = setTimeout(function drain(){
@@ -15,7 +15,7 @@ Gun.chain.put = function(data, cb, as){
ctx.stack = ctx.puts = ctx.puto = null;
}, 0);
return gun;
- } ++ctx.puts } else { ctx.puts = 1 } }
+ } ++ctx.puts } else { ctx.puts = 1 } }*/
as = as || {};
as.data = data;
as.via = as.$ = as.via || as.$ || gun;
@@ -127,7 +127,6 @@ function batch(){ var as = this;
}, as);
if(as.res){ as.res() }
} function no(v,k){ if(v){ return true } }
-//console.debug(999,1); var C = 0; setInterval(function(){ try{ debug.innerHTML = C }catch(e){console.log(e)} }, 500);
function map(v,k,n, at){ var as = this;
var is = Gun.is(v);
@@ -139,6 +138,7 @@ function map(v,k,n, at){ var as = this;
ref = ref.get(path[i]);
}
if(is){ ref = v }
+ //if(as.not){ (ref._).dub = Gun.text.random() } // This might optimize stuff? Maybe not needed anymore. Make sure it doesn't introduce bugs.
var id = (ref._).dub;
if(id || (id = Gun.node.soul(at.obj))){
ref.back(-1).get(id);
@@ -157,7 +157,7 @@ function soul(id, as, msg, eve){
id = at.dub = at.dub || id || Gun.node.soul(cat.obj) || Gun.node.soul(msg.put || at.put) || Gun.val.link.is(msg.put || at.put) || (as.via.back('opt.uuid') || Gun.text.random)(); // TODO: BUG!? Do we really want the soul of the object given to us? Could that be dangerous?
if(eve){ eve.stun = true }
if(!id){ // polyfill async uuid for SEA
- at.via.back('opt.uuid')(function(err, id){ // TODO: improve perf without anonymous callback
+ as.via.back('opt.uuid')(function(err, id){ // TODO: improve perf without anonymous callback
if(err){ return Gun.log(err) } // TODO: Handle error.
solve(at, at.dub = at.dub || id, cat, as);
});
@@ -199,6 +199,7 @@ function any(soul, as, msg, eve){
if(at.link || at.soul){ return at.link || at.soul }
as.data = obj_put({}, at.get, as.data);
});
+ as.not = true; // maybe consider this?
}
tmp = tmp || at.soul || at.link || at.dub;// || at.get;
at = tmp? (at.root.$.get(tmp)._) : at;
diff --git a/src/root.js b/src/root.js
index dade874c..187a3bdc 100644
--- a/src/root.js
+++ b/src/root.js
@@ -153,6 +153,7 @@ Gun.dup = require('./dup');
Gun.on.get = function(msg, gun){
var root = gun._, get = msg.get, soul = get[_soul], node = root.graph[soul], has = get[_has], tmp;
var next = root.next || (root.next = {}), at = next[soul];
+ // queue concurrent GETs?
if(!node){ return root.on('get', msg) }
if(has){
if('string' != typeof has || !obj_has(node, has)){ return root.on('get', msg) }
@@ -193,6 +194,7 @@ Gun.dup = require('./dup');
at.opt.peers = at.opt.peers || {};
obj_map(opt, function each(v,k){
if(!obj_has(this, k) || text.is(v) || obj.empty(v)){ this[k] = v ; return }
+ if(v && v.constructor !== Object && !list_is(v)){ return }
obj_map(v, each, this[k]);
}, at.opt);
Gun.on('opt', at);
@@ -207,7 +209,7 @@ var obj = Gun.obj, obj_is = obj.is, obj_has = obj.has, obj_to = obj.to, obj_map
var state_lex = Gun.state.lex, _soul = Gun.val.link._, _has = '.', node_ = Gun.node._, rel_is = Gun.val.link.is;
var empty = {}, u;
-console.debug = function(i, s){ return (console.debug.i && i === console.debug.i && console.debug.i++) && (console.log.apply(console, arguments) || s) };
+console.only = function(i, s){ return (console.only.i && i === console.only.i && console.only.i++) && (console.log.apply(console, arguments) || s) };
Gun.log = function(){ return (!Gun.log.off && console.log.apply(console, arguments)), [].slice.call(arguments).join(' ') }
Gun.log.once = function(w,s,o){ return (o = Gun.log.once)[w] = o[w] || 0, o[w]++ || Gun.log(s) }
diff --git a/test/common.js b/test/common.js
index 0c2de5b8..8bf55968 100644
--- a/test/common.js
+++ b/test/common.js
@@ -3692,7 +3692,6 @@ describe('Gun', function(){
expect(gone[index]).to.not.be.ok();
gone[index] = diff;
largest = (largest < diff)? diff : largest;
- //console.log(diff, '<', max);
expect(diff > max).to.not.be.ok();
});
var turns = 0;
diff --git a/test/rad/rad.js b/test/rad/rad.js
index bd97283d..6d07686e 100644
--- a/test/rad/rad.js
+++ b/test/rad/rad.js
@@ -113,15 +113,22 @@ var names = ["Adalard","Adora","Aia","Albertina","Alfie","Allyn","Amabil","Ammam
it('radix reverse', function(done){
var r = Radix(), tmp;
- r('alice', 1);r('bob', 2);r('carl', 3);r('dave', 4);
+ r('alice', 1);r('bob', 2);r('carl', 3);r('carlo',4);
+ r('dave', 5);r('zach',6);r('zachary',7);
+ var by = ['alice','bob','carl','carlo','dave','zach','zachary'];
+ Gun.obj.map(by, function(k,i){
+ r(k,i);
+ });
Radix.map(r, function(v,k, a,b){
+ expect(by.pop()).to.be(k);
tmp = v;
}, {reverse: 1});
expect(tmp).to.be(1);
+ expect(by.length).to.be(0);
Radix.map(r, function(v,k, a,b){
tmp = v;
});
- expect(tmp).to.be(4);
+ expect(tmp).to.be(7);
done();
});
});