Comparing version 0.0.11-706ea0d9873b37fd502fdddb30467f4fbd42c34d to 0.0.11-7d2e1c177f16a9e89d7f54b1ed225552f132cece
// FILE: brisky-struct | ||
const $1213768903 = require('brisky-struct') | ||
// FILE: brisky-stamp | ||
const $932573643 = require('brisky-stamp') | ||
// FILE: /Users/youzi/dev/brisky-struct/dist/index.js | ||
const $278721121 = require('brisky-struct') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/brisky-stamp/dist/index.js | ||
const $3040487635 = require('brisky-stamp') | ||
// FILE: /Users/youzi/dev/hub.js/src/client/send.js | ||
@@ -59,3 +59,3 @@ | ||
if (!hub.receiveOnly) { | ||
const store = $4125568599_inProgress(hub, $932573643.inProgress ? $932573643.on : $4125568599_next) | ||
const store = $4125568599_inProgress(hub, $3040487635.inProgress ? $3040487635.on : $4125568599_next) | ||
if (!store[1]) store[1] = {} | ||
@@ -93,3 +93,3 @@ if (hub.context) { | ||
} | ||
$4125568599_serialize(hub, $4125568599_inProgress(hub, $932573643.on), struct, val, hub.urlIndex) | ||
$4125568599_serialize(hub, $4125568599_inProgress(hub, $3040487635.on), struct, val, hub.urlIndex) | ||
} | ||
@@ -204,6 +204,6 @@ } | ||
// FILE: string-hash | ||
const $1851648559 = require('string-hash') | ||
// FILE: vigour-ua | ||
const $1888714796 = require('vigour-ua') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/string-hash/index.js | ||
const $257117234 = require('string-hash') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/vigour-ua/index.js | ||
const $1190737809 = require('vigour-ua') | ||
// FILE: /Users/youzi/dev/hub.js/src/client/uid/browser.js | ||
@@ -214,3 +214,3 @@ | ||
global.navigator.language | ||
const $1123050690 = () => $1851648559(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`) | ||
const $1123050690 = () => $257117234(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`) | ||
@@ -223,3 +223,3 @@ // FILE: /Users/youzi/dev/hub.js/src/client/create.js | ||
if (!id) id = t._uid_ || $1123050690() | ||
$1888714796(useragent, val) | ||
$1190737809(useragent, val) | ||
t.set({ clients: { [id]: val } }, stamp) | ||
@@ -248,6 +248,6 @@ return t.clients[id] | ||
const close = () => { | ||
const stamp = $932573643.create() | ||
const stamp = $3040487635.create() | ||
hub.socket = false | ||
hub.set({ connected: false }, stamp) | ||
$932573643.close() | ||
$3040487635.close() | ||
if (!socket.blockReconnect && hub._url_) { | ||
@@ -270,7 +270,7 @@ reconnect = Math.min((reconnect * 1.5), 2000) | ||
socket.onopen = () => { | ||
const stamp = $932573643.create() | ||
const stamp = $3040487635.create() | ||
hub.socket = socket | ||
$4125568599_meta(hub) | ||
hub.set({ connected: true }, stamp) | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -288,3 +288,3 @@ | ||
} | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -334,3 +334,3 @@ } | ||
if (!hub.url) { | ||
$1213768903.create({ | ||
$278721121.create({ | ||
on: { | ||
@@ -354,3 +354,3 @@ data: { | ||
} | ||
}, stamp, $1213768903.struct, hub, key) | ||
}, stamp, $278721121.struct, hub, key) | ||
} | ||
@@ -391,3 +391,3 @@ hub.url.set(val, stamp) | ||
const $48594293_contextStruct = $1213768903.struct.create({ | ||
const $48594293_contextStruct = $278721121.struct.create({ | ||
props: { | ||
@@ -425,3 +425,3 @@ default: { | ||
if (!hub.context) { | ||
$1213768903.create(val, stamp, $48594293_contextStruct, hub, key) | ||
$278721121.create(val, stamp, $48594293_contextStruct, hub, key) | ||
} else { | ||
@@ -450,9 +450,10 @@ $48594293_removeClients(hub, stamp) | ||
subscribe (subs, cb, raw, tree) { | ||
if (!raw) subs = $1213768903.parse(subs) | ||
if (!raw) subs = $278721121.parse(subs) | ||
if (!this.receiveOnly) { | ||
const parsed = $2711378567(this, subs) | ||
if (parsed) { | ||
const key = $1851648559(JSON.stringify(parsed)) | ||
const key = $257117234(JSON.stringify(parsed)) | ||
if (!this.upstreamSubscriptions) { | ||
this.upstreamSubscriptions = { [key]: parsed } | ||
this.upstreamSubscriptions = {} | ||
this.upstreamSubscriptions[key] = parsed | ||
if (this.url) $4125568599_meta(this) | ||
@@ -465,3 +466,3 @@ } else if (!this.upstreamSubscriptions[key]) { | ||
} | ||
return $1213768903.subscribe(this, subs, cb || $48594293_stub, tree) | ||
return $278721121.subscribe(this, subs, cb || $48594293_stub, tree) | ||
} | ||
@@ -479,9 +480,2 @@ } | ||
} | ||
// FILE: /Users/youzi/dev/hub.js/src/server/browser.js | ||
// no server in the browser -- yet | ||
const $3248609833_stub = {} | ||
const $3248609833_$ALL$ = { | ||
stub: $3248609833_stub | ||
} | ||
// FILE: /Users/youzi/dev/hub.js/src/context.js | ||
@@ -522,2 +516,6 @@ const $25049122 = { | ||
// FILE: /Users/youzi/dev/hub.js/src/server/browser.js | ||
// no server in the browser -- yet | ||
const $3248609833 = {} | ||
// FILE: /Users/youzi/dev/hub.js/src/hub.js | ||
@@ -529,5 +527,5 @@ | ||
const $302300578_types = $1213768903.struct.props.types | ||
const $302300578_types = $278721121.struct.props.types | ||
const $302300578_hub = $1213768903.create({ | ||
const $302300578_hub = $278721121.create({ | ||
type: 'hub', | ||
@@ -542,9 +540,9 @@ instances: false, | ||
if (!t.clients) { | ||
t.clients = $1213768903.create(val, stamp, $302300578_clients, t, key) | ||
t.clients = $278721121.create(val, stamp, $302300578_clients, t, key) | ||
} else { | ||
$1213768903.set(t.clients, val, stamp) | ||
$278721121.set(t.clients, val, stamp) | ||
} | ||
}, | ||
types: $302300578_types.bind(), // to not interfere with struct type | ||
type: $1213768903.struct.props.type.bind(), | ||
type: $278721121.struct.props.type.bind(), | ||
client: true | ||
@@ -560,7 +558,7 @@ } | ||
$302300578_hub.set({ types: { hub: 'self' }, inject: [ $3248609833_$ALL$, $48594293_$ALL$, $25049122 ] }, false) | ||
$302300578_hub.set({ types: { hub: 'self' }, inject: [ $3248609833, $48594293_$ALL$, $25049122 ] }, false) | ||
$302300578_hub.types._ks = void 0 | ||
const $302300578_clients = $1213768903.create({ | ||
const $302300578_clients = $278721121.create({ | ||
props: { | ||
@@ -567,0 +565,0 @@ default: $302300578_hub.create({ |
// FILE: brisky-struct | ||
const $1213768903 = require('brisky-struct') | ||
// FILE: brisky-stamp | ||
const $932573643 = require('brisky-stamp') | ||
// FILE: /Users/youzi/dev/brisky-struct/dist/index.js | ||
const $278721121 = require('brisky-struct') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/brisky-stamp/dist/index.js | ||
const $3040487635 = require('brisky-stamp') | ||
// FILE: /Users/youzi/dev/hub.js/src/client/send.js | ||
@@ -59,3 +59,3 @@ | ||
if (!hub.receiveOnly) { | ||
const store = $4125568599_inProgress(hub, $932573643.inProgress ? $932573643.on : $4125568599_next) | ||
const store = $4125568599_inProgress(hub, $3040487635.inProgress ? $3040487635.on : $4125568599_next) | ||
if (!store[1]) store[1] = {} | ||
@@ -93,3 +93,3 @@ if (hub.context) { | ||
} | ||
$4125568599_serialize(hub, $4125568599_inProgress(hub, $932573643.on), struct, val, hub.urlIndex) | ||
$4125568599_serialize(hub, $4125568599_inProgress(hub, $3040487635.on), struct, val, hub.urlIndex) | ||
} | ||
@@ -123,4 +123,4 @@ } | ||
} | ||
// FILE: websocket | ||
const $3096720 = require('websocket') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/websocket/index.js | ||
const $4020852141 = require('websocket') | ||
// FILE: /Users/youzi/dev/hub.js/src/client/websocket/index.js | ||
@@ -131,3 +131,3 @@ // import WebSocket from 'uws' | ||
const $2878564687 = $3096720.w3cwebsocket | ||
const $2878564687 = $4020852141.w3cwebsocket | ||
@@ -211,10 +211,10 @@ // FILE: /Users/youzi/dev/hub.js/src/subscription/serialize.js | ||
// FILE: string-hash | ||
const $1851648559 = require('string-hash') | ||
// FILE: vigour-ua | ||
const $1888714796 = require('vigour-ua') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/string-hash/index.js | ||
const $257117234 = require('string-hash') | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/vigour-ua/index.js | ||
const $1190737809 = require('vigour-ua') | ||
// FILE: /Users/youzi/dev/hub.js/src/client/uid/index.js | ||
const $1123050690_uniq = process.pid | ||
const $1123050690 = () => $1851648559(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`) | ||
const $1123050690 = () => $257117234(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`) | ||
@@ -227,3 +227,3 @@ // FILE: /Users/youzi/dev/hub.js/src/client/create.js | ||
if (!id) id = t._uid_ || $1123050690() | ||
$1888714796(useragent, val) | ||
$1190737809(useragent, val) | ||
t.set({ clients: { [id]: val } }, stamp) | ||
@@ -252,6 +252,6 @@ return t.clients[id] | ||
const close = () => { | ||
const stamp = $932573643.create() | ||
const stamp = $3040487635.create() | ||
hub.socket = false | ||
hub.set({ connected: false }, stamp) | ||
$932573643.close() | ||
$3040487635.close() | ||
if (!socket.blockReconnect && hub._url_) { | ||
@@ -274,7 +274,7 @@ reconnect = Math.min((reconnect * 1.5), 2000) | ||
socket.onopen = () => { | ||
const stamp = $932573643.create() | ||
const stamp = $3040487635.create() | ||
hub.socket = socket | ||
$4125568599_meta(hub) | ||
hub.set({ connected: true }, stamp) | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -292,3 +292,3 @@ | ||
} | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -338,3 +338,3 @@ } | ||
if (!hub.url) { | ||
$1213768903.create({ | ||
$278721121.create({ | ||
on: { | ||
@@ -358,3 +358,3 @@ data: { | ||
} | ||
}, stamp, $1213768903.struct, hub, key) | ||
}, stamp, $278721121.struct, hub, key) | ||
} | ||
@@ -395,3 +395,3 @@ hub.url.set(val, stamp) | ||
const $48594293_contextStruct = $1213768903.struct.create({ | ||
const $48594293_contextStruct = $278721121.struct.create({ | ||
props: { | ||
@@ -429,3 +429,3 @@ default: { | ||
if (!hub.context) { | ||
$1213768903.create(val, stamp, $48594293_contextStruct, hub, key) | ||
$278721121.create(val, stamp, $48594293_contextStruct, hub, key) | ||
} else { | ||
@@ -454,9 +454,10 @@ $48594293_removeClients(hub, stamp) | ||
subscribe (subs, cb, raw, tree) { | ||
if (!raw) subs = $1213768903.parse(subs) | ||
if (!raw) subs = $278721121.parse(subs) | ||
if (!this.receiveOnly) { | ||
const parsed = $2711378567(this, subs) | ||
if (parsed) { | ||
const key = $1851648559(JSON.stringify(parsed)) | ||
const key = $257117234(JSON.stringify(parsed)) | ||
if (!this.upstreamSubscriptions) { | ||
this.upstreamSubscriptions = { [key]: parsed } | ||
this.upstreamSubscriptions = {} | ||
this.upstreamSubscriptions[key] = parsed | ||
if (this.url) $4125568599_meta(this) | ||
@@ -469,3 +470,3 @@ } else if (!this.upstreamSubscriptions[key]) { | ||
} | ||
return $1213768903.subscribe(this, subs, cb || $48594293_stub, tree) | ||
return $278721121.subscribe(this, subs, cb || $48594293_stub, tree) | ||
} | ||
@@ -483,4 +484,39 @@ } | ||
} | ||
// FILE: uws | ||
const $193432948 = require('uws') | ||
// FILE: /Users/youzi/dev/hub.js/src/context.js | ||
const $25049122 = { | ||
props: { | ||
contextKey: true, | ||
getContext: (t, fn) => { | ||
t.set({ | ||
define: { | ||
getContext (key, socket) { | ||
return fn(key, (key) => $25049122_createContext(this, key), this, socket) | ||
} | ||
} | ||
}) | ||
} | ||
}, | ||
getContext: (key, context) => context() | ||
} | ||
const $25049122_createContext = (hub, val) => { | ||
var result = $25049122_find(hub, val) | ||
if (!result) { | ||
result = hub.create({ contextKey: val }, false) | ||
} | ||
return result | ||
} | ||
const $25049122_find = (hub, val) => { | ||
const instances = hub.instances | ||
if (instances) { | ||
let i = instances.length | ||
while (i--) { | ||
if (instances[i].contextKey === val) return instances[i] | ||
} | ||
} | ||
} | ||
// FILE: /Users/youzi/dev/hub.js/node_modules/uws/uws.js | ||
const $911301798 = require('uws') | ||
// FILE: /Users/youzi/dev/hub.js/src/subscription/parse.js | ||
@@ -567,7 +603,7 @@ const $3742651364_isFn = /^\$fn\|/ | ||
if (!client.cache) client.cache = {} | ||
client.cache[$1213768903.puid(struct)] = stamp | ||
client.cache[$278721121.puid(struct)] = stamp | ||
} | ||
const $3904796091_isCached = (client, struct, stamp) => client.cache && | ||
client.cache[$1213768903.puid(struct)] === stamp | ||
client.cache[$278721121.puid(struct)] === stamp | ||
@@ -597,3 +633,3 @@ // const isCached = () => false | ||
client.inProgress = {} | ||
$932573643.on(() => { | ||
$3040487635.on(() => { | ||
if (client.val !== null) { | ||
@@ -635,3 +671,3 @@ if (!$1622386187_isEmpty(client.inProgress)) { | ||
// think of something fast for level... | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, prop, $1213768903.get(hub, 'serverIndex'), true) | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, prop, $278721121.get(hub, 'serverIndex'), true) | ||
} | ||
@@ -643,3 +679,3 @@ prop = previous | ||
} | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, struct, $1213768903.get(hub, 'serverIndex'), isRemoved) | ||
$1622386187_serialize(client, $1622386187_progress(client), subs, struct, $278721121.get(hub, 'serverIndex'), isRemoved) | ||
} | ||
@@ -649,4 +685,4 @@ } | ||
const $1622386187_serialize = (client, t, subs, struct, level, isRemoved) => { | ||
const stamp = $1213768903.get(struct, 'stamp') || 1 // remove the need for this default (feels wrong) | ||
const val = isRemoved ? null : $1213768903.getVal(struct) | ||
const stamp = $278721121.get(struct, 'stamp') || 1 // remove the need for this default (feels wrong) | ||
const val = isRemoved ? null : $278721121.getVal(struct) | ||
@@ -674,4 +710,4 @@ if (val !== void 0 && stamp && !$3904796091_isCached(client, struct, stamp)) { | ||
if (subs.type) { | ||
const type = $1213768903.get(struct, 'type') // make getType (fast) | ||
if ($1213768903.getVal(type) !== 'hub') { | ||
const type = $278721121.get(struct, 'type') // make getType (fast) | ||
if ($278721121.getVal(type) !== 'hub') { | ||
$1622386187_serialize(client, t, subs.type, type, level) | ||
@@ -685,3 +721,3 @@ } | ||
if (val === 'hub') return | ||
$1622386187_serialize(client, t, subs, $1213768903.getType(struct.parent(2), val), level) | ||
$1622386187_serialize(client, t, subs, $278721121.getType(struct.parent(2), val), level) | ||
// allways need a stamp! | ||
@@ -704,3 +740,3 @@ } | ||
if (subs.val === true && !isRemoved) { | ||
$1622386187_deepSerialize($1213768903.getKeys(struct), client, t, subs, struct, level) | ||
$1622386187_deepSerialize($278721121.getKeys(struct), client, t, subs, struct, level) | ||
} | ||
@@ -715,3 +751,3 @@ } | ||
for (let i = 0, len = keys.length; i < len; i++) { | ||
let prop = $1213768903.get(struct, keys[i]) | ||
let prop = $278721121.get(struct, keys[i]) | ||
if (prop && prop.isHub) $1622386187_serialize(client, t, subs, prop, level) | ||
@@ -787,3 +823,3 @@ } | ||
$1353865041_incomingSubscriptions(t, client, meta, client.key) | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -795,3 +831,3 @@ } else { | ||
$1353865041_setPayload(client.parent(2), payload, client) | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -822,3 +858,3 @@ } | ||
const $1353865041_set = (meta, socket, t, payload) => { | ||
const stamp = $932573643.create() | ||
const stamp = $3040487635.create() | ||
const id = meta.id | ||
@@ -832,3 +868,3 @@ const context = meta.context | ||
if (meta.subscriptions) $1353865041_incomingSubscriptions(t, client, meta, id) | ||
$932573643.close() | ||
$3040487635.close() | ||
} | ||
@@ -860,3 +896,3 @@ | ||
client.upstreamSubscriptions[uid] = subs | ||
$1213768903.subscribe(hub, subs, update) | ||
$278721121.subscribe(hub, subs, update) | ||
hub.subscriptions[hub.subscriptions.length - 1]._uid_ = id | ||
@@ -890,3 +926,3 @@ } | ||
$2138030230_removedInProgress = [] | ||
$932573643.on(() => { | ||
$3040487635.on(() => { | ||
let i = $2138030230_removedInProgress.length | ||
@@ -917,3 +953,3 @@ while (i--) { | ||
const $3248609833_Server = $193432948.Server | ||
const $3248609833_Server = $911301798.Server | ||
@@ -993,3 +1029,3 @@ const $3248609833_createServer = (hub, port) => { | ||
if (!hub.port) { | ||
$1213768903.create({ | ||
$278721121.create({ | ||
on: { | ||
@@ -1009,3 +1045,3 @@ data: { | ||
} | ||
}, stamp, $1213768903.struct, hub, key) | ||
}, stamp, $278721121.struct, hub, key) | ||
} | ||
@@ -1023,43 +1059,5 @@ hub.port.set(val, stamp) | ||
const $3248609833 = { props: $3248609833_props, on: $2138030230 } | ||
const $3248609833_$ALL$ = { | ||
props: $3248609833_props, | ||
on: $2138030230 | ||
} | ||
// FILE: /Users/youzi/dev/hub.js/src/context.js | ||
const $25049122 = { | ||
props: { | ||
contextKey: true, | ||
getContext: (t, fn) => { | ||
t.set({ | ||
define: { | ||
getContext (key, socket) { | ||
return fn(key, (key) => $25049122_createContext(this, key), this, socket) | ||
} | ||
} | ||
}) | ||
} | ||
}, | ||
getContext: (key, context) => context() | ||
} | ||
const $25049122_createContext = (hub, val) => { | ||
var result = $25049122_find(hub, val) | ||
if (!result) { | ||
result = hub.create({ contextKey: val }, false) | ||
} | ||
return result | ||
} | ||
const $25049122_find = (hub, val) => { | ||
const instances = hub.instances | ||
if (instances) { | ||
let i = instances.length | ||
while (i--) { | ||
if (instances[i].contextKey === val) return instances[i] | ||
} | ||
} | ||
} | ||
// FILE: /Users/youzi/dev/hub.js/src/hub.js | ||
@@ -1071,5 +1069,5 @@ | ||
const $302300578_types = $1213768903.struct.props.types | ||
const $302300578_types = $278721121.struct.props.types | ||
const $302300578_hub = $1213768903.create({ | ||
const $302300578_hub = $278721121.create({ | ||
type: 'hub', | ||
@@ -1084,9 +1082,9 @@ instances: false, | ||
if (!t.clients) { | ||
t.clients = $1213768903.create(val, stamp, $302300578_clients, t, key) | ||
t.clients = $278721121.create(val, stamp, $302300578_clients, t, key) | ||
} else { | ||
$1213768903.set(t.clients, val, stamp) | ||
$278721121.set(t.clients, val, stamp) | ||
} | ||
}, | ||
types: $302300578_types.bind(), // to not interfere with struct type | ||
type: $1213768903.struct.props.type.bind(), | ||
type: $278721121.struct.props.type.bind(), | ||
client: true | ||
@@ -1102,7 +1100,7 @@ } | ||
$302300578_hub.set({ types: { hub: 'self' }, inject: [ $3248609833_$ALL$, $48594293_$ALL$, $25049122 ] }, false) | ||
$302300578_hub.set({ types: { hub: 'self' }, inject: [ $3248609833, $48594293_$ALL$, $25049122 ] }, false) | ||
$302300578_hub.types._ks = void 0 | ||
const $302300578_clients = $1213768903.create({ | ||
const $302300578_clients = $278721121.create({ | ||
props: { | ||
@@ -1109,0 +1107,0 @@ default: $302300578_hub.create({ |
{ | ||
"name": "hub.js", | ||
"description": "Seamless realtime communcation", | ||
"version": "0.0.11-706ea0d9873b37fd502fdddb30467f4fbd42c34d", | ||
"version": "0.0.11-7d2e1c177f16a9e89d7f54b1ed225552f132cece", | ||
"main": "dist/index.js", | ||
@@ -42,3 +42,3 @@ "browser": { | ||
"brisky-stamp": "^4.0.0", | ||
"brisky-struct": "feature-builder-boy", | ||
"brisky-struct": "feature-enhancements", | ||
"string-hash": "^1.1.0", | ||
@@ -45,0 +45,0 @@ "uws": "0.12.0", |
Sorry, the diff of this file is not supported yet
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
515379
14
6828
3
+ Addedbrisky-struct@1.1.7-b279c9343194043e5d005a7946bae1f4cdf5f2bc(transitive)
- Removedbrisky-struct@1.1.7-59333b32c30878c06af5b10ba5e0dd8640d2bf9e(transitive)