Compare commits

..

6 Commits

Author SHA1 Message Date
29c0c8dc23 1.0.46 2019-04-28 12:42:09 +02:00
8157f2a56b fix(core): update 2019-04-28 12:42:08 +02:00
2f528d1812 1.0.45 2019-04-24 23:27:58 +02:00
139c71a451 fix(core): update 2019-04-24 23:27:57 +02:00
4678e44d16 1.0.44 2019-04-24 18:20:32 +02:00
af9f590349 fix(core): update 2019-04-24 18:20:31 +02:00
13 changed files with 346 additions and 156 deletions

315
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartuniverse", "name": "@pushrocks/smartuniverse",
"version": "1.0.43", "version": "1.0.46",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -196,48 +196,25 @@
} }
}, },
"@pushrocks/smartexpress": { "@pushrocks/smartexpress": {
"version": "3.0.18", "version": "3.0.19",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.18.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.19.tgz",
"integrity": "sha512-iunVt5aZ+h7gH67Sys+XKFojVXMseOfMNMw9+6Ofvbdkj/S0VEpm4BIafeNsNsbNcWlT0JYBQO9ylWp9Hh6nmQ==", "integrity": "sha512-3dN43yy2wRcj36w0sX0h6z1Xg9cxXiw84Ohn9QulFVWZeiCwHmBC15uSAVBMBCd1e87aDfEL9wzrRii+0PcwAA==",
"requires": { "requires": {
"@pushrocks/lik": "^3.0.4", "@pushrocks/lik": "^3.0.5",
"@pushrocks/smartfile": "^6.0.11", "@pushrocks/smartfile": "^7.0.2",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.14", "@pushrocks/smartrequest": "^1.1.15",
"@types/express": "^4.16.0", "@types/express": "^4.16.1",
"@types/finalhandler": "0.0.33", "@types/finalhandler": "^1.1.0",
"@types/helmet": "0.0.42", "@types/helmet": "0.0.43",
"@types/serve-static": "^1.13.2", "@types/serve-static": "^1.13.2",
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.16.4", "express": "^4.16.4",
"express-force-ssl": "^0.3.2", "express-force-ssl": "^0.3.2",
"helmet": "^3.15.0", "helmet": "^3.16.0",
"rendertron-middleware": "^0.1.5", "rendertron-middleware": "^0.1.5",
"sitemap": "^2.1.0" "sitemap": "^2.1.0"
},
"dependencies": {
"@pushrocks/smartfile": {
"version": "6.0.12",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-6.0.12.tgz",
"integrity": "sha512-89abBQgZ/90YWTjVD2ZMkgO4Em4XM0xLf1wPBG4s1yVCdwBSrVX/Eg1EvHyNEk7lbule0NoBmCAvHcIb95FRXQ==",
"requires": {
"@pushrocks/smartpath": "^4.0.1",
"@pushrocks/smartpromise": "^2.0.5",
"@pushrocks/smartrequest": "^1.1.14",
"@types/fs-extra": "^5.0.4",
"@types/vinyl": "^2.0.2",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"js-yaml": "^3.12.1",
"vinyl-file": "^3.0.0"
}
},
"@pushrocks/smartpromise": {
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
}
} }
}, },
"@pushrocks/smartfile": { "@pushrocks/smartfile": {
@ -363,28 +340,22 @@
} }
}, },
"@pushrocks/smartsocket": { "@pushrocks/smartsocket": {
"version": "1.1.27", "version": "1.1.35",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.27.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.35.tgz",
"integrity": "sha512-rxHWOoGTbDyRi+LQRTFe1kgnlik8uPDjRpz60U49yQU7mexGbeK6HPevgaiQH6wsmorrN64KMWCnwCrPAFQDXA==", "integrity": "sha512-+w76ksJvQA4FBVIIyVBTef4y38PeXZNnXy/EBy4OQ0pepsgMs9gYcWLFpU4g4WY5yVcQ8vNTNU/rM/osHG4OJA==",
"requires": { "requires": {
"@pushrocks/lik": "^3.0.4", "@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.2", "@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartexpress": "^3.0.19",
"@pushrocks/smarthash": "^2.0.4", "@pushrocks/smarthash": "^2.0.4",
"@pushrocks/smartlog": "^2.0.16", "@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^3.0.2",
"@types/shortid": "0.0.29", "@types/shortid": "0.0.29",
"@types/socket.io": "^2.1.2", "@types/socket.io": "^2.1.2",
"@types/socket.io-client": "^1.4.32", "@types/socket.io-client": "^1.4.32",
"shortid": "^2.2.14", "shortid": "^2.2.14",
"socket.io": "^2.2.0", "socket.io": "^2.2.0",
"socket.io-client": "^2.2.0" "socket.io-client": "^2.2.0"
},
"dependencies": {
"@pushrocks/smartpromise": {
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
}
} }
}, },
"@pushrocks/smarttime": { "@pushrocks/smarttime": {
@ -484,9 +455,9 @@
} }
}, },
"@types/express-serve-static-core": { "@types/express-serve-static-core": {
"version": "4.16.2", "version": "4.16.3",
"resolved": "https://verdaccio.lossless.one/@types%2fexpress-serve-static-core/-/express-serve-static-core-4.16.2.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fexpress-serve-static-core/-/express-serve-static-core-4.16.3.tgz",
"integrity": "sha512-qgc8tjnDrc789rAQed8NoiFLV5VGcItA4yWNFphqGU0RcuuQngD00g3LHhWIK3HQ2XeDgVCmlNPDlqi3fWBHnQ==", "integrity": "sha512-HFgBmRDTvdnrRFXqBr2NM2NUCu6fIpzJsUTlRVENF8lxvstof7cl9Fxfwq5S0kJbO/FsPVcjlxpOM3ZxIkn7Rw==",
"requires": { "requires": {
"@types/node": "*", "@types/node": "*",
"@types/range-parser": "*" "@types/range-parser": "*"
@ -499,9 +470,9 @@
"dev": true "dev": true
}, },
"@types/finalhandler": { "@types/finalhandler": {
"version": "0.0.33", "version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/@types%2ffinalhandler/-/finalhandler-0.0.33.tgz", "resolved": "https://verdaccio.lossless.one/@types%2ffinalhandler/-/finalhandler-1.1.0.tgz",
"integrity": "sha512-nV2BixeE7zsjupfRymHLzmBaiXVKVtLELNJhD+MA3EWxSc9Gm68NhpY+quigOlkOpUoDTu8hZWs58yRFgUM5gw==", "integrity": "sha512-iMD07b+UPNuqA6cm3yjbTJUfFfZNZpDc6MGQGK60jy5sdqX1W4wUC5RAi3FhaW72+RmVnzYxba8byPP9FWL8/w==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
@ -523,9 +494,9 @@
} }
}, },
"@types/helmet": { "@types/helmet": {
"version": "0.0.42", "version": "0.0.43",
"resolved": "https://verdaccio.lossless.one/@types%2fhelmet/-/helmet-0.0.42.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fhelmet/-/helmet-0.0.43.tgz",
"integrity": "sha512-xQjlolRfr7LVa55sGnjtJGcV6/Hf7cfD1IuZo1Do+o3UobOoJJSLIbwkhd9tW18F1Kp4uB77T8TsJ2XKUDwp7g==", "integrity": "sha512-45cU1ZW3L6ZxPQzAB597nl7OfUr14ceUWaQRoiByGFAjZlCQRvaEFC4Vv84lLWsFCYVWLU+raz+bIHrVBNTdRw==",
"requires": { "requires": {
"@types/express": "*" "@types/express": "*"
} }
@ -546,9 +517,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
}, },
"@types/node": { "@types/node": {
"version": "11.13.6", "version": "11.13.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.6.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-11.13.7.tgz",
"integrity": "sha512-Xoo/EBzEe8HxTSwaZNLZjaW6M6tA/+GmD3/DZ6uo8qSaolE/9Oarko0oV1fVfrLqOz0tx0nXJB4rdD5c+vixLw==" "integrity": "sha512-suFHr6hcA9mp8vFrZTgrmqW2ZU3mbWsryQtQlY/QvwTISCw7nw/j+bCQPPohqmskhmqa5wLNuMHTTsc+xf1MQg=="
}, },
"@types/range-parser": { "@types/range-parser": {
"version": "1.2.3", "version": "1.2.3",
@ -778,20 +749,20 @@
"integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig=="
}, },
"body-parser": { "body-parser": {
"version": "1.18.3", "version": "1.19.0",
"resolved": "https://verdaccio.lossless.one/body-parser/-/body-parser-1.18.3.tgz", "resolved": "https://verdaccio.lossless.one/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.1.0",
"content-type": "~1.0.4", "content-type": "~1.0.4",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "~1.1.2",
"http-errors": "~1.6.3", "http-errors": "1.7.2",
"iconv-lite": "0.4.23", "iconv-lite": "0.4.24",
"on-finished": "~2.3.0", "on-finished": "~2.3.0",
"qs": "6.5.2", "qs": "6.7.0",
"raw-body": "2.3.3", "raw-body": "2.4.0",
"type-is": "~1.6.16" "type-is": "~1.6.17"
} }
}, },
"brace-expansion": { "brace-expansion": {
@ -811,14 +782,14 @@
}, },
"builtin-modules": { "builtin-modules": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "resolved": "https://verdaccio.lossless.one/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"dev": true "dev": true
}, },
"bytes": { "bytes": {
"version": "3.0.0", "version": "3.1.0",
"resolved": "https://verdaccio.lossless.one/bytes/-/bytes-3.0.0.tgz", "resolved": "https://verdaccio.lossless.one/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
}, },
"callsite": { "callsite": {
"version": "1.0.0", "version": "1.0.0",
@ -872,7 +843,7 @@
}, },
"chalk": { "chalk": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "resolved": "https://verdaccio.lossless.one/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -931,7 +902,7 @@
}, },
"color-convert": { "color-convert": {
"version": "1.9.3", "version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "resolved": "https://verdaccio.lossless.one/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -940,7 +911,7 @@
}, },
"color-name": { "color-name": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "resolved": "https://verdaccio.lossless.one/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true "dev": true
}, },
@ -954,7 +925,7 @@
}, },
"commander": { "commander": {
"version": "2.20.0", "version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"dev": true "dev": true
}, },
@ -1220,7 +1191,7 @@
}, },
"esutils": { "esutils": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true "dev": true
}, },
@ -1286,6 +1257,68 @@
"vary": "~1.1.2" "vary": "~1.1.2"
}, },
"dependencies": { "dependencies": {
"body-parser": {
"version": "1.18.3",
"resolved": "https://verdaccio.lossless.one/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
},
"http-errors": {
"version": "1.6.3",
"resolved": "https://verdaccio.lossless.one/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://verdaccio.lossless.one/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"qs": {
"version": "6.5.2",
"resolved": "https://verdaccio.lossless.one/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"raw-body": {
"version": "2.3.3",
"resolved": "https://verdaccio.lossless.one/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"unpipe": "1.0.0"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"statuses": { "statuses": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://verdaccio.lossless.one/statuses/-/statuses-1.4.0.tgz", "resolved": "https://verdaccio.lossless.one/statuses/-/statuses-1.4.0.tgz",
@ -1507,7 +1540,7 @@
}, },
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true "dev": true
}, },
@ -1582,14 +1615,15 @@
} }
}, },
"http-errors": { "http-errors": {
"version": "1.6.3", "version": "1.7.2",
"resolved": "https://verdaccio.lossless.one/http-errors/-/http-errors-1.6.3.tgz", "resolved": "https://verdaccio.lossless.one/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"requires": { "requires": {
"depd": "~1.1.2", "depd": "~1.1.2",
"inherits": "2.0.3", "inherits": "2.0.3",
"setprototypeof": "1.1.0", "setprototypeof": "1.1.1",
"statuses": ">= 1.4.0 < 2" "statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
} }
}, },
"http-signature": { "http-signature": {
@ -1603,9 +1637,9 @@
} }
}, },
"iconv-lite": { "iconv-lite": {
"version": "0.4.23", "version": "0.4.24",
"resolved": "https://verdaccio.lossless.one/iconv-lite/-/iconv-lite-0.4.23.tgz", "resolved": "https://verdaccio.lossless.one/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": { "requires": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": ">= 2.1.2 < 3"
} }
@ -1641,9 +1675,9 @@
"dev": true "dev": true
}, },
"ipaddr.js": { "ipaddr.js": {
"version": "1.8.0", "version": "1.9.0",
"resolved": "https://verdaccio.lossless.one/ipaddr.js/-/ipaddr.js-1.8.0.tgz", "resolved": "https://verdaccio.lossless.one/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
"integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "2.0.0", "version": "2.0.0",
@ -1946,7 +1980,7 @@
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://verdaccio.lossless.one/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1955,7 +1989,7 @@
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true "dev": true
} }
@ -2122,9 +2156,9 @@
} }
}, },
"parseurl": { "parseurl": {
"version": "1.3.2", "version": "1.3.3",
"resolved": "https://verdaccio.lossless.one/parseurl/-/parseurl-1.3.2.tgz", "resolved": "https://verdaccio.lossless.one/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
}, },
"path-exists": { "path-exists": {
"version": "3.0.0", "version": "3.0.0",
@ -2145,7 +2179,7 @@
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "resolved": "https://verdaccio.lossless.one/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true "dev": true
}, },
@ -2187,12 +2221,12 @@
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
}, },
"proxy-addr": { "proxy-addr": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/proxy-addr/-/proxy-addr-2.0.4.tgz", "resolved": "https://verdaccio.lossless.one/proxy-addr/-/proxy-addr-2.0.5.tgz",
"integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
"requires": { "requires": {
"forwarded": "~0.1.2", "forwarded": "~0.1.2",
"ipaddr.js": "1.8.0" "ipaddr.js": "1.9.0"
} }
}, },
"psl": { "psl": {
@ -2216,9 +2250,9 @@
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
}, },
"qs": { "qs": {
"version": "6.5.2", "version": "6.7.0",
"resolved": "https://verdaccio.lossless.one/qs/-/qs-6.5.2.tgz", "resolved": "https://verdaccio.lossless.one/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}, },
"range-parser": { "range-parser": {
"version": "1.2.0", "version": "1.2.0",
@ -2226,13 +2260,13 @@
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
}, },
"raw-body": { "raw-body": {
"version": "2.3.3", "version": "2.4.0",
"resolved": "https://verdaccio.lossless.one/raw-body/-/raw-body-2.3.3.tgz", "resolved": "https://verdaccio.lossless.one/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.1.0",
"http-errors": "1.6.3", "http-errors": "1.7.2",
"iconv-lite": "0.4.23", "iconv-lite": "0.4.24",
"unpipe": "1.0.0" "unpipe": "1.0.0"
} }
}, },
@ -2299,6 +2333,13 @@
"tough-cookie": "~2.4.3", "tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "https://verdaccio.lossless.one/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
}
} }
}, },
"require-directory": { "require-directory": {
@ -2315,7 +2356,7 @@
}, },
"resolve": { "resolve": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.10.0.tgz",
"integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2366,6 +2407,22 @@
"statuses": "~1.4.0" "statuses": "~1.4.0"
}, },
"dependencies": { "dependencies": {
"http-errors": {
"version": "1.6.3",
"resolved": "https://verdaccio.lossless.one/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"statuses": { "statuses": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://verdaccio.lossless.one/statuses/-/statuses-1.4.0.tgz", "resolved": "https://verdaccio.lossless.one/statuses/-/statuses-1.4.0.tgz",
@ -2391,9 +2448,9 @@
"dev": true "dev": true
}, },
"setprototypeof": { "setprototypeof": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://verdaccio.lossless.one/setprototypeof/-/setprototypeof-1.1.0.tgz", "resolved": "https://verdaccio.lossless.one/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
}, },
"shebang-command": { "shebang-command": {
"version": "1.2.0", "version": "1.2.0",
@ -2664,6 +2721,11 @@
"resolved": "https://verdaccio.lossless.one/to-array/-/to-array-0.1.4.tgz", "resolved": "https://verdaccio.lossless.one/to-array/-/to-array-0.1.4.tgz",
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
}, },
"toidentifier": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"tough-cookie": { "tough-cookie": {
"version": "2.4.3", "version": "2.4.3",
"resolved": "https://verdaccio.lossless.one/tough-cookie/-/tough-cookie-2.4.3.tgz", "resolved": "https://verdaccio.lossless.one/tough-cookie/-/tough-cookie-2.4.3.tgz",
@ -2727,7 +2789,7 @@
}, },
"tsutils": { "tsutils": {
"version": "2.29.0", "version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", "resolved": "https://verdaccio.lossless.one/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -2754,12 +2816,27 @@
"dev": true "dev": true
}, },
"type-is": { "type-is": {
"version": "1.6.16", "version": "1.6.18",
"resolved": "https://verdaccio.lossless.one/type-is/-/type-is-1.6.16.tgz", "resolved": "https://verdaccio.lossless.one/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": { "requires": {
"media-typer": "0.3.0", "media-typer": "0.3.0",
"mime-types": "~2.1.18" "mime-types": "~2.1.24"
},
"dependencies": {
"mime-db": {
"version": "1.40.0",
"resolved": "https://verdaccio.lossless.one/mime-db/-/mime-db-1.40.0.tgz",
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
},
"mime-types": {
"version": "2.1.24",
"resolved": "https://verdaccio.lossless.one/mime-types/-/mime-types-2.1.24.tgz",
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
"requires": {
"mime-db": "1.40.0"
}
}
} }
}, },
"typescript": { "typescript": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartuniverse", "name": "@pushrocks/smartuniverse",
"version": "1.0.43", "version": "1.0.46",
"private": false, "private": false,
"description": "messaging service for your micro services", "description": "messaging service for your micro services",
"main": "dist/index.js", "main": "dist/index.js",
@ -9,6 +9,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"testManual": "(tsrun test/test.ts)",
"build": "(tsbuild)", "build": "(tsbuild)",
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
@ -16,7 +17,7 @@
"@gitzone/tsbuild": "^2.1.8", "@gitzone/tsbuild": "^2.1.8",
"@gitzone/tstest": "^1.0.20", "@gitzone/tstest": "^1.0.20",
"@pushrocks/tapbundle": "^3.0.9", "@pushrocks/tapbundle": "^3.0.9",
"@types/node": "^11.13.6", "@types/node": "^11.13.7",
"tslint": "^5.16.0", "tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
@ -26,13 +27,13 @@
"dependencies": { "dependencies": {
"@pushrocks/lik": "^3.0.5", "@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.3", "@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartexpress": "^3.0.18", "@pushrocks/smartexpress": "^3.0.19",
"@pushrocks/smartfile": "^7.0.2", "@pushrocks/smartfile": "^7.0.2",
"@pushrocks/smarthash": "^2.0.4", "@pushrocks/smarthash": "^2.0.4",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.15", "@pushrocks/smartrequest": "^1.1.15",
"@pushrocks/smartrx": "^2.0.3", "@pushrocks/smartrx": "^2.0.3",
"@pushrocks/smartsocket": "^1.1.27", "@pushrocks/smartsocket": "^1.1.35",
"@pushrocks/smarttime": "^3.0.7", "@pushrocks/smarttime": "^3.0.7",
"@pushrocks/smartunique": "^3.0.1" "@pushrocks/smartunique": "^3.0.1"
} }

View File

@ -6,8 +6,13 @@ import { Observable } from 'rxjs';
let testUniverse: smartuniverse.Universe; let testUniverse: smartuniverse.Universe;
let testClientUniverse: smartuniverse.ClientUniverse; let testClientUniverse: smartuniverse.ClientUniverse;
let testClientUniverse2: smartuniverse.ClientUniverse;
let testClientChannel: smartuniverse.ClientUniverseChannel; let testClientChannel: smartuniverse.ClientUniverseChannel;
const testServerData = {
serverAddress: 'http://localhost:8765'
};
const testChannelData = { const testChannelData = {
channelName: 'awesomeTestChannel', channelName: 'awesomeTestChannel',
channelPass: 'awesomeChannelPAss' channelPass: 'awesomeChannelPAss'
@ -26,7 +31,7 @@ tap.test('add a message to the SmartUniverse', async () => {
// testing message handling // testing message handling
tap.test('create smartuniverse client', async () => { tap.test('create smartuniverse client', async () => {
testClientUniverse = new smartuniverse.ClientUniverse({ testClientUniverse = new smartuniverse.ClientUniverse({
serverAddress: 'http://localhost:8765' serverAddress: testServerData.serverAddress
}); });
expect(testClientUniverse).to.be.instanceof(smartuniverse.ClientUniverse); expect(testClientUniverse).to.be.instanceof(smartuniverse.ClientUniverse);
}); });
@ -51,6 +56,18 @@ tap.test('should send a message correctly', async () => {
}); });
}); });
tap.test('universe should contain the sent message', async () => {
expect(testUniverse.universeCache.messageMap.getArray()[0].messageText).to.equal('hello');
});
tap.test('a second client should be able to subscibe', async () => {
testClientUniverse2 = new smartuniverse.ClientUniverse({
serverAddress: testServerData.serverAddress
});
testClientUniverse2.addChannel(testChannelData.channelName, testChannelData.channelPass);
});
tap.test('should receive a message correctly', async () => {}); tap.test('should receive a message correctly', async () => {});
tap.test('should disconnect the client correctly', async () => { tap.test('should disconnect the client correctly', async () => {

View File

@ -1,3 +1,4 @@
export * from './http.interfaces'; export * from './http.interfaces';
export * from './universechannel.interfaces'; export * from './universechannel.interfaces';
export * from './universemessage.interfaces'; export * from './universemessage.interfaces';
export * from './universeactions.interfaces';

View File

@ -0,0 +1,13 @@
export type IServerCallActions = 'subscribe' | 'sendmessage' | 'unsubscribe';
/**
* the interface for a subscription
*/
export interface IServerCallSubscribeActionPayload {
name: string;
passphrase: string;
}
export interface IServerUnsubscribeActionPayload {
name: string;
}

View File

@ -8,6 +8,9 @@ import * as url from 'url';
import * as interfaces from './interfaces'; import * as interfaces from './interfaces';
import { ClientUniverseChannel, UniverseMessage } from './'; import { ClientUniverseChannel, UniverseMessage } from './';
import {
ClientUniverseCache
} from './smartuniverse.classes.clientuniversecache';
export interface IClientOptions { export interface IClientOptions {
serverAddress: string; serverAddress: string;
@ -19,10 +22,11 @@ export interface IClientOptions {
*/ */
export class ClientUniverse { export class ClientUniverse {
public options; public options;
public socketClient: plugins.smartsocket.SmartsocketClient; public smartsocketClient: plugins.smartsocket.SmartsocketClient;
public observableIntake: plugins.smartrx.ObservableIntake<UniverseMessage>; public observableIntake: plugins.smartrx.ObservableIntake<UniverseMessage>;
public channelCache = new Objectmap<ClientUniverseChannel>(); public channelStore = new Objectmap<ClientUniverseChannel>();
public clientUniverseCache = new ClientUniverseCache();
constructor(optionsArg: IClientOptions) { constructor(optionsArg: IClientOptions) {
this.options = optionsArg; this.options = optionsArg;
@ -50,32 +54,46 @@ export class ClientUniverse {
*/ */
public async getChannel(channelName: string): Promise<ClientUniverseChannel> { public async getChannel(channelName: string): Promise<ClientUniverseChannel> {
await this.checkConnection(); await this.checkConnection();
const clientUniverseChannel = this.channelCache.find(channel => { const clientUniverseChannel = this.channelStore.find(channel => {
return channel.name === channelName; return channel.name === channelName;
}); });
return clientUniverseChannel; return clientUniverseChannel;
} }
/**
* remove a a achannel
* @param messageArg
*/
public removeChannel(channelNameArg, notifyServer = true) {
const clientUniverseChannel = this.channelStore.findOneAndRemove(channelItemArg => {
return channelItemArg.name === channelNameArg;
});
}
/**
* sends a message towards the server
* @param messageArg
*/
public async sendMessage(messageArg: interfaces.IMessageCreator) { public async sendMessage(messageArg: interfaces.IMessageCreator) {
console.log('hello'); await this.checkConnection();
const requestBody: interfaces.IUniverseMessage = { const requestBody: interfaces.IUniverseMessage = {
id: plugins.smartunique.shortId(), id: plugins.smartunique.shortId(),
timestamp: Date.now(), timestamp: Date.now(),
passphrase: (await this.getChannel(messageArg.targetChannelName)).passphrase, passphrase: (await this.getChannel(messageArg.targetChannelName)).passphrase,
...messageArg ...messageArg
}; };
const requestBodyString = JSON.stringify(requestBody);
// TODO: User websocket connection if available // TODO: User websocket connection if available
const response = await plugins.smartrequest.postJson( const response = await plugins.smartrequest.postJson(
`${this.options.serverAddress}/sendmessage`, `${this.options.serverAddress}/sendmessage`,
{ {
requestBody: requestBodyString requestBody
} }
); );
} }
public close() { public close() {
this.socketClient.disconnect(); this.smartsocketClient.disconnect();
} }
/** /**
@ -83,17 +101,42 @@ export class ClientUniverse {
* since password validation is done through other means, a connection should always be possible * since password validation is done through other means, a connection should always be possible
*/ */
private async checkConnection(): Promise<void> { private async checkConnection(): Promise<void> {
if (!this.socketClient && !this.observableIntake) { if (!this.smartsocketClient && !this.observableIntake) {
const parsedURL = url.parse(this.options.serverAddress); const parsedURL = url.parse(this.options.serverAddress);
this.socketClient = new SmartsocketClient({ const socketConfig: plugins.smartsocket.ISmartsocketClientOptions = {
alias: process.env.SOCKET_ALIAS || 'someclient', alias: process.env.SOCKET_ALIAS || 'someclient',
password: 'UniverseClient', password: 'UniverseClient',
port: parseInt(parsedURL.port, 10), port: parseInt(parsedURL.port, 10),
role: 'UniverseClient', role: 'UniverseClient',
url: parsedURL.hostname url: parsedURL.protocol + '//' + parsedURL.hostname
}); };
console.log(socketConfig);
this.smartsocketClient = new SmartsocketClient(socketConfig);
this.observableIntake = new plugins.smartrx.ObservableIntake(); this.observableIntake = new plugins.smartrx.ObservableIntake();
this.socketClient.connect();
// lets define some basic actions
/**
* should handle a forced unsubscription by the server
*/
const unsubscribe = new plugins.smartsocket.SocketFunction({
funcName: 'unsubscribe',
allowedRoles: [],
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
},
});
/**
* should handle a message reception
*/
const receiveMessage = async () => {
};
await this.smartsocketClient.connect();
} }
} }
} }

View File

@ -0,0 +1,8 @@
import * as plugins from './smartuniverse.plugins';
/**
* a cache for clients
*/
export class ClientUniverseCache {
}

View File

@ -23,7 +23,7 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
channelNameArg, channelNameArg,
passphraseArg passphraseArg
); );
clientUniverseArg.channelCache.add(clientChannel); clientUniverseArg.channelStore.add(clientChannel);
await clientChannel.subscribe(); await clientChannel.subscribe();
return clientChannel; return clientChannel;
} }
@ -50,6 +50,11 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
* tells the universe about this instances interest into a channel * tells the universe about this instances interest into a channel
*/ */
public async subscribe() { public async subscribe() {
this.clientUniverse.socketClient; const serverCallActionName: interfaces.IServerCallActions = 'subscribe';
const serverCallActionPayload: interfaces.IServerCallSubscribeActionPayload = {
name: this.name,
passphrase: this.passphrase
};
this.clientUniverse.smartsocketClient.serverCall(serverCallActionName, serverCallActionPayload);
} }
} }

View File

@ -1,6 +1,7 @@
import * as plugins from './smartuniverse.plugins'; import * as plugins from './smartuniverse.plugins';
import * as interfaces from './interfaces'; import * as interfaces from './interfaces';
import { IUniverseMessage } from './interfaces';
export class ClientUniverseMessage implements interfaces.IUniverseMessage { export class ClientUniverseMessage implements interfaces.IUniverseMessage {
// ====== // ======
@ -12,17 +13,22 @@ export class ClientUniverseMessage implements interfaces.IUniverseMessage {
// INSTANCE // INSTANCE
// ======== // ========
// properties
public id: string; public id: string;
public timestamp: number; public timestamp: number;
public smartTimestamp: plugins.smarttime.TimeStamp; public smartTimestamp: plugins.smarttime.TimeStamp;
public messageText: string; public messageText: string;
public passphrase: string; public passphrase: string;
public payload: any; public payload: any;
public payloadStringType; public payloadStringType;
public targetChannelName: string; public targetChannelName: string;
constructor(messageArg, payloadArg) {}
getAsJsonForPayload() {} constructor(messageArg: IUniverseMessage, payloadArg) {
for (const key of Object.keys(messageArg)) {
this[key] = messageArg[key];
}
}
getAsJsonForPayload() {};
} }

View File

@ -80,22 +80,21 @@ export class Universe {
this.smartexpressServer.addRoute( this.smartexpressServer.addRoute(
'/sendmessage', '/sendmessage',
new Handler('POST', async (req, res) => { new Handler('POST', async (req, res) => {
const universeMessageInstance = new UniverseMessage(req.body); const universeMessageInstance: UniverseMessage = new UniverseMessage(req.body);
this.universeCache.addMessage(universeMessageInstance); this.universeCache.addMessage(universeMessageInstance);
res.status(200); res.status(200);
res.end(); res.end();
}) })
); );
// add websocket upgrade // add websocket upgrade
this.smartsocket = new plugins.smartsocket.Smartsocket({ this.smartsocket = new plugins.smartsocket.Smartsocket({});
port: 12345 // fix this within smartsocket
});
// add a role for the clients // add a role for the clients
const ClientRole = new plugins.smartsocket.SocketRole({ const ClientRole = new plugins.smartsocket.SocketRole({
name: 'clientuniverse', name: 'UniverseClient',
passwordHash: 'clientuniverse' // authentication happens on another level passwordHash: plugins.smarthash.sha256FromStringSync('UniverseClient') // authentication happens on another level
}); });
// add the role to smartsocket // add the role to smartsocket
@ -105,18 +104,16 @@ export class Universe {
allowedRoles: [ClientRole], allowedRoles: [ClientRole],
funcName: 'channelSubscription', funcName: 'channelSubscription',
funcDef: () => { funcDef: () => {
console.log('a client connected');
} // TODO: implement an action upon connection of clients } // TODO: implement an action upon connection of clients
}); });
// add smartsocket to the running smartexpress app // add smartsocket to the running smartexpress app
this.smartsocket.setExternalServer('express', this.smartexpressServer as any); this.smartsocket.setExternalServer('smartexpress', this.smartexpressServer as any);
// start everything
// start the socket
this.smartsocket.start();
// start the smartexpress instance
await this.smartexpressServer.start(); await this.smartexpressServer.start();
await this.smartsocket.start();
console.log('started universe');
} }
/** /**

View File

@ -52,7 +52,7 @@ export class UniverseCache {
/** /**
* Read a message from the UniverseCache * Read a message from the UniverseCache
*/ */
public readMessagesYoungerThan(unixTimeArg?: number): Observable<UniverseMessage> { public readMessagesYoungerThan(unixTimeArg?: number, channelName?: string): Observable<UniverseMessage> {
const messageObservable = from(this.messageMap.getArray()).pipe( const messageObservable = from(this.messageMap.getArray()).pipe(
filter(messageArg => { filter(messageArg => {
return messageArg.smartTimestamp.isYoungerThanMilliSeconds(this.destructionTime); return messageArg.smartTimestamp.isYoungerThanMilliSeconds(this.destructionTime);

View File

@ -88,5 +88,7 @@ export class UniverseChannel {
); );
} }
public pushToClients(messageArg: UniverseMessage) {} public pushToClients(messageArg: UniverseMessage) {
}
} }

View File

@ -0,0 +1,20 @@
import * as plugins from './smartuniverse.plugins';
import { UniverseChannel } from './smartuniverse.classes.universechannel';
/**
* represents a subscription into a specific topic
*/
export class UniverseConnection {
/**
* the socketClient to ping
*/
socketclient: plugins.smartsocket.SmartsocketClient;
subscribedChannels: UniverseChannel[] = [];
authenticatedChannels: UniverseChannel[] = [];
constructor() {
}
}