Skip to content

Commit

Permalink
update b-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim de Beer committed Jan 15, 2017
1 parent 0b76d8a commit b2d0867
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const connect = (hub, url, reconnect) => {

socket.onmessage = ({ data }) => {
const stamp = bs.create('upstream')
// console.log(JSON.stringify(JSON.parse(data), false, 2))
console.log(JSON.stringify(JSON.parse(data), false, 2))
hub.set(JSON.parse(data), stamp)
bs.close(stamp)
}
Expand Down
2 changes: 2 additions & 0 deletions lib/hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ hub.props.types.struct.props.default.struct = hub.props.type.struct = hub

hub.set({ types: { hub: 'self' }, inject: [ server, context, client ] }, false)

hub.types._ks = void 0

const clients = create({
props: {
default: hub.create({
Expand Down
3 changes: 3 additions & 0 deletions lib/server/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const serialize = (id, client, t, subs, struct, val, level) => {

if (subs.val === true) {
const keys = getKeys(struct)
console.log(' go-->', struct.path(), keys)
if (keys) deepSerialize(keys, id, client, t, subs, struct, val, level)
}
}
Expand All @@ -147,13 +148,15 @@ const serialize = (id, client, t, subs, struct, val, level) => {
}

const typeSerialize = (id, client, t, subs, struct, val, level) => {
console.log('go go go', struct.compute(), subs)
serialize(id, client, t, subs, getType(struct.parent(2), struct.compute()), val, level)
}

const deepSerialize = (keys, id, client, t, subs, struct, val, level) => {
if (keys) {
for (let i = 0, len = keys.length; i < len; i++) {
let prop = get(struct, keys[i])
console.log(' ', keys[i], prop && prop.isHub)
if (prop && prop.isHub) serialize(id, client, t, subs, prop, val, level)
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
],
"dependencies": {
"brisky-stamp": "^3.0.12",
"brisky-struct": "^1.0.10",
"brisky-struct": "^1.1.2",
"string-hash": "^1.1.0",
"uws": "0.12.0",
"vigour-ua": "^2.2.3"
Expand Down
44 changes: 24 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ ansi-escapes@^1.1.0:
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"

ansi-regex@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"

ansi-styles@^2.2.1:
version "2.2.1"
Expand Down Expand Up @@ -272,17 +272,17 @@ braces@^1.8.2:
preserve "^0.2.0"
repeat-element "^1.1.2"

brisky-stamp@^3.0.11, brisky-stamp@^3.0.12:
brisky-stamp@^3.0.12:
version "3.0.12"
resolved "https://registry.yarnpkg.com/brisky-stamp/-/brisky-stamp-3.0.12.tgz#17f79e7ef367cfd55864d591f98bcf894cc74dee"
dependencies:
global "^4.3.1"

brisky-struct@^1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/brisky-struct/-/brisky-struct-1.0.10.tgz#4c3d5f727bf96f29651adbffb53c9e570bb1a561"
brisky-struct@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/brisky-struct/-/brisky-struct-1.1.2.tgz#ca2326f142633aca7ab7e3ca3ecf7f7d3685bf10"
dependencies:
brisky-stamp "^3.0.11"
brisky-stamp "^3.0.12"

browser-resolve@^1.11.0:
version "1.11.2"
Expand Down Expand Up @@ -1527,6 +1527,10 @@ js-tokens@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-2.0.0.tgz#79903f5563ee778cc1162e6dcf1a0027c97f9cb5"

js-tokens@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.0.tgz#a2f2a969caae142fb3cd56228358c89366957bd1"

js-yaml@^3.5.1, js-yaml@3.x:
version "3.7.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80"
Expand Down Expand Up @@ -1708,10 +1712,10 @@ longest@^1.0.1:
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

loose-envify@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8"
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^2.0.0"
js-tokens "^3.0.0"

lowercase-keys@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -1774,15 +1778,15 @@ micromatch@^2.1.5, micromatch@^2.3.11:
parse-glob "^3.0.4"
regex-cache "^0.4.2"

mime-db@~1.25.0:
version "1.25.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.25.0.tgz#c18dbd7c73a5dbf6f44a024dc0d165a1e7b1c392"
mime-db@~1.26.0:
version "1.26.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.26.0.tgz#eaffcd0e4fc6935cf8134da246e2e6c35305adff"

mime-types@^2.1.11, mime-types@^2.1.12, mime-types@~2.1.7:
version "2.1.13"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.13.tgz#e07aaa9c6c6b9a7ca3012c69003ad25a39e92a88"
version "2.1.14"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee"
dependencies:
mime-db "~1.25.0"
mime-db "~1.26.0"

min-document@^2.19.0:
version "2.19.0"
Expand Down Expand Up @@ -2526,8 +2530,8 @@ sntp@1.x.x:
hoek "2.x.x"

source-map-support@^0.4.0, source-map-support@^0.4.7:
version "0.4.8"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.8.tgz#4871918d8a3af07289182e974e32844327b2e98b"
version "0.4.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.9.tgz#45eaa04f067e049d987b27599ed014a37750aaff"
dependencies:
source-map "^0.5.3"

Expand Down Expand Up @@ -2590,8 +2594,8 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

sshpk@^1.7.0:
version "1.10.1"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.1.tgz#30e1a5d329244974a1af61511339d595af6638b0"
version "1.10.2"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.2.tgz#d5a804ce22695515638e798dbe23273de070a5fa"
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
Expand Down

0 comments on commit b2d0867

Please sign in to comment.