Comparing version 0.0.11-56a16229a5f5f7943db0ee0fcada5e37692fb0fc to 0.0.11-a77cea9de63088230954abee61135cb832057046
@@ -0,27 +1,33 @@ | ||
'use strict'; | ||
const $2563227135 = require('brisky-struct/dist/index.js') | ||
const $3040487635 = require('brisky-stamp/dist/index.js') | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var briskyStruct = require('brisky-struct'); | ||
var bs = _interopDefault(require('brisky-stamp')); | ||
var websocket = require('websocket'); | ||
var hash = _interopDefault(require('string-hash')); | ||
var ua = _interopDefault(require('vigour-ua')); | ||
var uws = _interopDefault(require('uws')); | ||
const $4125568599_next = typeof window === 'undefined' | ||
const next = typeof window === 'undefined' | ||
? process.nextTick | ||
: global.requestAnimationFrame | ||
: global.requestAnimationFrame; | ||
const $4125568599_serialize = (hub, t, struct, val, level) => { | ||
if (!struct.isHub || struct.key === 'clients' || (struct._p && struct._p.key === 'clients')) { | ||
const serialize = (hub, t, struct$$1, val, level) => { | ||
if (!struct$$1.isHub || struct$$1.key === 'clients' || (struct$$1._p && struct$$1._p.key === 'clients')) { | ||
return | ||
} | ||
const path = struct.path() // cached version (later) | ||
const len = path.length | ||
const path = struct$$1.path(); // cached version (later) | ||
const len = path.length; | ||
if (struct.val !== void 0 || val === null) { | ||
var s = t[0] || (t[0] = {}) | ||
if (struct$$1.val !== void 0 || val === null) { | ||
var s = t[0] || (t[0] = {}); | ||
for (let i = level; i < len; i++) { | ||
let t = s[path[i]] | ||
let t = s[path[i]]; | ||
if (!t) { | ||
s = s[path[i]] = {} | ||
s = s[path[i]] = {}; | ||
} else { | ||
s = t | ||
s = t; | ||
if (s.val === null) { return } | ||
@@ -31,3 +37,3 @@ } | ||
s.stamp = struct.stamp | ||
s.stamp = struct$$1.stamp; | ||
@@ -37,96 +43,85 @@ if (val === null) { | ||
if (key !== 'stamp') { | ||
delete s[key] | ||
delete s[key]; | ||
} | ||
} | ||
s.val = null | ||
} else if (struct.val && struct.val.inherits) { | ||
s.val = null; | ||
} else if (struct$$1.val && struct$$1.val.inherits) { | ||
// make a bit more secure... | ||
// if (!s.val) { | ||
s.val = struct.val.path() | ||
s.val.unshift('@', 'root') | ||
s.val = struct$$1.val.path(); | ||
s.val.unshift('@', 'root'); | ||
// if allrdy serialized stop it! | ||
$4125568599_serialize(hub, t, struct.val, val, level) | ||
serialize(hub, t, struct$$1.val, val, level); | ||
// } | ||
} else if (struct.val !== void 0) { | ||
s.val = struct.val | ||
} else if (struct$$1.val !== void 0) { | ||
s.val = struct$$1.val; | ||
} | ||
} | ||
} | ||
}; | ||
const $4125568599_meta = hub => { | ||
const meta = hub => { | ||
if (!hub.receiveOnly) { | ||
const store = $4125568599_inProgress(hub, $3040487635.inProgress ? $3040487635.on : $4125568599_next) | ||
if (!store[1]) store[1] = {} | ||
const store = inProgress(hub, bs.inProgress ? bs.on : next); | ||
if (!store[1]) store[1] = {}; | ||
if (hub.context) { | ||
if (hub.context.keys().length > 0) { | ||
store[1].context = hub.context.compute() ? hub.context.serialize() : false | ||
store[1].context = hub.context.compute() ? hub.context.serialize() : false; | ||
} else { | ||
store[1].context = hub.context.compute() || false | ||
store[1].context = hub.context.compute() || false; | ||
} | ||
} | ||
store[1].id = hub.client.key | ||
store[1].subscriptions = hub.upstreamSubscriptions | ||
store[1].id = hub.client.key; | ||
store[1].subscriptions = hub.upstreamSubscriptions; | ||
} | ||
} | ||
}; | ||
const $4125568599_send = (val, stamp, struct) => { | ||
const send = (val, stamp, struct$$1) => { | ||
// -1 means upsteam (floats for extra speed) | ||
let hub | ||
let p = struct | ||
let hub; | ||
let p = struct$$1; | ||
while (p) { | ||
if (p._url_ && !p._c) hub = p | ||
p = p.parent() // needs to walk over context (for multi server) | ||
if (p._url_ && !p._c) hub = p; | ||
p = p.parent(); // needs to walk over context (for multi server) | ||
} | ||
if (hub && !hub.receiveOnly) { | ||
if (struct === hub) { | ||
if (struct$$1 === hub) { | ||
if (val === null) { | ||
return | ||
} | ||
} else if (struct._p.key === 'clients') { | ||
if (struct.key !== hub.client.key) { | ||
} else if (struct$$1._p.key === 'clients') { | ||
if (struct$$1.key !== hub.client.key) { | ||
return | ||
} | ||
} | ||
$4125568599_serialize(hub, $4125568599_inProgress(hub, $3040487635.on), struct, val, hub.urlIndex) | ||
serialize(hub, inProgress(hub, bs.on), struct$$1, val, hub.urlIndex); | ||
} | ||
} | ||
}; | ||
const $4125568599_inProgress = (hub, tick) => { | ||
const inProgress = (hub, tick) => { | ||
if (!hub.inProgress) { | ||
hub.inProgress = [] | ||
hub.inProgress = []; | ||
tick(() => { | ||
if (hub.connected.compute() === true) { | ||
$4125568599_out(hub) | ||
out(hub); | ||
} else { | ||
hub.connected.once(true, () => $4125568599_out(hub)) | ||
hub.connected.once(true, () => out(hub)); | ||
} | ||
}) | ||
}); | ||
} | ||
return hub.inProgress | ||
} | ||
}; | ||
const $4125568599_out = t => { | ||
t.socket.send(JSON.stringify(t.inProgress)) | ||
t.inProgress = false | ||
} | ||
const out = t => { | ||
t.socket.send(JSON.stringify(t.inProgress)); | ||
t.inProgress = false; | ||
}; | ||
const $4125568599_export_meta = $4125568599_meta | ||
const $4125568599_export_send = $4125568599_send | ||
const $4125568599_$ALL$ = { | ||
meta: $4125568599_export_meta, | ||
send: $4125568599_export_send | ||
} | ||
const $4020852141 = require('websocket/index.js') | ||
// import WebSocket from 'uws' | ||
// export default WebSocket | ||
const $2878564687 = $4020852141.w3cwebsocket | ||
const $2711378567_isEmpty = t => { | ||
const isEmpty = t => { | ||
for (let i in t) { return false } | ||
return true | ||
} | ||
}; | ||
@@ -143,7 +138,7 @@ // function merge (a, b) { | ||
const $2711378567_parse = (struct, obj, key, root) => { | ||
const result = {} | ||
if (!root) { root = result } | ||
const parse$1 = (struct$$1, obj, key, root) => { | ||
const result = {}; | ||
if (!root) { root = result; } | ||
// need to be done before the rest of subs to sync correctly | ||
if (obj.type) result.type = $2711378567_parse(struct, obj.type, 'type') | ||
if (obj.type) result.type = parse$1(struct$$1, obj.type, 'type'); | ||
for (let i in obj) { | ||
@@ -160,16 +155,16 @@ if (i !== '_' && i !== 'type') { | ||
} else if (typeof obj[i] === 'function') { | ||
let val = obj[i].toString() | ||
let val = obj[i].toString(); | ||
if (!/^(function|\()/.test(val)) { | ||
if (/^.+=>/.test(val)) { | ||
if (!/^(\(){0, 1}.+(\)){0, 1} +=>/.test(val)) { | ||
val = val.replace(/^(.*?)( +=>)/, '($1)$2') | ||
val = val.replace(/^(.*?)( +=>)/, '($1)$2'); | ||
} | ||
if (!/^(.*?)+=> +{(.*?)}$/.test(val) && val.indexOf('return ') === -1) { | ||
val = val.replace(/^(.+=> *?)(.*?)/, '$1 { return $2') + ' }' | ||
val = val.replace(/^(.+=> *?)(.*?)/, '$1 { return $2') + ' }'; | ||
} | ||
val = val.replace('=>', '') | ||
val = val.replace('=>', ''); | ||
} | ||
val = 'function ' + val | ||
val = 'function ' + val; | ||
} | ||
result['$fn|' + i] = val | ||
result['$fn|' + i] = val; | ||
// also here we need to rewrite client to use client id | ||
@@ -181,7 +176,7 @@ } else if (typeof obj[i] !== 'object') { | ||
// } else { | ||
result[i] = obj[i] | ||
result[i] = obj[i]; | ||
// } | ||
} else { | ||
// empty objects are very uninteresetting maybe just skip them | ||
let parsed = $2711378567_parse(struct, obj[i], i, root) | ||
let parsed = parse$1(struct$$1, obj[i], i, root); | ||
@@ -196,3 +191,3 @@ // if (i === 'root' || i === 'parent') { | ||
if (parsed !== void 0) { result[i] = parsed } | ||
if (parsed !== void 0) { result[i] = parsed; } | ||
} | ||
@@ -202,56 +197,39 @@ } | ||
// if result is empty ignore -- may not be a good idea | ||
return $2711378567_isEmpty(result) ? void 0 : result | ||
} | ||
return isEmpty(result) ? void 0 : result | ||
}; | ||
// can be one less fn... | ||
const $2711378567 = $2711378567_parse | ||
const uniq = process.pid; | ||
var uid = () => hash(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${uniq}`); | ||
const $257117234 = require('string-hash/index.js') | ||
const $1190737809 = require('vigour-ua/index.js') | ||
const $1123050690_uniq = process.pid | ||
const $1123050690 = () => $257117234(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`) | ||
const $3376394415 = (t, val, stamp, useragent, id) => { | ||
if (!id) id = t._uid_ || $1123050690() | ||
$1190737809(useragent, val) | ||
t.set({ clients: { [id]: val } }, stamp) | ||
var createClient = (t, val, stamp, useragent, id) => { | ||
if (!id) id = t._uid_ || uid(); | ||
ua(useragent, val); | ||
t.set({ clients: { [id]: val } }, stamp); | ||
return t.clients[id] | ||
} | ||
}; | ||
const $48594293_connect = (hub, url, reconnect) => { | ||
const socket = new $2878564687(url) | ||
const connect = (hub, url, reconnect) => { | ||
const socket = new websocket.w3cwebsocket(url); | ||
// t, val, stamp, useragent, id | ||
const client = hub.client || $3376394415(hub, {}, false) | ||
const client = hub.client || createClient(hub, {}, false); | ||
hub.set({ client }, false) | ||
hub.set({ client }, false); | ||
hub.reconnect = null | ||
hub.reconnect = null; | ||
const close = () => { | ||
const stamp = $3040487635.create() | ||
hub.socket = false | ||
hub.set({ connected: false }, stamp) | ||
$3040487635.close() | ||
const stamp = bs.create(); | ||
hub.socket = false; | ||
hub.set({ connected: false }, stamp); | ||
bs.close(); | ||
if (!socket.blockReconnect && hub._url_) { | ||
reconnect = Math.min((reconnect * 1.5), 2000) | ||
hub.reconnect = setTimeout($48594293_connect, reconnect, hub, url, reconnect) | ||
reconnect = Math.min((reconnect * 1.5), 2000); | ||
hub.reconnect = setTimeout(connect, reconnect, hub, url, reconnect); | ||
} | ||
} | ||
}; | ||
socket.onclose = close | ||
socket.onclose = close; | ||
if (typeof window === 'undefined') { | ||
socket.hackyOnClose = close | ||
socket.hackyOnClose = close; | ||
} | ||
@@ -261,82 +239,82 @@ | ||
? close | ||
: () => socket.close() | ||
: () => socket.close(); | ||
socket.onopen = () => { | ||
const stamp = $3040487635.create() | ||
hub.socket = socket | ||
$4125568599_export_meta(hub) | ||
hub.set({ connected: true }, stamp) | ||
$3040487635.close() | ||
} | ||
const stamp = bs.create(); | ||
hub.socket = socket; | ||
meta(hub); | ||
hub.set({ connected: true }, stamp); | ||
bs.close(); | ||
}; | ||
socket.onmessage = (data) => { | ||
data = data.data | ||
data = data.data; | ||
// console.warn('INCOMING\n', JSON.parse(data)) | ||
if (!hub.receiveOnly) { | ||
hub.receiveOnly = true | ||
hub.set(JSON.parse(data), false) | ||
hub.receiveOnly = null | ||
hub.receiveOnly = true; | ||
hub.set(JSON.parse(data), false); | ||
hub.receiveOnly = null; | ||
} else { | ||
hub.set(JSON.parse(data), false) | ||
hub.set(JSON.parse(data), false); | ||
} | ||
$3040487635.close() | ||
} | ||
} | ||
bs.close(); | ||
}; | ||
}; | ||
const $48594293_removeUrl = hub => { | ||
hub.url = hub._url_ = hub.urlIndex = null | ||
hub.emitters.set({ data: { url$: null } }, false) | ||
} | ||
const removeUrl = hub => { | ||
hub.url = hub._url_ = hub.urlIndex = null; | ||
hub.emitters.set({ data: { url$: null } }, false); | ||
}; | ||
const $48594293_removeSocket = hub => { | ||
const removeSocket = hub => { | ||
if (hub.reconnect) { | ||
clearTimeout(hub.reconnect) | ||
hub.reconnect = null | ||
clearTimeout(hub.reconnect); | ||
hub.reconnect = null; | ||
} | ||
if (hub.socket) { | ||
hub.socket.blockReconnect = true | ||
console.log('GO GO GOREMOVE', hub.socket._readyState) | ||
hub.socket.blockReconnect = true; | ||
console.log('GO GO GOREMOVE', hub.socket._readyState); | ||
if (hub.connected.compute() === false || !hub.socket._readyState) { | ||
console.log('hacky!') | ||
hub.socket.hackyOnClose() | ||
console.log('hacky!'); | ||
hub.socket.hackyOnClose(); | ||
} else { | ||
hub.socket.close() | ||
hub.socket.close(); | ||
} | ||
} | ||
// hub.socket = false | ||
} | ||
}; | ||
const $48594293_url = (hub, val, key, stamp) => { | ||
const url = (hub, val, key, stamp) => { | ||
hub.on((val, stamp, t) => { | ||
if (val === null && !t._c && t === hub) { | ||
hub.subscriptions = [] | ||
$48594293_removeUrl(hub) | ||
$48594293_removeSocket(hub) | ||
hub.subscriptions = []; | ||
removeUrl(hub); | ||
removeSocket(hub); | ||
} | ||
}, 'url$') | ||
}, 'url$'); | ||
if (!val) val = null | ||
if (!val) val = null; | ||
if ((!hub.url && val) || (hub.url.compute() !== val)) { | ||
$48594293_removeSocket(hub) | ||
removeSocket(hub); | ||
if (!val) { | ||
hub.set({ connected: false }, stamp) | ||
hub._url_ = null | ||
if (hub.url) hub.url.set(null, stamp) | ||
hub.set({ connected: false }, stamp); | ||
hub._url_ = null; | ||
if (hub.url) hub.url.set(null, stamp); | ||
} else { | ||
if (!hub.url) { | ||
$2563227135.create({ | ||
briskyStruct.create({ | ||
on: { | ||
data: { | ||
url: (val, stamp, struct) => { | ||
val = struct.compute() | ||
url: (val, stamp, struct$$1) => { | ||
val = struct$$1.compute(); | ||
if (val) { | ||
hub.set({ connected: false }, stamp) | ||
let i = -1 | ||
if (hub.key) i++ | ||
hub.parent(() => { i++ }) | ||
hub.urlIndex = i // use this for checks | ||
hub._url_ = val | ||
$48594293_connect(hub, val, 50) | ||
hub.set({ connected: false }, stamp); | ||
let i = -1; | ||
if (hub.key) i++; | ||
hub.parent(() => { i++; }); | ||
hub.urlIndex = i; // use this for checks | ||
hub._url_ = val; | ||
connect(hub, val, 50); | ||
} else { | ||
hub._url_ = null | ||
hub._url_ = null; | ||
} | ||
@@ -346,11 +324,11 @@ } | ||
} | ||
}, stamp, $2563227135.struct, hub, key) | ||
}, stamp, briskyStruct.struct, hub, key); | ||
} | ||
hub.url.set(val, stamp) | ||
hub.url.set(val, stamp); | ||
} | ||
} | ||
} | ||
}; | ||
const $48594293_removeClients = (hub, stamp) => { | ||
const clients = hub.clients | ||
const removeClients = (hub, stamp) => { | ||
const clients = hub.clients; | ||
if (clients && clients.keys().length > 1) { | ||
@@ -362,10 +340,10 @@ clients.forEach((client, key) => { | ||
) { | ||
client.set(null, stamp) | ||
delete clients[key] | ||
client.set(null, stamp); | ||
delete clients[key]; | ||
} | ||
}) | ||
}); | ||
} | ||
} | ||
}; | ||
const $48594293_connected = { | ||
const connected = { | ||
type: 'struct', | ||
@@ -377,3 +355,3 @@ on: { | ||
// all instances! -- fix this | ||
$48594293_removeClients(t._p, stamp) | ||
removeClients(t._p, stamp); | ||
} | ||
@@ -383,5 +361,5 @@ } | ||
} | ||
} | ||
}; | ||
const $48594293_contextStruct = $2563227135.struct.create({ | ||
const contextStruct = briskyStruct.struct.create({ | ||
props: { | ||
@@ -392,4 +370,4 @@ default: { | ||
updateParent: (val, stamp, t) => { | ||
console.log('👻 GO UPDATE PARENT!!! 👻') | ||
t.parent().emit('data', val, stamp) | ||
console.log('👻 GO UPDATE PARENT!!! 👻'); | ||
t.parent().emit('data', val, stamp); | ||
} | ||
@@ -400,9 +378,9 @@ } | ||
} | ||
}) | ||
}); | ||
const $48594293_contextIsNotEqual = (val, context) => { | ||
const contextIsNotEqual = (val, context) => { | ||
if (val && typeof val === 'object') { | ||
for (let field in val) { | ||
if (!context[field] || val[field] !== context[field].compute()) { | ||
console.log('😜', field) | ||
console.log('😜', field); | ||
return true | ||
@@ -412,21 +390,21 @@ } | ||
} else { | ||
console.log('😜 ?????') | ||
console.log('😜 ?????'); | ||
return val !== context.compute() | ||
} | ||
} | ||
}; | ||
const $48594293_context = (hub, val, key, stamp) => { | ||
if (!hub.context || $48594293_contextIsNotEqual(val, hub.context)) { | ||
console.log('⚽️ fire fire fire FLAME context ⚽️', val, stamp) | ||
const context = (hub, val, key, stamp) => { | ||
if (!hub.context || contextIsNotEqual(val, hub.context)) { | ||
console.log('⚽️ fire fire fire FLAME context ⚽️', val, stamp); | ||
if (!hub.context) { | ||
$2563227135.create(val, stamp, $48594293_contextStruct, hub, key) | ||
briskyStruct.create(val, stamp, contextStruct, hub, key); | ||
} else { | ||
$48594293_removeClients(hub, stamp) | ||
hub.context.set(val, stamp) | ||
removeClients(hub, stamp); | ||
hub.context.set(val, stamp); | ||
} | ||
if (hub.connected && hub.connected.compute() === true) $4125568599_export_meta(hub) | ||
if (hub.connected && hub.connected.compute() === true) meta(hub); | ||
} | ||
} | ||
}; | ||
const $48594293_props = { | ||
const props = { | ||
reconnect: true, | ||
@@ -437,43 +415,42 @@ socket: true, | ||
receiveOnly: true, | ||
url: $48594293_url, | ||
context: $48594293_context, | ||
connected: $48594293_connected | ||
} | ||
url, | ||
context, | ||
connected | ||
}; | ||
const $48594293_stub = () => {} | ||
const stub = () => {}; | ||
const $48594293_define = { | ||
const define = { | ||
subscribe (subs, cb, raw, tree) { | ||
if (!raw) subs = $2563227135.parse(subs) | ||
if (!raw) subs = briskyStruct.parse(subs); | ||
if (!this.receiveOnly) { | ||
const parsed = $2711378567(this, subs) | ||
const parsed = parse$1(this, subs); | ||
if (parsed) { | ||
const key = $257117234(JSON.stringify(parsed)) | ||
const key = hash(JSON.stringify(parsed)); | ||
if (!this.upstreamSubscriptions) { | ||
this.upstreamSubscriptions = { [key]: parsed } | ||
if (this.url) $4125568599_export_meta(this) | ||
this.upstreamSubscriptions = { [key]: parsed }; | ||
if (this.url) meta(this); | ||
} else if (!this.upstreamSubscriptions[key]) { | ||
this.upstreamSubscriptions[key] = parsed | ||
if (this.url) $4125568599_export_meta(this) | ||
this.upstreamSubscriptions[key] = parsed; | ||
if (this.url) meta(this); | ||
} | ||
} | ||
} | ||
return $2563227135.subscribe(this, subs, cb || $48594293_stub, tree) | ||
return briskyStruct.subscribe(this, subs, cb || stub, tree) | ||
} | ||
} | ||
}; | ||
const $48594293_on = { data: { send: $4125568599_export_send } } | ||
const on = { data: { send } }; | ||
const $48594293_export_props = $48594293_props | ||
const $48594293_export_on = $48594293_on | ||
const $48594293_export_define = $48594293_define | ||
const $48594293_$ALL$ = { | ||
props: $48594293_export_props, | ||
on: $48594293_export_on, | ||
define: $48594293_export_define | ||
} | ||
const $911301798 = require('uws/uws.js') | ||
const $3742651364_isFn = /^\$fn\|/ | ||
const $3742651364_dummy = () => false | ||
var client = Object.freeze({ | ||
props: props, | ||
on: on, | ||
define: define | ||
}); | ||
const isFn = /^\$fn\|/; | ||
const dummy = () => false; | ||
// const client = (tree) => { | ||
@@ -511,17 +488,17 @@ // while (tree) { | ||
const $3742651364_parse = (obj, state, key) => { | ||
const result = {} | ||
const parse$2 = (obj, state, key) => { | ||
const result = {}; | ||
for (let i in obj) { | ||
if ($3742651364_isFn.test(i)) { | ||
let val = obj[i] | ||
i = i.slice(4) | ||
if (isFn.test(i)) { | ||
let val = obj[i]; | ||
i = i.slice(4); | ||
// need to fix bublé stuff in these fn creations -- prop need to add buble | ||
// runtime in a hub | ||
let pass | ||
let pass; | ||
try { | ||
obj[i] = new Function('return ' + val)() // eslint-disable-line | ||
obj[i] = new Function('return ' + val)(); // eslint-disable-line | ||
// if (/\.client|\[['"']client['"]\]/.test(val)) { // eslint-disable-line | ||
// obj[i] = clientContext(obj[i]) | ||
// } | ||
pass = true | ||
pass = true; | ||
// do dry run with your own key in a props object | ||
@@ -532,47 +509,30 @@ // 2 options for this ofcourse | ||
} catch (e) { | ||
let msg | ||
let msg; | ||
// if (!pass) { | ||
msg = `cannot parse function ${key}.exec\n${val}` | ||
msg = `cannot parse function ${key}.exec\n${val}`; | ||
// } else { | ||
// msg = `cannot run function ${key}.exec\n${val}` | ||
// } | ||
state.emit('error', new Error(msg)) | ||
obj[i] = $3742651364_dummy | ||
state.emit('error', new Error(msg)); | ||
obj[i] = dummy; | ||
} | ||
} | ||
if (typeof obj[i] !== 'object') { | ||
result[i] = obj[i] | ||
result[i] = obj[i]; | ||
} else { | ||
result[i] = $3742651364_parse(obj[i], state, i) | ||
result[i] = parse$2(obj[i], state, i); | ||
} | ||
} | ||
return result | ||
} | ||
}; | ||
const $3742651364 = $3742651364_parse | ||
const cache = (client, struct$$1, stamp) => { | ||
if (!client.cache) client.cache = {}; | ||
client.cache[briskyStruct.puid(struct$$1)] = stamp; | ||
}; | ||
const isCached = (client, struct$$1, stamp) => client.cache && | ||
client.cache[briskyStruct.puid(struct$$1)] === stamp; | ||
const $3904796091_cache = (client, struct, stamp) => { | ||
if (!client.cache) client.cache = {} | ||
client.cache[$2563227135.puid(struct)] = stamp | ||
} | ||
const $3904796091_isCached = (client, struct, stamp) => client.cache && | ||
client.cache[$2563227135.puid(struct)] === stamp | ||
// const isCached = () => false | ||
const $3904796091_export_cache = $3904796091_cache | ||
const $3904796091_export_isCached = $3904796091_isCached | ||
const $3904796091_$ALL$ = { | ||
cache: $3904796091_export_cache, | ||
isCached: $3904796091_export_isCached | ||
} | ||
const $1622386187_isEmpty = obj => { | ||
const isEmpty$1 = obj => { | ||
for (let i in obj) { //eslint-disable-line | ||
@@ -582,10 +542,10 @@ return false | ||
return true | ||
} | ||
}; | ||
const $1622386187_progress = (client) => { | ||
const progress = (client) => { | ||
if (!client.inProgress) { | ||
client.inProgress = {} | ||
$3040487635.on(() => { | ||
client.inProgress = {}; | ||
bs.on(() => { | ||
if (client.val !== null) { | ||
if (!$1622386187_isEmpty(client.inProgress)) { | ||
if (!isEmpty$1(client.inProgress)) { | ||
if (client.inProgress.types) { | ||
@@ -598,55 +558,55 @@ for (let i in client.inProgress) { | ||
} else { | ||
let tmp = client.inProgress[i] | ||
delete client.inProgress[i] | ||
client.inProgress[i] = tmp | ||
let tmp = client.inProgress[i]; | ||
delete client.inProgress[i]; | ||
client.inProgress[i] = tmp; | ||
} | ||
} | ||
} | ||
client.socket.send(JSON.stringify(client.inProgress)) | ||
client.socket.send(JSON.stringify(client.inProgress)); | ||
} | ||
client.inProgress = false | ||
client.inProgress = false; | ||
} | ||
}) | ||
}); | ||
} | ||
return client.inProgress | ||
} | ||
}; | ||
const $1622386187_send = (hub, client, struct, type, subs, tree) => { | ||
if (struct.isHub && client.val !== null) { | ||
let isRemoved | ||
const send$1 = (hub, client, struct$$1, type, subs, tree) => { | ||
if (struct$$1.isHub && client.val !== null) { | ||
let isRemoved; | ||
if (type === 'remove') { | ||
if (!struct._p[struct.key]) isRemoved = true | ||
} else if (type === 'update' && tree.$t !== struct) { | ||
if (!struct$$1._p[struct$$1.key]) isRemoved = true; | ||
} else if (type === 'update' && tree.$t !== struct$$1) { | ||
if (tree.$t && tree.$t._p && !tree.$t._p[tree.$t.key]) { | ||
let previous = tree.$t | ||
let prop = previous | ||
let previous = tree.$t; | ||
let prop = previous; | ||
while (previous) { | ||
if (previous._p && previous._p[previous.key]) { | ||
// think of something fast for level... | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, prop, $2563227135.get(hub, 'serverIndex'), true) | ||
serialize$2(client, progress(client), subs, prop, briskyStruct.get(hub, 'serverIndex'), true); | ||
} | ||
prop = previous | ||
previous = previous._p | ||
prop = previous; | ||
previous = previous._p; | ||
} | ||
} | ||
} | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, struct, $2563227135.get(hub, 'serverIndex'), isRemoved) | ||
serialize$2(client, progress(client), subs, struct$$1, briskyStruct.get(hub, 'serverIndex'), isRemoved); | ||
} | ||
} | ||
}; | ||
const $1622386187_serialize = (client, t, subs, struct, level, isRemoved) => { | ||
const stamp = $2563227135.get(struct, 'stamp') || 1 // remove the need for this default (feels wrong) | ||
const val = isRemoved ? null : $2563227135.getVal(struct) | ||
const serialize$2 = (client, t, subs, struct$$1, level, isRemoved) => { | ||
const stamp = briskyStruct.get(struct$$1, 'stamp') || 1; // remove the need for this default (feels wrong) | ||
const val = isRemoved ? null : briskyStruct.getVal(struct$$1); | ||
if (val !== void 0 && stamp && !$3904796091_export_isCached(client, struct, stamp)) { | ||
if (val !== void 0 && stamp && !isCached(client, struct$$1, stamp)) { | ||
// val === null -- double chck if this is nessecary | ||
const path = struct.path() | ||
const len = path.length | ||
let s = t | ||
const path = struct$$1.path(); | ||
const len = path.length; | ||
let s = t; | ||
for (let i = level; i < len; i++) { | ||
let tt = s[path[i]] | ||
let tt = s[path[i]]; | ||
if (!tt) { | ||
s = s[path[i]] = {} | ||
s = s[path[i]] = {}; | ||
} else { | ||
s = tt | ||
s = tt; | ||
if (s.val === null) return | ||
@@ -657,18 +617,18 @@ } | ||
if (isRemoved) { | ||
$3904796091_export_cache(client, struct, stamp) | ||
s.stamp = stamp | ||
s.val = val | ||
cache(client, struct$$1, stamp); | ||
s.stamp = stamp; | ||
s.val = val; | ||
} else { | ||
if (subs.type) { | ||
const type = $2563227135.get(struct, 'type') // make getType (fast) | ||
if ($2563227135.getVal(type) !== 'hub') { | ||
$1622386187_serialize(client, t, subs.type, type, level) | ||
const type = briskyStruct.get(struct$$1, 'type'); // make getType (fast) | ||
if (briskyStruct.getVal(type) !== 'hub') { | ||
serialize$2(client, t, subs.type, type, level); | ||
} | ||
} | ||
$3904796091_export_cache(client, struct, stamp) | ||
s.stamp = stamp | ||
if (struct.key === 'type') { | ||
cache(client, struct$$1, stamp); | ||
s.stamp = stamp; | ||
if (struct$$1.key === 'type') { | ||
if (val === 'hub') return | ||
$1622386187_serialize(client, t, subs, $2563227135.getType(struct.parent(2), val), level) | ||
serialize$2(client, t, subs, briskyStruct.getType(struct$$1.parent(2), val), level); | ||
// allways need a stamp! | ||
@@ -678,7 +638,7 @@ } | ||
if (typeof val === 'object' && val.inherits) { | ||
s.val = val.path() | ||
s.val.unshift('@', 'root') | ||
$1622386187_serialize(client, t, subs, val, level) | ||
s.val = val.path(); | ||
s.val.unshift('@', 'root'); | ||
serialize$2(client, t, subs, val, level); | ||
} else if (val !== void 0) { | ||
s.val = val | ||
s.val = val; | ||
} | ||
@@ -688,104 +648,87 @@ } | ||
// can send a bit too much data when val: true and overlapping keys | ||
$1622386187_serialize(client, t, subs, val, level) | ||
serialize$2(client, t, subs, val, level); | ||
} | ||
if (subs.val === true && !isRemoved) { | ||
$1622386187_deepSerialize($2563227135.getKeys(struct), client, t, subs, struct, level) | ||
deepSerialize(briskyStruct.getKeys(struct$$1), client, t, subs, struct$$1, level); | ||
} | ||
} | ||
}; | ||
const $1622386187_deepSerialize = (keys, client, t, subs, struct, level) => { | ||
if (struct.get('type') && struct.get('type').compute() !== 'hub') { | ||
$1622386187_serialize(client, t, subs, struct.get('type'), level) | ||
const deepSerialize = (keys, client, t, subs, struct$$1, level) => { | ||
if (struct$$1.get('type') && struct$$1.get('type').compute() !== 'hub') { | ||
serialize$2(client, t, subs, struct$$1.get('type'), level); | ||
} | ||
if (keys) { | ||
for (let i = 0, len = keys.length; i < len; i++) { | ||
let prop = $2563227135.get(struct, keys[i]) | ||
if (prop && prop.isHub) $1622386187_serialize(client, t, subs, prop, level) | ||
let prop = briskyStruct.get(struct$$1, keys[i]); | ||
if (prop && prop.isHub) serialize$2(client, t, subs, prop, level); | ||
} | ||
} | ||
if (struct._removed) { | ||
for (let i = 0, len = struct._removed.length; i < len; i++) { | ||
let prop = struct._removed[i] | ||
$1622386187_serialize(client, t, subs, prop, level, true) | ||
if (struct$$1._removed) { | ||
for (let i = 0, len = struct$$1._removed.length; i < len; i++) { | ||
let prop = struct$$1._removed[i]; | ||
serialize$2(client, t, subs, prop, level, true); | ||
} | ||
} | ||
} | ||
}; | ||
const $1622386187 = $1622386187_send | ||
const $2931540049_removeSubscriptions = (t, id) => { | ||
const removeSubscriptions = (t, id) => { | ||
if (t.subscriptions) { | ||
let i = t.subscriptions.length | ||
let i = t.subscriptions.length; | ||
while (i--) { // clean this up with unsubscribe in struct | ||
if (t.subscriptions[i]._uid_ == id) { //eslint-disable-line | ||
t.subscriptions.splice(i, 1) | ||
t.subscriptions.splice(i, 1); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
const $2931540049_removeClient = (client) => { | ||
const id = client.key | ||
client.val = null | ||
const removeClient = (client) => { | ||
const id = client.key; | ||
client.val = null; | ||
if (client.socket) { | ||
client.socket.client = null | ||
client.socket = null | ||
client.socket.client = null; | ||
client.socket = null; | ||
} | ||
const t = client.parent(2) | ||
$2931540049_removeSubscriptions(t, id) | ||
client.set(null) | ||
const t = client.parent(2); | ||
removeSubscriptions(t, id); | ||
client.set(null); | ||
// if (client.context && t.clients.keys().length === (t.url ? 1 : 0)) { | ||
// t.set(null, stamp) | ||
// } | ||
} | ||
}; | ||
const $2931540049_export_removeSubscriptions = $2931540049_removeSubscriptions | ||
const $2931540049_export_removeClient = $2931540049_removeClient | ||
var incoming = (hub, socket, data) => { | ||
const payload = data[0]; | ||
const meta = data[1]; | ||
var client = socket.client; | ||
const $2931540049_$ALL$ = { | ||
removeSubscriptions: $2931540049_export_removeSubscriptions, | ||
removeClient: $2931540049_export_removeClient | ||
} | ||
const $1353865041 = (hub, socket, data) => { | ||
const payload = data[0] | ||
const meta = data[1] | ||
var client = socket.client | ||
if (meta) { | ||
let t | ||
let t; | ||
if (client) { | ||
t = hub | ||
t = hub; | ||
if ('context' in meta && client.context != meta.context) { // eslint-disable-line | ||
$2931540049_export_removeClient(client) | ||
$1353865041_create(hub, socket, meta, payload) | ||
removeClient(client); | ||
create$1(hub, socket, meta, payload); | ||
} else if (meta.subscriptions) { | ||
if (payload) $1353865041_setPayload(t, payload, client) | ||
$1353865041_incomingSubscriptions(t, client, meta, client.key) | ||
$3040487635.close() | ||
if (payload) setPayload(t, payload, client); | ||
incomingSubscriptions(t, client, meta, client.key); | ||
bs.close(); | ||
} | ||
} else { | ||
$1353865041_create(hub, socket, meta, payload) | ||
create$1(hub, socket, meta, payload); | ||
} | ||
} else { | ||
$1353865041_setPayload(client.parent(2), payload, client) | ||
$3040487635.close() | ||
setPayload(client.parent(2), payload, client); | ||
bs.close(); | ||
} | ||
} | ||
}; | ||
const $1353865041_addToCache = (client, hub, payload) => { | ||
const addToCache = (client, hub, payload) => { | ||
if (typeof payload === 'object' && payload) { | ||
for (let key in payload) { | ||
if (key !== 'val' && key !== 'stamp') { | ||
let struct = hub[key] | ||
if (struct && struct.isHub) { | ||
$1353865041_addToCache(client, hub[key], payload[key]) | ||
let struct$$1 = hub[key]; | ||
if (struct$$1 && struct$$1.isHub) { | ||
addToCache(client, hub[key], payload[key]); | ||
} | ||
@@ -795,87 +738,85 @@ } | ||
if (payload.val !== void 0 && payload.stamp) { | ||
$3904796091_export_cache(client, hub, payload.stamp) | ||
cache(client, hub, payload.stamp); | ||
} | ||
} | ||
} | ||
}; | ||
const $1353865041_setPayload = (hub, payload, client) => { | ||
hub.set(payload, false) | ||
$1353865041_addToCache(client, hub, payload) | ||
} | ||
const setPayload = (hub, payload, client) => { | ||
hub.set(payload, false); | ||
addToCache(client, hub, payload); | ||
}; | ||
const $1353865041_set = (meta, socket, t, payload) => { | ||
const stamp = $3040487635.create() | ||
const id = meta.id | ||
const context = meta.context | ||
const set$1 = (meta, socket, t, payload) => { | ||
const stamp = bs.create(); | ||
const id = meta.id; | ||
const context = meta.context; | ||
// const ip = socket._socket.remoteAddress | ||
const client = socket.client = $3376394415( | ||
const client = socket.client = createClient( | ||
t, { socket, context }, stamp, socket.useragent, id | ||
) | ||
if (payload) $1353865041_setPayload(t, payload, client) | ||
if (meta.subscriptions) $1353865041_incomingSubscriptions(t, client, meta, id) | ||
$3040487635.close() | ||
} | ||
); | ||
if (payload) setPayload(t, payload, client); | ||
if (meta.subscriptions) incomingSubscriptions(t, client, meta, id); | ||
bs.close(); | ||
}; | ||
const $1353865041_create = (hub, socket, meta, payload) => { | ||
const t = meta.context ? hub.getContext(meta.context, socket) : hub | ||
const create$1 = (hub, socket, meta, payload) => { | ||
const t = meta.context ? hub.getContext(meta.context, socket) : hub; | ||
if (!t.inherits && t.then) { | ||
t.then((t) => { | ||
if (socket.external !== null) { | ||
console.log('client connected and found informations') | ||
$1353865041_set(meta, socket, t, payload) | ||
console.log('client connected and found informations'); | ||
set$1(meta, socket, t, payload); | ||
} else { | ||
console.log('client discconected when logging in') | ||
console.log('client discconected when logging in'); | ||
} | ||
}).catch(err => hub.emit('error', err)) | ||
}).catch(err => hub.emit('error', err)); | ||
} else { | ||
$1353865041_set(meta, socket, t, payload) | ||
set$1(meta, socket, t, payload); | ||
} | ||
} | ||
}; | ||
const $1353865041_incomingSubscriptions = (hub, client, meta, id) => { | ||
const update = (t, type, subs, tree) => $1622386187(hub, client, t, type, subs, tree) | ||
if (!client.upstreamSubscriptions) client.upstreamSubscriptions = {} | ||
const incomingSubscriptions = (hub, client, meta, id) => { | ||
const update = (t, type, subs, tree) => send$1(hub, client, t, type, subs, tree); | ||
if (!client.upstreamSubscriptions) client.upstreamSubscriptions = {}; | ||
for (let key in meta.subscriptions) { | ||
let uid = key + '-' + id | ||
let uid = key + '-' + id; | ||
if (!client.upstreamSubscriptions[uid]) { | ||
let subs = $3742651364(meta.subscriptions[key], hub) | ||
client.upstreamSubscriptions[uid] = subs | ||
$2563227135.subscribe(hub, subs, update) | ||
hub.subscriptions[hub.subscriptions.length - 1]._uid_ = id | ||
let subs = parse$2(meta.subscriptions[key], hub); | ||
client.upstreamSubscriptions[uid] = subs; | ||
briskyStruct.subscribe(hub, subs, update); | ||
hub.subscriptions[hub.subscriptions.length - 1]._uid_ = id; | ||
} | ||
} | ||
} | ||
}; | ||
var $2138030230_removedInProgress | ||
const $2138030230_on = { | ||
var removedInProgress; | ||
const on$1 = { | ||
data: { | ||
remove$: (val, stamp, struct) => { | ||
remove$: (val, stamp, struct$$1) => { | ||
// just do a diff with the payload rly the best way for now... | ||
if (val === null && (!struct._c || struct._cLevel === 1)) { | ||
let p = struct | ||
let hub | ||
if (val === null && (!struct$$1._c || struct$$1._cLevel === 1)) { | ||
let p = struct$$1; | ||
let hub; | ||
while (p) { | ||
if (p.port && !p._c) { hub = p } | ||
p = p.parent() | ||
if (p.port && !p._c) { hub = p; } | ||
p = p.parent(); | ||
} | ||
if (hub) { | ||
// probably not working correctly with context | ||
const target = struct.parent() | ||
const target = struct$$1.parent(); | ||
if (target) { | ||
if (!target._removed) { | ||
target._removed = [] | ||
if (!$2138030230_removedInProgress) { | ||
$2138030230_removedInProgress = [] | ||
$3040487635.on(() => { | ||
let i = $2138030230_removedInProgress.length | ||
target._removed = []; | ||
if (!removedInProgress) { | ||
removedInProgress = []; | ||
bs.on(() => { | ||
let i = removedInProgress.length; | ||
while (i--) { | ||
delete $2138030230_removedInProgress[i]._removed | ||
delete removedInProgress[i]._removed; | ||
} | ||
}) | ||
}); | ||
} | ||
$2138030230_removedInProgress.push(target) | ||
removedInProgress.push(target); | ||
} | ||
target._removed.push(struct) | ||
target._removed.push(struct$$1); | ||
} | ||
@@ -886,98 +827,90 @@ } | ||
} | ||
} | ||
}; | ||
const $2138030230 = $2138030230_on | ||
const Server = uws.Server; | ||
const createServer = (hub, port) => { | ||
const server = new Server({ port }); | ||
console.log(`💫 hub listening on ${port} 💫`); | ||
const $3248609833_Server = $911301798.Server | ||
const $3248609833_createServer = (hub, port) => { | ||
const server = new $3248609833_Server({ port }) | ||
console.log(`💫 hub listening on ${port} 💫`) | ||
server.on('connection', socket => { | ||
socket.useragent = socket.upgradeReq && socket.upgradeReq.headers['user-agent'] | ||
socket.useragent = socket.upgradeReq && socket.upgradeReq.headers['user-agent']; | ||
// need to remove when done -- its the best thing todo (mem!!!) | ||
socket.on('message', (data) => { | ||
data = JSON.parse(data) | ||
if (data) { $1353865041(hub, socket, data) } | ||
}) | ||
data = JSON.parse(data); | ||
if (data) { incoming(hub, socket, data); } | ||
}); | ||
const close = () => { | ||
if (socket.client) $2931540049_export_removeClient(socket.client) | ||
} | ||
if (socket.client) removeClient(socket.client); | ||
}; | ||
socket.on('close', close) | ||
socket.on('close', close); | ||
// socket.on('error', () => close()) // need to do something here as well no leaks! | ||
}) | ||
}); | ||
return server | ||
} | ||
}; | ||
const $3248609833_removeServer = hub => { | ||
const server = hub._server_ | ||
const instances = hub.instances | ||
$3248609833_closeConnections(hub) | ||
const removeServer = hub => { | ||
const server = hub._server_; | ||
const instances = hub.instances; | ||
closeConnections(hub); | ||
for (let i = 0, len = instances && instances.length; i < len; i++) { | ||
$3248609833_closeConnections(instances[i]) | ||
closeConnections(instances[i]); | ||
} | ||
server.httpServer.close() | ||
server.httpServer.close(); | ||
// remove all clients subscriptions | ||
hub._server_ = null | ||
} | ||
hub._server_ = null; | ||
}; | ||
const $3248609833_closeConnections = hub => { | ||
const clients = hub.clients | ||
const id = hub._uid_ // to exclude the client (not nessecary) | ||
const closeConnections = hub => { | ||
const clients = hub.clients; | ||
const id = hub._uid_; // to exclude the client (not nessecary) | ||
if (clients) { | ||
clients.forEach(client => { | ||
if (client.socket && client.key !== id) { | ||
client.val = null | ||
$2931540049_export_removeSubscriptions(hub, client.key) | ||
client.socket.close() | ||
client.val = null; | ||
removeSubscriptions(hub, client.key); | ||
client.socket.close(); | ||
} | ||
}) | ||
}); | ||
} | ||
} | ||
}; | ||
const $3248609833_removePort = hub => { | ||
hub.port = null | ||
hub.serverIndex = null | ||
hub.emitters.set({ data: { port$: null } }) | ||
} | ||
const removePort = hub => { | ||
hub.port = null; | ||
hub.serverIndex = null; | ||
hub.emitters.set({ data: { port$: null } }); | ||
}; | ||
const $3248609833_port = (hub, val, key, stamp) => { | ||
const port = (hub, val, key, stamp) => { | ||
// use remove | ||
hub.on((val, stamp, t) => { | ||
if (val === null && !t._c && t === hub) { | ||
$3248609833_removeServer(hub) | ||
$3248609833_removePort(hub) | ||
removeServer(hub); | ||
removePort(hub); | ||
} | ||
}, 'port$') | ||
if (!val) val = null | ||
}, 'port$'); | ||
if (!val) val = null; | ||
if ((!hub.port && val) || (hub.port.compute() !== val)) { | ||
if (hub._server_) { | ||
$3248609833_removeServer(hub) | ||
removeServer(hub); | ||
} | ||
if (!val) { | ||
if (hub.port) hub.port.set(null, stamp) | ||
$3248609833_removePort(hub) | ||
if (hub.port) hub.port.set(null, stamp); | ||
removePort(hub); | ||
} else { | ||
if (!hub.port) { | ||
$2563227135.create({ | ||
briskyStruct.create({ | ||
on: { | ||
data: { | ||
port: (val, stamp, struct) => { | ||
val = struct.compute() | ||
port: (val, stamp, struct$$1) => { | ||
val = struct$$1.compute(); | ||
if (val) { | ||
let i = -1 | ||
if (hub.key) i++ | ||
hub.parent(() => { i++ }) | ||
hub.serverIndex = i | ||
hub._server_ = $3248609833_createServer(hub, val) | ||
let i = -1; | ||
if (hub.key) i++; | ||
hub.parent(() => { i++; }); | ||
hub.serverIndex = i; | ||
hub._server_ = createServer(hub, val); | ||
} | ||
@@ -987,23 +920,24 @@ } | ||
} | ||
}, stamp, $2563227135.struct, hub, key) | ||
}, stamp, briskyStruct.struct, hub, key); | ||
} | ||
hub.port.set(val, stamp) | ||
hub.port.set(val, stamp); | ||
} | ||
} | ||
} | ||
}; | ||
const $3248609833_props = { | ||
const props$1 = { | ||
_server_: true, | ||
serverIndex: true, | ||
port: $3248609833_port | ||
} | ||
port | ||
}; | ||
const $3248609833_export_props = $3248609833_props | ||
const $3248609833_export_on = $2138030230 | ||
const $3248609833_$ALL$ = { | ||
props: $3248609833_export_props, | ||
on: $3248609833_export_on | ||
} | ||
const $25049122 = { | ||
var server = Object.freeze({ | ||
props: props$1, | ||
on: on$1 | ||
}); | ||
var context$1 = { | ||
props: { | ||
@@ -1015,23 +949,23 @@ contextKey: true, | ||
getContext (key, socket) { | ||
return fn(key, (key) => $25049122_createContext(this, key), this, socket) | ||
return fn(key, (key) => createContext(this, key), this, socket) | ||
} | ||
} | ||
}) | ||
}); | ||
} | ||
}, | ||
getContext: (key, context) => context() | ||
} | ||
}; | ||
const $25049122_createContext = (hub, val) => { | ||
var result = $25049122_find(hub, val) | ||
const createContext = (hub, val) => { | ||
var result = find(hub, val); | ||
if (!result) { | ||
result = hub.create({ contextKey: val }, false) | ||
result = hub.create({ contextKey: val }, false); | ||
} | ||
return result | ||
} | ||
}; | ||
const $25049122_find = (hub, val) => { | ||
const instances = hub.instances | ||
const find = (hub, val) => { | ||
const instances = hub.instances; | ||
if (instances) { | ||
let i = instances.length | ||
let i = instances.length; | ||
while (i--) { | ||
@@ -1041,17 +975,12 @@ if (instances[i].contextKey === val) return instances[i] | ||
} | ||
} | ||
}; | ||
if (typeof window === 'undefined') { | ||
// dont do this gets added to client... | ||
require('source-map-support').install() | ||
require('source-map-support').install(); | ||
} | ||
const $302300578_types = $2563227135.struct.props.types | ||
const types = briskyStruct.struct.props.types; | ||
const $302300578_hub = $2563227135.create({ | ||
const hub = briskyStruct.create({ | ||
type: 'hub', | ||
@@ -1062,30 +991,30 @@ instances: false, | ||
default: 'self', | ||
_uid_: (t, val) => { t.set({ define: { _uid_: val } }) }, | ||
_uid_: (t, val) => { t.set({ define: { _uid_: val } }); }, | ||
// why nto call this client id -- thats what it is | ||
clients: (t, val, key, stamp) => { | ||
if (!t.clients) { | ||
t.clients = $2563227135.create(val, stamp, $302300578_clients, t, key) | ||
t.clients = briskyStruct.create(val, stamp, clients, t, key); | ||
} else { | ||
$2563227135.set(t.clients, val, stamp) | ||
briskyStruct.set(t.clients, val, stamp); | ||
} | ||
}, | ||
types: $302300578_types.bind(), // to not interfere with struct type | ||
type: $2563227135.struct.props.type.bind(), | ||
types: types.bind(), // to not interfere with struct type | ||
type: briskyStruct.struct.props.type.bind(), | ||
client: true | ||
} | ||
}) | ||
}); | ||
$302300578_hub.props.types.struct = $302300578_hub.create({ | ||
props: { default: $302300578_types.struct.props.default.bind() } | ||
}, false) | ||
hub.props.types.struct = hub.create({ | ||
props: { default: types.struct.props.default.bind() } | ||
}, false); | ||
$302300578_hub.props.types.struct.props.default.struct = $302300578_hub.props.type.struct = $302300578_hub | ||
hub.props.types.struct.props.default.struct = hub.props.type.struct = hub; | ||
$302300578_hub.set({ types: { hub: 'self' }, inject: [ $3248609833_$ALL$, $48594293_$ALL$, $25049122 ] }, false) | ||
hub.set({ types: { hub: 'self' }, inject: [ server, client, context$1 ] }, false); | ||
$302300578_hub.types._ks = void 0 | ||
hub.types._ks = void 0; | ||
const $302300578_clients = $2563227135.create({ | ||
const clients = briskyStruct.create({ | ||
props: { | ||
default: $302300578_hub.create({ | ||
default: hub.create({ | ||
props: { | ||
@@ -1100,13 +1029,12 @@ cache: true, | ||
} | ||
}, false) | ||
}, false); | ||
const $302300578 = $302300578_hub | ||
console.log('HUB START...'); | ||
const fn = (val, stamp) => hub.create(val, stamp); | ||
const $621652771_fn = (val, stamp) => $302300578.create(val, stamp) | ||
const $621652771 = $621652771_fn | ||
// add uids to stamps else it sucks -- dont compromise for tests think of that as an after thought | ||
module.exports = $621652771 | ||
module.exports = fn; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "hub.js", | ||
"description": "Seamless realtime communcation", | ||
"version": "0.0.11-56a16229a5f5f7943db0ee0fcada5e37692fb0fc", | ||
"version": "0.0.11-a77cea9de63088230954abee61135cb832057046", | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"jsnext:main": "dist/index.es.js", | ||
"browser": { | ||
@@ -15,13 +17,13 @@ "./dist/index.js": "./dist/browser.js", | ||
"scripts": { | ||
"build": "builder-boy src/index.js dist/index.js", | ||
"lint": "standard --fix", | ||
"build": "node rollup/build", | ||
"pretest": "npm run build && standard", | ||
"watch": "node rollup/watch", | ||
"version-commit": "npm --no-git-tag-version version $(node -pe \"require('./package.json').version.split('-')[0]\")-$(git log -n 1 --pretty=format:'%H')", | ||
"publish-unstable": "npm run version-commit && npm publish --tag unstable", | ||
"pretest": "npm run build", | ||
"publish-branch": "npm run version-commit && npm publish --tag $(git rev-parse --abbrev-ref HEAD | sed 's/\\//-/g')", | ||
"prepublish": "npm run build", | ||
"test": "node test/index.js", | ||
"dev": "node rollup/watch & nodemon --harmony-async-await test/index.js", | ||
"cover": "nyc npm test", | ||
"travis": "nyc npm test && nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
"precommit": "lint, test", | ||
"repository": { | ||
@@ -45,3 +47,3 @@ "type": "git", | ||
"brisky-stamp": "^4.0.0", | ||
"brisky-struct": "unstable", | ||
"brisky-struct": "feature-enhancements", | ||
"string-hash": "^1.1.0", | ||
@@ -60,3 +62,2 @@ "uws": "0.12.0", | ||
"devDependencies": { | ||
"builder-boy": "latest", | ||
"buble": "0.15.1", | ||
@@ -67,2 +68,6 @@ "coveralls": "^2.11.9", | ||
"pre-commit": "^1.1.3", | ||
"rollup": "^0.37.0", | ||
"rollup-plugin-commonjs": "^6.0.0", | ||
"rollup-plugin-istanbul": "^1.1.0", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-watch": "^2.5.0", | ||
@@ -69,0 +74,0 @@ "source-map-support": "^0.4.7", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
363630
12
2746
13
3
+ Addedbrisky-struct@1.1.7-b279c9343194043e5d005a7946bae1f4cdf5f2bc(transitive)
- Removedbrisky-struct@1.1.7-7f398b2252470239555121110f7ee1cd796df8cd(transitive)