Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hub.js

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hub.js - npm Package Compare versions

Comparing version 0.0.11-56a16229a5f5f7943db0ee0fcada5e37692fb0fc to 0.0.11-706ea0d9873b37fd502fdddb30467f4fbd42c34d

dist/index.browser.js

192

dist/index.js
const $2563227135 = require('brisky-struct/dist/index.js')
const $3040487635 = require('brisky-stamp/dist/index.js')
// FILE: brisky-struct
const $1213768903 = require('brisky-struct')
// FILE: brisky-stamp
const $932573643 = require('brisky-stamp')
// FILE: /Users/youzi/dev/hub.js/src/client/send.js

@@ -56,3 +59,3 @@

if (!hub.receiveOnly) {
const store = $4125568599_inProgress(hub, $3040487635.inProgress ? $3040487635.on : $4125568599_next)
const store = $4125568599_inProgress(hub, $932573643.inProgress ? $932573643.on : $4125568599_next)
if (!store[1]) store[1] = {}

@@ -90,3 +93,3 @@ if (hub.context) {

}
$4125568599_serialize(hub, $4125568599_inProgress(hub, $3040487635.on), struct, val, hub.urlIndex)
$4125568599_serialize(hub, $4125568599_inProgress(hub, $932573643.on), struct, val, hub.urlIndex)
}

@@ -114,10 +117,11 @@ }

const $4125568599_export_meta = $4125568599_meta
const $4125568599_export_send = $4125568599_send
const $4125568599_$ALL$ = {
meta: $4125568599_export_meta,
send: $4125568599_export_send
meta: $4125568599_meta,
send: $4125568599_send
}
const $4020852141 = require('websocket/index.js')
// FILE: websocket
const $3096720 = require('websocket')
// FILE: /Users/youzi/dev/hub.js/src/client/websocket/index.js
// import WebSocket from 'uws'

@@ -127,4 +131,5 @@ // export default WebSocket

const $2878564687 = $4020852141.w3cwebsocket
const $2878564687 = $3096720.w3cwebsocket
// FILE: /Users/youzi/dev/hub.js/src/subscription/serialize.js
const $2711378567_isEmpty = t => {

@@ -206,8 +211,12 @@ for (let i in t) { return false }

const $257117234 = require('string-hash/index.js')
const $1190737809 = require('vigour-ua/index.js')
// FILE: string-hash
const $1851648559 = require('string-hash')
// FILE: vigour-ua
const $1888714796 = require('vigour-ua')
// FILE: /Users/youzi/dev/hub.js/src/client/uid/index.js
const $1123050690_uniq = process.pid
const $1123050690 = () => $257117234(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`)
const $1123050690 = () => $1851648559(`b-${Date.now()}-${(Math.random() * 10000) | 0}-${$1123050690_uniq}`)
// FILE: /Users/youzi/dev/hub.js/src/client/create.js

@@ -218,3 +227,3 @@

if (!id) id = t._uid_ || $1123050690()
$1190737809(useragent, val)
$1888714796(useragent, val)
t.set({ clients: { [id]: val } }, stamp)

@@ -224,2 +233,3 @@ return t.clients[id]

// FILE: /Users/youzi/dev/hub.js/src/client/index.js

@@ -243,6 +253,6 @@

const close = () => {
const stamp = $3040487635.create()
const stamp = $932573643.create()
hub.socket = false
hub.set({ connected: false }, stamp)
$3040487635.close()
$932573643.close()
if (!socket.blockReconnect && hub._url_) {

@@ -265,7 +275,7 @@ reconnect = Math.min((reconnect * 1.5), 2000)

socket.onopen = () => {
const stamp = $3040487635.create()
const stamp = $932573643.create()
hub.socket = socket
$4125568599_export_meta(hub)
$4125568599_meta(hub)
hub.set({ connected: true }, stamp)
$3040487635.close()
$932573643.close()
}

@@ -283,3 +293,3 @@

}
$3040487635.close()
$932573643.close()
}

@@ -329,3 +339,3 @@ }

if (!hub.url) {
$2563227135.create({
$1213768903.create({
on: {

@@ -349,3 +359,3 @@ data: {

}
}, stamp, $2563227135.struct, hub, key)
}, stamp, $1213768903.struct, hub, key)
}

@@ -386,3 +396,3 @@ hub.url.set(val, stamp)

const $48594293_contextStruct = $2563227135.struct.create({
const $48594293_contextStruct = $1213768903.struct.create({
props: {

@@ -420,3 +430,3 @@ default: {

if (!hub.context) {
$2563227135.create(val, stamp, $48594293_contextStruct, hub, key)
$1213768903.create(val, stamp, $48594293_contextStruct, hub, key)
} else {

@@ -426,3 +436,3 @@ $48594293_removeClients(hub, stamp)

}
if (hub.connected && hub.connected.compute() === true) $4125568599_export_meta(hub)
if (hub.connected && hub.connected.compute() === true) $4125568599_meta(hub)
}

@@ -446,32 +456,32 @@ }

subscribe (subs, cb, raw, tree) {
if (!raw) subs = $2563227135.parse(subs)
if (!raw) subs = $1213768903.parse(subs)
if (!this.receiveOnly) {
const parsed = $2711378567(this, subs)
if (parsed) {
const key = $257117234(JSON.stringify(parsed))
const key = $1851648559(JSON.stringify(parsed))
if (!this.upstreamSubscriptions) {
this.upstreamSubscriptions = { [key]: parsed }
if (this.url) $4125568599_export_meta(this)
if (this.url) $4125568599_meta(this)
} else if (!this.upstreamSubscriptions[key]) {
this.upstreamSubscriptions[key] = parsed
if (this.url) $4125568599_export_meta(this)
if (this.url) $4125568599_meta(this)
}
}
}
return $2563227135.subscribe(this, subs, cb || $48594293_stub, tree)
return $1213768903.subscribe(this, subs, cb || $48594293_stub, tree)
}
}
const $48594293_on = { data: { send: $4125568599_export_send } }
const $48594293_on = { data: { send: $4125568599_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
props: $48594293_props,
on: $48594293_on,
define: $48594293_define
}
const $911301798 = require('uws/uws.js')
// FILE: uws
const $193432948 = require('uws')
// FILE: /Users/youzi/dev/hub.js/src/subscription/parse.js
const $3742651364_isFn = /^\$fn\|/

@@ -552,2 +562,3 @@ const $3742651364_dummy = () => false

// FILE: /Users/youzi/dev/hub.js/src/server/cache.js

@@ -557,17 +568,17 @@

if (!client.cache) client.cache = {}
client.cache[$2563227135.puid(struct)] = stamp
client.cache[$1213768903.puid(struct)] = stamp
}
const $3904796091_isCached = (client, struct, stamp) => client.cache &&
client.cache[$2563227135.puid(struct)] === stamp
client.cache[$1213768903.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
cache: $3904796091_cache,
isCached: $3904796091_isCached
}
// FILE: /Users/youzi/dev/hub.js/src/server/send.js

@@ -587,3 +598,3 @@

client.inProgress = {}
$3040487635.on(() => {
$932573643.on(() => {
if (client.val !== null) {

@@ -625,3 +636,3 @@ if (!$1622386187_isEmpty(client.inProgress)) {

// think of something fast for level...
$1622386187_serialize(client, $1622386187_progress(client), subs, prop, $2563227135.get(hub, 'serverIndex'), true)
$1622386187_serialize(client, $1622386187_progress(client), subs, prop, $1213768903.get(hub, 'serverIndex'), true)
}

@@ -633,3 +644,3 @@ prop = previous

}
$1622386187_serialize(client, $1622386187_progress(client), subs, struct, $2563227135.get(hub, 'serverIndex'), isRemoved)
$1622386187_serialize(client, $1622386187_progress(client), subs, struct, $1213768903.get(hub, 'serverIndex'), isRemoved)
}

@@ -639,6 +650,6 @@ }

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 stamp = $1213768903.get(struct, 'stamp') || 1 // remove the need for this default (feels wrong)
const val = isRemoved ? null : $1213768903.getVal(struct)
if (val !== void 0 && stamp && !$3904796091_export_isCached(client, struct, stamp)) {
if (val !== void 0 && stamp && !$3904796091_isCached(client, struct, stamp)) {
// val === null -- double chck if this is nessecary

@@ -659,3 +670,3 @@ const path = struct.path()

if (isRemoved) {
$3904796091_export_cache(client, struct, stamp)
$3904796091_cache(client, struct, stamp)
s.stamp = stamp

@@ -665,4 +676,4 @@ s.val = val

if (subs.type) {
const type = $2563227135.get(struct, 'type') // make getType (fast)
if ($2563227135.getVal(type) !== 'hub') {
const type = $1213768903.get(struct, 'type') // make getType (fast)
if ($1213768903.getVal(type) !== 'hub') {
$1622386187_serialize(client, t, subs.type, type, level)

@@ -672,7 +683,7 @@ }

$3904796091_export_cache(client, struct, stamp)
$3904796091_cache(client, struct, stamp)
s.stamp = stamp
if (struct.key === 'type') {
if (val === 'hub') return
$1622386187_serialize(client, t, subs, $2563227135.getType(struct.parent(2), val), level)
$1622386187_serialize(client, t, subs, $1213768903.getType(struct.parent(2), val), level)
// allways need a stamp!

@@ -695,3 +706,3 @@ }

if (subs.val === true && !isRemoved) {
$1622386187_deepSerialize($2563227135.getKeys(struct), client, t, subs, struct, level)
$1622386187_deepSerialize($1213768903.getKeys(struct), client, t, subs, struct, level)
}

@@ -706,3 +717,3 @@ }

for (let i = 0, len = keys.length; i < len; i++) {
let prop = $2563227135.get(struct, keys[i])
let prop = $1213768903.get(struct, keys[i])
if (prop && prop.isHub) $1622386187_serialize(client, t, subs, prop, level)

@@ -721,2 +732,3 @@ }

// FILE: /Users/youzi/dev/hub.js/src/server/remove.js
const $2931540049_removeSubscriptions = (t, id) => {

@@ -748,9 +760,9 @@ if (t.subscriptions) {

const $2931540049_export_removeSubscriptions = $2931540049_removeSubscriptions
const $2931540049_export_removeClient = $2931540049_removeClient
const $2931540049_$ALL$ = {
removeSubscriptions: $2931540049_export_removeSubscriptions,
removeClient: $2931540049_export_removeClient
removeSubscriptions: $2931540049_removeSubscriptions,
removeClient: $2931540049_removeClient
}
// FILE: /Users/youzi/dev/hub.js/src/server/incoming.js

@@ -774,3 +786,3 @@

if ('context' in meta && client.context != meta.context) { // eslint-disable-line
$2931540049_export_removeClient(client)
$2931540049_removeClient(client)
$1353865041_create(hub, socket, meta, payload)

@@ -780,3 +792,3 @@ } else if (meta.subscriptions) {

$1353865041_incomingSubscriptions(t, client, meta, client.key)
$3040487635.close()
$932573643.close()
}

@@ -788,3 +800,3 @@ } else {

$1353865041_setPayload(client.parent(2), payload, client)
$3040487635.close()
$932573643.close()
}

@@ -804,3 +816,3 @@ }

if (payload.val !== void 0 && payload.stamp) {
$3904796091_export_cache(client, hub, payload.stamp)
$3904796091_cache(client, hub, payload.stamp)
}

@@ -816,3 +828,3 @@ }

const $1353865041_set = (meta, socket, t, payload) => {
const stamp = $3040487635.create()
const stamp = $932573643.create()
const id = meta.id

@@ -826,3 +838,3 @@ const context = meta.context

if (meta.subscriptions) $1353865041_incomingSubscriptions(t, client, meta, id)
$3040487635.close()
$932573643.close()
}

@@ -854,3 +866,3 @@

client.upstreamSubscriptions[uid] = subs
$2563227135.subscribe(hub, subs, update)
$1213768903.subscribe(hub, subs, update)
hub.subscriptions[hub.subscriptions.length - 1]._uid_ = id

@@ -861,2 +873,3 @@ }

// FILE: /Users/youzi/dev/hub.js/src/server/on.js

@@ -884,3 +897,3 @@

$2138030230_removedInProgress = []
$3040487635.on(() => {
$932573643.on(() => {
let i = $2138030230_removedInProgress.length

@@ -904,2 +917,3 @@ while (i--) {

// FILE: /Users/youzi/dev/hub.js/src/server/index.js

@@ -911,3 +925,3 @@

const $3248609833_Server = $911301798.Server
const $3248609833_Server = $193432948.Server

@@ -927,3 +941,3 @@ const $3248609833_createServer = (hub, port) => {

const close = () => {
if (socket.client) $2931540049_export_removeClient(socket.client)
if (socket.client) $2931540049_removeClient(socket.client)
}

@@ -957,3 +971,3 @@

client.val = null
$2931540049_export_removeSubscriptions(hub, client.key)
$2931540049_removeSubscriptions(hub, client.key)
client.socket.close()

@@ -989,3 +1003,3 @@ }

if (!hub.port) {
$2563227135.create({
$1213768903.create({
on: {

@@ -1005,3 +1019,3 @@ data: {

}
}, stamp, $2563227135.struct, hub, key)
}, stamp, $1213768903.struct, hub, key)
}

@@ -1019,9 +1033,9 @@ hub.port.set(val, stamp)

const $3248609833_export_props = $3248609833_props
const $3248609833_export_on = $2138030230
const $3248609833_$ALL$ = {
props: $3248609833_export_props,
on: $3248609833_export_on
props: $3248609833_props,
on: $2138030230
}
// FILE: /Users/youzi/dev/hub.js/src/context.js
const $25049122 = {

@@ -1061,2 +1075,3 @@ props: {

// FILE: /Users/youzi/dev/hub.js/src/hub.js

@@ -1067,10 +1082,5 @@

if (typeof window === 'undefined') {
// dont do this gets added to client...
require('source-map-support').install()
}
const $302300578_types = $1213768903.struct.props.types
const $302300578_types = $2563227135.struct.props.types
const $302300578_hub = $2563227135.create({
const $302300578_hub = $1213768903.create({
type: 'hub',

@@ -1085,9 +1095,9 @@ instances: false,

if (!t.clients) {
t.clients = $2563227135.create(val, stamp, $302300578_clients, t, key)
t.clients = $1213768903.create(val, stamp, $302300578_clients, t, key)
} else {
$2563227135.set(t.clients, val, stamp)
$1213768903.set(t.clients, val, stamp)
}
},
types: $302300578_types.bind(), // to not interfere with struct type
type: $2563227135.struct.props.type.bind(),
type: $1213768903.struct.props.type.bind(),
client: true

@@ -1107,3 +1117,3 @@ }

const $302300578_clients = $2563227135.create({
const $302300578_clients = $1213768903.create({
props: {

@@ -1124,3 +1134,7 @@ default: $302300578_hub.create({

// FILE: /Users/youzi/dev/hub.js/src/index.js
if (typeof __filename !== 'undefined') console.log('hub.js:', __filename)
const $621652771_fn = (val, stamp) => $302300578.create(val, stamp)

@@ -1127,0 +1141,0 @@ const $621652771 = $621652771_fn

{
"name": "hub.js",
"description": "Seamless realtime communcation",
"version": "0.0.11-56a16229a5f5f7943db0ee0fcada5e37692fb0fc",
"version": "0.0.11-706ea0d9873b37fd502fdddb30467f4fbd42c34d",
"main": "dist/index.js",
"browser": {
"./dist/index.js": "./dist/browser.js",
"./dist/index.es.js": "./dist/browser.es.js",
"./dist/index.js": "./dist/index.browser.js",
"./src/client/uid/index.js": "./src/client/uid/browser.js",

@@ -18,4 +17,3 @@ "./src/server/index.js": "./src/server/browser.js",

"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",

@@ -45,3 +43,3 @@ "test": "node test/index.js",

"brisky-stamp": "^4.0.0",
"brisky-struct": "unstable",
"brisky-struct": "feature-builder-boy",
"string-hash": "^1.1.0",

@@ -67,3 +65,2 @@ "uws": "0.12.0",

"rollup-watch": "^2.5.0",
"source-map-support": "^0.4.7",
"standard": "^8.1.0",

@@ -70,0 +67,0 @@ "tape": "4.6.0"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc