Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
5dab36382f | |||
02a32eb8c7 | |||
b258979b5a | |||
166e29bbf6 | |||
870f37d403 | |||
64c4b91678 | |||
f3e13292d8 | |||
7e1c405cb1 | |||
d1b4672eff | |||
0dd9fee52b | |||
37e1ee7970 | |||
bd0bb3acf5 | |||
f60497474e | |||
1d84cefa84 | |||
6792acd533 | |||
9397d89cf5 | |||
37cf4a91f4 | |||
52db86c929 | |||
e8f09c1b7a | |||
79edea873f | |||
97666a623d | |||
ef61ea9ad7 | |||
9c1504ef02 | |||
e8f2e04d1c | |||
e12aa7e961 | |||
857b7cd010 | |||
e100dea160 | |||
e8e87fcdba | |||
0d18b11721 | |||
eaaefddbe3 | |||
8c6946ddb6 | |||
3a7ebcdd80 |
@ -38,17 +38,17 @@ snyk:
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -100,7 +100,7 @@ trigger:
|
||||
pages:
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:18-dind
|
||||
- docker:stable-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
|
296
package-lock.json
generated
296
package-lock.json
generated
@ -1,18 +1,13 @@
|
||||
{
|
||||
"name": "@pushrocks/smartuniverse",
|
||||
"version": "1.0.59",
|
||||
"version": "1.0.75",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@airbnb/node-memwatch": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@airbnb%2fnode-memwatch/-/node-memwatch-1.0.2.tgz",
|
||||
"integrity": "sha512-2R+MEEMSTUdKwQ6NFWkyA/UNoSjL1tMldZqJbZpgXSwNMBzlNlkUWEXKu9RqTTMkDqJRfGJ2VDs8gPlPK2APDQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bindings": "^1.3.0",
|
||||
"nan": "^2.9.2"
|
||||
}
|
||||
"@apiglobal/typedrequest-interfaces": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.7.tgz",
|
||||
"integrity": "sha512-yPl0UcLFMwSQL7bK52wVjkgvadC+x2YS3+7T15V1A1dXNxa96yd4WX1fqcKqwnBrvYexq/8FaxWGi98tZ0oNwg=="
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.5.5",
|
||||
@ -35,9 +30,9 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tsbuild": {
|
||||
"version": "2.1.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.11.tgz",
|
||||
"integrity": "sha512-Sa90/S7rkfFaTa2yeASHVAWIl3hNh9DBqVcQbOCaNhqKUGdD+NzPw1MESuMOXqKG7oM5i4Cu6qfcJB0fmAjS8g==",
|
||||
"version": "2.1.17",
|
||||
"resolved": "https://registry.npmjs.org/@gitzone/tsbuild/-/tsbuild-2.1.17.tgz",
|
||||
"integrity": "sha512-Mg2cu7cW3cC6L2tzatB8t6OMVgTGatobb8UkN+y3n7KAWRld4gXcVWmaehch/wSFrbmk6Oe8rPjdWPjhTSIF1Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
@ -45,7 +40,15 @@
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpath": "^4.0.1",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"typescript": "^3.4.5"
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz",
|
||||
"integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@gitzone/tsrun": {
|
||||
@ -104,9 +107,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/lik": {
|
||||
"version": "3.0.10",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.10.tgz",
|
||||
"integrity": "sha512-iWG06QsrL6AAnjPRWMVz4bRaRE0jJt/HgEK0YeLqaSBLY8ju4ps1j4lEN8VrUlXGZyPB6UGQfcreesO24buYhQ==",
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/lik/-/lik-3.0.11.tgz",
|
||||
"integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
@ -175,9 +178,9 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartexpress": {
|
||||
"version": "3.0.38",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexpress/-/smartexpress-3.0.38.tgz",
|
||||
"integrity": "sha512-di26orVJwgBRGKVpYcPrauc14CVo0piAzXTBWFZZNUCuIsndnXepd9oDzMO+KHVZpNz3W4DxbtRkppZjrh9ejw==",
|
||||
"version": "3.0.40",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartexpress/-/smartexpress-3.0.40.tgz",
|
||||
"integrity": "sha512-biAquO44yvrZ/elC3psUbYYoeZn647HjZXyQ14WL5IcXMgnKBo5+qvkqNgDmcHSKJ9KuVnycuRWa8vg6z77GSg==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^3.0.10",
|
||||
"@pushrocks/smartfile": "^7.0.4",
|
||||
@ -292,9 +295,9 @@
|
||||
"integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ=="
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.16",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.16.tgz",
|
||||
"integrity": "sha512-3LbtqoqnjfzWSQ10NryhJmgwPpvMlVoYyTzE676+yC4hM2rnGSzxozLZxMr6enV4VeZcloQ0CqHBivKoT/kdvA==",
|
||||
"version": "1.1.27",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.27.tgz",
|
||||
"integrity": "sha512-GJO6duKBro2oILtXduVQwxA50AzjHZbKP0P32OoiM+B1ftoQFf4D8zSs/SCljNKXUqS8SZ9IMQVlKLfRC4nu+A==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/form-data": "^2.2.1",
|
||||
@ -302,20 +305,23 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrx": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.3.tgz",
|
||||
"integrity": "sha512-OWxagu+CBdPaq76AIg91hJyrNhDTlEpesj01ooWCeVIaLY3G7yvFkqHsEKNOwPUG1LzCWmjq1l1dHQx9p2vJ9A==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz",
|
||||
"integrity": "sha512-BOlIJmnCO8pxqu9f18D9UV5rIsyrmKeK/mWNMiAe/NH2OTeRPNLpgmhZBkXSKNVD8tSsD8aazs4BcACgYOg1FQ==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^3.0.2",
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartevent": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"rxjs": "^6.3.3"
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"rxjs": "^6.5.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
|
||||
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
|
||||
"rxjs": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.3.tgz",
|
||||
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -333,22 +339,38 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartsocket": {
|
||||
"version": "1.1.44",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.44.tgz",
|
||||
"integrity": "sha512-AxDEDQw96szewxiA7Vk+ak6l7tsf2MLIThAuoV53ycDkDNXMyJizqE8fnzks9+/OEukwwas9kYNT9MyqPIS1mw==",
|
||||
"version": "1.1.49",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.49.tgz",
|
||||
"integrity": "sha512-jDcqVU9/cXTkLBY2N3epPUBKtRRkFINzK//CRxmBcuZx/k0s5oeNM1tOI7aiP5p5arrybU/YksSQil1QKz24Gg==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^3.0.10",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.7",
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartexpress": "^3.0.38",
|
||||
"@pushrocks/smartexpress": "^3.0.40",
|
||||
"@pushrocks/smarthash": "^2.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/shortid": "0.0.29",
|
||||
"@types/socket.io": "^2.1.2",
|
||||
"@types/socket.io-client": "^1.4.32",
|
||||
"shortid": "^2.2.14",
|
||||
"shortid": "^2.2.15",
|
||||
"socket.io": "^2.2.0",
|
||||
"socket.io-client": "^2.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nanoid": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.0.tgz",
|
||||
"integrity": "sha512-g5WwS+p6Cm+zQhO2YOpRbQThZVnNb7DDq74h8YDCLfAGynrEOrbx2E16dc8ciENiP1va5sqaAruqn2sN+xpkWg=="
|
||||
},
|
||||
"shortid": {
|
||||
"version": "2.2.15",
|
||||
"resolved": "https://verdaccio.lossless.one/shortid/-/shortid-2.2.15.tgz",
|
||||
"integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==",
|
||||
"requires": {
|
||||
"nanoid": "^2.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@pushrocks/smarttime": {
|
||||
@ -375,46 +397,45 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/tapbundle": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.11.tgz",
|
||||
"integrity": "sha512-s7epZfJZX+LsBVmIYvoaY4WtgPvRLnHZMVTpQAPJGMBqxJAQxhQ2wvGJjmqMAGhhznAHI6t4g+m0KTp3vFIRVg==",
|
||||
"version": "3.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.13.tgz",
|
||||
"integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"leakage": "^0.4.0",
|
||||
"smartchai": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"@types/body-parser": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fbody-parser/-/body-parser-1.17.0.tgz",
|
||||
"integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==",
|
||||
"version": "1.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
|
||||
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
|
||||
"requires": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.1.7",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.1.7.tgz",
|
||||
"integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.0.tgz",
|
||||
"integrity": "sha512-zw8UvoBEImn392tLjxoavuonblX/4Yb9ha4KBU10FirCfwgzhKO0dvyJSF9ByxV1xK1r2AgnAi/tvQaLgxQqxA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-as-promised": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.0.tgz",
|
||||
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==",
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.2.tgz",
|
||||
"integrity": "sha512-PO2gcfR3Oxa+u0QvECLe1xKXOqYTzCmWf0FhLhjREoW3fPAVamjihL7v1MOVLJLsnAMdLcjkfrs01yvDMwVK4Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "*"
|
||||
}
|
||||
},
|
||||
"@types/chai-string": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai-string/-/chai-string-1.4.1.tgz",
|
||||
"integrity": "sha512-aRNMs6TKgjgPlCHwDfq/YNy5VtRR2hJ4AUWByddrT0TRVVD8eX4MiHW6/iHvmQHRlVuuPZcwnTUE7b4yFt7bEA==",
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai-string/-/chai-string-1.4.2.tgz",
|
||||
"integrity": "sha512-ld/1hV5qcPRGuwlPdvRfvM3Ka/iofOk2pH4VkasK4b1JJP1LjNmWWn0LsISf6RRzyhVOvs93rb9tM09e+UuF8Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chai": "*"
|
||||
@ -438,9 +459,9 @@
|
||||
}
|
||||
},
|
||||
"@types/express": {
|
||||
"version": "4.17.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fexpress/-/express-4.17.0.tgz",
|
||||
"integrity": "sha512-CjaMu57cjgjuZbh9DpkloeGxV45CnMGlVd+XpG7Gm9QgVrd7KFq+X4HY0vM+2v0bczS48Wg7bvnMY5TN+Xmcfw==",
|
||||
"version": "4.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.1.tgz",
|
||||
"integrity": "sha512-VfH/XCP0QbQk5B5puLqTLEeFgR8lfCJHZJKkInZ9mkYd+u8byX0kztXEQxEk4wZXJs8HI+7km2ALXjn4YKcX9w==",
|
||||
"requires": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "*",
|
||||
@ -448,9 +469,9 @@
|
||||
}
|
||||
},
|
||||
"@types/express-serve-static-core": {
|
||||
"version": "4.16.7",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fexpress-serve-static-core/-/express-serve-static-core-4.16.7.tgz",
|
||||
"integrity": "sha512-847KvL8Q1y3TtFLRTXcVakErLJQgdpFSaq+k043xefz9raEf0C7HalpSY7OW5PyjCnY8P7bPW5t/Co9qqp+USg==",
|
||||
"version": "4.16.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.9.tgz",
|
||||
"integrity": "sha512-GqpaVWR0DM8FnRUJYKlWgyARoBUAVfRIeVDZQKOttLFp5SmhhF9YFIYeTPwMd/AXfxlP7xVO2dj1fGu0Q+krKQ==",
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"@types/range-parser": "*"
|
||||
@ -518,9 +539,9 @@
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.7.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.1.tgz",
|
||||
"integrity": "sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw=="
|
||||
"version": "12.7.4",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.4.tgz",
|
||||
"integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ=="
|
||||
},
|
||||
"@types/range-parser": {
|
||||
"version": "1.2.3",
|
||||
@ -528,9 +549,9 @@
|
||||
"integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA=="
|
||||
},
|
||||
"@types/serve-static": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fserve-static/-/serve-static-1.13.2.tgz",
|
||||
"integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==",
|
||||
"version": "1.13.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz",
|
||||
"integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==",
|
||||
"requires": {
|
||||
"@types/express-serve-static-core": "*",
|
||||
"@types/mime": "*"
|
||||
@ -735,15 +756,6 @@
|
||||
"callsite": "1.0.0"
|
||||
}
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"blob": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/blob/-/blob-0.0.5.tgz",
|
||||
@ -766,6 +778,11 @@
|
||||
"type-is": "~1.6.17"
|
||||
}
|
||||
},
|
||||
"bowser": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.5.3.tgz",
|
||||
"integrity": "sha512-aWCA+CKfKNL/WGzNgjmK+Whp57JMzboZMwJ5gy2jDj2bEIjbMCb3ImGX+V++5wsJftyFiDIbOjRXl60ycniVqg=="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://verdaccio.lossless.one/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@ -1208,12 +1225,6 @@
|
||||
"has-binary2": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/es6-error/-/es6-error-4.1.1.tgz",
|
||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/escape-html/-/escape-html-1.0.3.tgz",
|
||||
@ -1231,9 +1242,9 @@
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.2.tgz",
|
||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"dev": true
|
||||
},
|
||||
"etag": {
|
||||
@ -1340,12 +1351,6 @@
|
||||
"escape-string-regexp": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||
"dev": true
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/finalhandler/-/finalhandler-1.1.2.tgz",
|
||||
@ -1383,9 +1388,9 @@
|
||||
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/form-data/-/form-data-2.5.0.tgz",
|
||||
"integrity": "sha512-WXieX3G/8side6VIqx44ablyULoGruSde5PNTxoUyo5CeyAMX6nVWUd0rgist/EuX655cjhUhTo1Fo3tRYqbcA==",
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
@ -1510,9 +1515,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"helmet": {
|
||||
"version": "3.20.0",
|
||||
"resolved": "https://verdaccio.lossless.one/helmet/-/helmet-3.20.0.tgz",
|
||||
"integrity": "sha512-Ob+TqmQFZ5f7WgP8kBbAzNPsbf6p1lOj5r+327/ymw/IILWih3wcx9u/u/S8Mwv5wbBkO7Li6x5s23t3COhUKw==",
|
||||
"version": "3.20.1",
|
||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-3.20.1.tgz",
|
||||
"integrity": "sha512-em+X5Wz/f0yqoRsBnpnVy3wJHSiIeskX3FQn30szBh1tILaOeSRRLkShuUVFlk/o4qTYjWxdHg4FrRe45iBWHg==",
|
||||
"requires": {
|
||||
"depd": "2.0.0",
|
||||
"dns-prefetch-control": "0.2.0",
|
||||
@ -1521,7 +1526,7 @@
|
||||
"feature-policy": "0.3.0",
|
||||
"frameguard": "3.1.0",
|
||||
"helmet-crossdomain": "0.4.0",
|
||||
"helmet-csp": "2.8.0",
|
||||
"helmet-csp": "2.9.0",
|
||||
"hide-powered-by": "1.1.0",
|
||||
"hpkp": "2.0.0",
|
||||
"hsts": "2.2.0",
|
||||
@ -1544,14 +1549,14 @@
|
||||
"integrity": "sha512-AB4DTykRw3HCOxovD1nPR16hllrVImeFp5VBV9/twj66lJ2nU75DP8FPL0/Jp4jj79JhTfG+pFI2MD02kWJ+fA=="
|
||||
},
|
||||
"helmet-csp": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://verdaccio.lossless.one/helmet-csp/-/helmet-csp-2.8.0.tgz",
|
||||
"integrity": "sha512-MlCPeM0Sm3pS9RACRihx70VeTHmkQwa7sum9EK1tfw1VZyvFU0dBWym9nHh3CRkTRNlyNm/WFCMvuh9zXkOjNw==",
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-2.9.0.tgz",
|
||||
"integrity": "sha512-DGGOQtOLM7ZQpjbf/uvUonq1yG/rFgsBuK10ZJt2AtxUJxqfkPvfmP9aLUmgH9IactiRiYoiFY72YYSPl1TLTQ==",
|
||||
"requires": {
|
||||
"bowser": "2.5.3",
|
||||
"camelize": "1.0.0",
|
||||
"content-security-policy-builder": "2.1.0",
|
||||
"dasherize": "2.0.0",
|
||||
"platform": "1.3.5"
|
||||
"dasherize": "2.0.0"
|
||||
}
|
||||
},
|
||||
"hide-powered-by": {
|
||||
@ -1751,25 +1756,6 @@
|
||||
"invert-kv": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"leakage": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://verdaccio.lossless.one/leakage/-/leakage-0.4.0.tgz",
|
||||
"integrity": "sha512-x7gYK5n5dPkHDZWJ2Kh8Ag1hZNzUh+HtXn8Bv1aDdN6o6ONPCJ8sOfFq+kxcULJFp3lXaCjXb3iXOLmQRbBLwA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@airbnb/node-memwatch": "^1.0.2",
|
||||
"es6-error": "^4.0.2",
|
||||
"left-pad": "^1.1.3",
|
||||
"minimist": "^1.2.0",
|
||||
"pretty-bytes": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"left-pad": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://verdaccio.lossless.one/left-pad/-/left-pad-1.3.0.tgz",
|
||||
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/locate-path/-/locate-path-3.0.0.tgz",
|
||||
@ -1962,9 +1948,9 @@
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
@ -1974,14 +1960,6 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
@ -2002,12 +1980,6 @@
|
||||
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.14.0",
|
||||
"resolved": "https://verdaccio.lossless.one/nan/-/nan-2.14.0.tgz",
|
||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
|
||||
"dev": true
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.0.1.tgz",
|
||||
@ -2153,9 +2125,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/p-limit/-/p-limit-2.2.0.tgz",
|
||||
"integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
|
||||
"integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
@ -2241,17 +2213,6 @@
|
||||
"resolved": "https://verdaccio.lossless.one/pify/-/pify-2.3.0.tgz",
|
||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
|
||||
},
|
||||
"platform": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://verdaccio.lossless.one/platform/-/platform-1.3.5.tgz",
|
||||
"integrity": "sha512-TuvHS8AOIZNAlE77WUDiR4rySV/VMptyMfcfeoMgs4P8apaZM3JrnbzBiixKUv+XR6i+BXrQh8WAnjaSPFO65Q=="
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
|
||||
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
|
||||
"dev": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
@ -2402,9 +2363,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.11.1.tgz",
|
||||
"integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==",
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz",
|
||||
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.6"
|
||||
@ -2424,6 +2385,7 @@
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.4.0.tgz",
|
||||
"integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
@ -2439,9 +2401,9 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://verdaccio.lossless.one/semver/-/semver-5.7.0.tgz",
|
||||
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"send": {
|
||||
@ -2811,16 +2773,16 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.18.0",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.18.0.tgz",
|
||||
"integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==",
|
||||
"version": "5.20.0",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.0.tgz",
|
||||
"integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"builtin-modules": "^1.1.1",
|
||||
"chalk": "^2.3.0",
|
||||
"commander": "^2.12.1",
|
||||
"diff": "^3.2.0",
|
||||
"diff": "^4.0.1",
|
||||
"glob": "^7.1.1",
|
||||
"js-yaml": "^3.13.1",
|
||||
"minimatch": "^3.0.4",
|
||||
@ -2829,14 +2791,6 @@
|
||||
"semver": "^5.3.0",
|
||||
"tslib": "^1.8.0",
|
||||
"tsutils": "^2.29.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"diff": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/diff/-/diff-3.5.0.tgz",
|
||||
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tslint-config-prettier": {
|
||||
|
21
package.json
21
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartuniverse",
|
||||
"version": "1.0.59",
|
||||
"version": "1.0.75",
|
||||
"private": false,
|
||||
"description": "messaging service for your micro services",
|
||||
"main": "dist/index.js",
|
||||
@ -14,26 +14,27 @@
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tstest": "^1.0.24",
|
||||
"@pushrocks/tapbundle": "^3.0.11",
|
||||
"@types/node": "^12.7.1",
|
||||
"tslint": "^5.18.0",
|
||||
"@pushrocks/tapbundle": "^3.0.13",
|
||||
"@types/node": "^12.7.4",
|
||||
"tslint": "^5.20.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rxjs": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.10",
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartexpress": "^3.0.38",
|
||||
"@pushrocks/smartexpress": "^3.0.40",
|
||||
"@pushrocks/smartfile": "^7.0.4",
|
||||
"@pushrocks/smarthash": "^2.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartrequest": "^1.1.16",
|
||||
"@pushrocks/smartrx": "^2.0.3",
|
||||
"@pushrocks/smartsocket": "^1.1.44",
|
||||
"@pushrocks/smartrequest": "^1.1.27",
|
||||
"@pushrocks/smartrx": "^2.0.5",
|
||||
"@pushrocks/smartsocket": "^1.1.49",
|
||||
"@pushrocks/smarttime": "^3.0.12",
|
||||
"@pushrocks/smartunique": "^3.0.1"
|
||||
},
|
||||
|
@ -50,6 +50,6 @@ All your microservices represents clients in the universe that may talk to each
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
12
test/test.ts
12
test/test.ts
@ -37,24 +37,24 @@ tap.test('create smartuniverse client', async () => {
|
||||
});
|
||||
|
||||
tap.test('should add a channel to the universe', async () => {
|
||||
await testUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass);
|
||||
testUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass);
|
||||
});
|
||||
|
||||
tap.test('should add the same channel to the client universe in the same way', async () => {
|
||||
await testClientUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass);
|
||||
testClientUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass);
|
||||
});
|
||||
|
||||
tap.test('should start the ClientUniverse', async () => {
|
||||
await testClientUniverse.start();
|
||||
})
|
||||
});
|
||||
|
||||
tap.test('should get a observable correctly', async () => {
|
||||
testClientChannel = await testClientUniverse.getChannel(testChannelData.channelName);
|
||||
testClientChannel = testClientUniverse.getChannel(testChannelData.channelName);
|
||||
expect(testClientChannel).to.be.instanceof(smartuniverse.ClientUniverseChannel);
|
||||
});
|
||||
|
||||
tap.test('should send a message correctly', async () => {
|
||||
await (await testClientUniverse.getChannel(testChannelData.channelName)).sendMessage({
|
||||
await testClientUniverse.getChannel(testChannelData.channelName).sendMessage({
|
||||
messageText: 'hello'
|
||||
});
|
||||
});
|
||||
@ -74,7 +74,7 @@ tap.test('a second client should be able to subscibe', async () => {
|
||||
tap.test('should receive a message correctly', async () => {});
|
||||
|
||||
tap.test('should disconnect the client correctly', async () => {
|
||||
testClientUniverse.stop();
|
||||
await testClientUniverse.stop();
|
||||
});
|
||||
|
||||
tap.test('should end the server correctly', async tools => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Client classes
|
||||
export * from './smartuniverse.classes.clientuniverse';
|
||||
export * from './smartuniverse.classes.clientuniversechannel';
|
||||
export * from './smartuniverse.classes.clientuniversemessage';
|
||||
|
||||
// Server classes
|
||||
export * from './smartuniverse.classes.universe';
|
||||
|
@ -1,4 +1,5 @@
|
||||
export * from './http.interfaces';
|
||||
export * from './socketfunctionrequests';
|
||||
export * from './universechannel.interfaces';
|
||||
export * from './universemessage.interfaces';
|
||||
export * from './universeactions.interfaces';
|
||||
|
20
ts/interfaces/socketfunctionrequests.ts
Normal file
20
ts/interfaces/socketfunctionrequests.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import * as interfaces from './index';
|
||||
|
||||
export interface ISocketRequest_SubscribeChannel {
|
||||
method: 'subscribeChannel';
|
||||
request: {
|
||||
name: string;
|
||||
passphrase: string;
|
||||
};
|
||||
response: {
|
||||
subscriptionStatus: 'subscribed' | 'unsubscribed'
|
||||
};
|
||||
}
|
||||
|
||||
export interface ISocketRequest_ProcessMessage {
|
||||
method: 'processMessage';
|
||||
request: interfaces.IUniverseMessage;
|
||||
response: {
|
||||
messageStatus: 'ok' | 'channel not found'
|
||||
};
|
||||
}
|
@ -4,13 +4,6 @@ export type IServerCallActions =
|
||||
| 'channelUnsubscribe'
|
||||
| 'terminateConnection';
|
||||
|
||||
/**
|
||||
* the interface for a subscription
|
||||
*/
|
||||
export interface IServerCallSubscribeActionPayload {
|
||||
name: string;
|
||||
passphrase: string;
|
||||
}
|
||||
|
||||
export interface IServerUnsubscribeActionPayload {
|
||||
name: string;
|
||||
|
@ -5,7 +5,7 @@ export interface IMessageCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* A universe
|
||||
*/
|
||||
export interface IUniverseMessage extends IMessageCreator {
|
||||
id: string;
|
||||
|
@ -7,7 +7,7 @@ import * as url from 'url';
|
||||
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
import { ClientUniverseChannel, UniverseMessage } from './';
|
||||
import { ClientUniverseChannel, ClientUniverseMessage } from './';
|
||||
import { ClientUniverseCache } from './smartuniverse.classes.clientuniversecache';
|
||||
|
||||
export interface IClientOptions {
|
||||
@ -21,7 +21,7 @@ export interface IClientOptions {
|
||||
export class ClientUniverse {
|
||||
public options;
|
||||
public smartsocketClient: plugins.smartsocket.SmartsocketClient;
|
||||
public observableIntake: plugins.smartrx.ObservableIntake<UniverseMessage>;
|
||||
public observableIntake: plugins.smartrx.ObservableIntake<ClientUniverseMessage>;
|
||||
public clientUniverseCache = new ClientUniverseCache();
|
||||
|
||||
constructor(optionsArg: IClientOptions) {
|
||||
@ -32,15 +32,20 @@ export class ClientUniverse {
|
||||
* adds a channel to the channelcache
|
||||
* TODO: verify channel before adding it to the channel cache
|
||||
*/
|
||||
public async addChannel(channelNameArg: string, passphraseArg: string) {
|
||||
const existingChannel = await this.getChannel(channelNameArg);
|
||||
public addChannel(channelNameArg: string, passphraseArg: string) {
|
||||
const existingChannel = this.getChannel(channelNameArg);
|
||||
|
||||
if (existingChannel) {
|
||||
throw new Error('channel exists');
|
||||
}
|
||||
|
||||
// lets create the channel
|
||||
await ClientUniverseChannel.createClientUniverseChannel(this, channelNameArg, passphraseArg);
|
||||
const clientUniverseChannel = ClientUniverseChannel.createClientUniverseChannel(
|
||||
this,
|
||||
channelNameArg,
|
||||
passphraseArg
|
||||
);
|
||||
return clientUniverseChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,7 +53,7 @@ export class ClientUniverse {
|
||||
* @param channelName
|
||||
* @param passphraseArg
|
||||
*/
|
||||
public async getChannel(channelName: string): Promise<ClientUniverseChannel> {
|
||||
public getChannel(channelName: string): ClientUniverseChannel {
|
||||
const clientUniverseChannel = this.clientUniverseCache.channelMap.find(channel => {
|
||||
return channel.name === channelName;
|
||||
});
|
||||
@ -60,17 +65,19 @@ export class ClientUniverse {
|
||||
* @param messageArg
|
||||
*/
|
||||
public removeChannel(channelNameArg, notifyServer = true) {
|
||||
const clientUniverseChannel = this.clientUniverseCache.channelMap.findOneAndRemove(channelItemArg => {
|
||||
return channelItemArg.name === channelNameArg;
|
||||
});
|
||||
const clientUniverseChannel = this.clientUniverseCache.channelMap.findOneAndRemove(
|
||||
channelItemArg => {
|
||||
return channelItemArg.name === channelNameArg;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public async start() {
|
||||
await this.checkConnection();
|
||||
}
|
||||
|
||||
public stop() {
|
||||
this.smartsocketClient.disconnect();
|
||||
public async stop() {
|
||||
await this.smartsocketClient.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,13 +88,12 @@ export class ClientUniverse {
|
||||
if (!this.smartsocketClient && !this.observableIntake) {
|
||||
const parsedURL = url.parse(this.options.serverAddress);
|
||||
const socketConfig: plugins.smartsocket.ISmartsocketClientOptions = {
|
||||
alias: process.env.SOCKET_ALIAS || 'someclient',
|
||||
alias: 'universeclient',
|
||||
password: 'UniverseClient',
|
||||
port: parseInt(parsedURL.port, 10),
|
||||
role: 'UniverseClient',
|
||||
url: parsedURL.protocol + '//' + parsedURL.hostname
|
||||
};
|
||||
console.log(socketConfig);
|
||||
this.smartsocketClient = new SmartsocketClient(socketConfig);
|
||||
this.observableIntake = new plugins.smartrx.ObservableIntake();
|
||||
|
||||
@ -107,11 +113,30 @@ export class ClientUniverse {
|
||||
/**
|
||||
* handles message reception
|
||||
*/
|
||||
const socketFunctionProcessMessage = new plugins.smartsocket.SocketFunction({
|
||||
const socketFunctionProcessMessage = new plugins.smartsocket.SocketFunction<
|
||||
interfaces.ISocketRequest_ProcessMessage
|
||||
>({
|
||||
funcName: 'processMessage',
|
||||
allowedRoles: [],
|
||||
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
|
||||
console.log('Got message from server');
|
||||
funcDef: async messageDescriptorArg => {
|
||||
plugins.smartlog.defaultLogger.log('info', 'Got message from server');
|
||||
const clientUniverseMessage = ClientUniverseMessage.createMessageFromMessageDescriptor(
|
||||
messageDescriptorArg
|
||||
);
|
||||
this.observableIntake.push(clientUniverseMessage);
|
||||
|
||||
// lets find the corresponding channel
|
||||
const targetChannel = this.getChannel(clientUniverseMessage.targetChannelName);
|
||||
if (targetChannel) {
|
||||
await targetChannel.emitMessageLocally(clientUniverseMessage);
|
||||
return {
|
||||
messageStatus: 'ok'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
messageStatus: 'channel not found'
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -120,7 +145,7 @@ export class ClientUniverse {
|
||||
this.smartsocketClient.addSocketFunction(socketFunctionProcessMessage);
|
||||
|
||||
await this.smartsocketClient.connect();
|
||||
console.log('universe client connected successfully');
|
||||
plugins.smartlog.defaultLogger.log('info', 'universe client connected successfully');
|
||||
await this.clientUniverseCache.channelMap.forEach(async clientUniverseChannelArg => {
|
||||
await clientUniverseChannelArg.subscribe();
|
||||
});
|
||||
|
@ -2,6 +2,9 @@ import * as plugins from './smartuniverse.plugins';
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
import { ClientUniverse } from './';
|
||||
import { ClientUniverseMessage } from './smartuniverse.classes.clientuniversemessage';
|
||||
import { ReactionRequest } from './smartuniverse.classes.reactionrequest';
|
||||
import { ReactionResponse } from './smartuniverse.classes.reactionresponse';
|
||||
|
||||
export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
// ======
|
||||
@ -13,11 +16,11 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
* @param channelNameArg
|
||||
* @param passphraseArg
|
||||
*/
|
||||
public static async createClientUniverseChannel(
|
||||
public static createClientUniverseChannel(
|
||||
clientUniverseArg: ClientUniverse,
|
||||
channelNameArg: string,
|
||||
passphraseArg: string
|
||||
): Promise<ClientUniverseChannel> {
|
||||
): ClientUniverseChannel {
|
||||
const clientChannel = new ClientUniverseChannel(
|
||||
clientUniverseArg,
|
||||
channelNameArg,
|
||||
@ -34,6 +37,8 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
// properties
|
||||
public name: string;
|
||||
public passphrase: string;
|
||||
public status: 'subscribed' | 'unsubscribed' = 'unsubscribed';
|
||||
private subject = new plugins.smartrx.rxjs.Subject<ClientUniverseMessage>();
|
||||
|
||||
// refs
|
||||
public clientUniverseRef: ClientUniverse;
|
||||
@ -48,13 +53,32 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
* subscribes to a channel
|
||||
* tells the universe about this instances interest into a channel
|
||||
*/
|
||||
public async subscribe() {
|
||||
const serverCallActionName: interfaces.IServerCallActions = 'channelSubscription';
|
||||
const serverCallActionPayload: interfaces.IServerCallSubscribeActionPayload = {
|
||||
name: this.name,
|
||||
passphrase: this.passphrase
|
||||
};
|
||||
await this.clientUniverseRef.smartsocketClient.serverCall(serverCallActionName, serverCallActionPayload);
|
||||
public async subscribe(observerArg?: plugins.smartrx.rxjs.Observer<any>) {
|
||||
// lets make sure the channel is connected
|
||||
if (this.status === 'unsubscribed') {
|
||||
const response = await this.clientUniverseRef.smartsocketClient.serverCall<interfaces.ISocketRequest_SubscribeChannel>(
|
||||
'subscribeChannel',
|
||||
{
|
||||
name: this.name,
|
||||
passphrase: this.passphrase
|
||||
}
|
||||
);
|
||||
this.status = response.subscriptionStatus;
|
||||
}
|
||||
|
||||
if (observerArg) {
|
||||
return this.subject.subscribe(observerArg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async emitMessageLocally(messageArg: ClientUniverseMessage) {
|
||||
this.subject.next(messageArg);
|
||||
}
|
||||
|
||||
public askForReaction(reactionRequest: ReactionRequest): ReactionResponse {
|
||||
const reactionResponse = new ReactionResponse();
|
||||
return reactionResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,6 +96,9 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
payload: messageArg.payload,
|
||||
payloadStringType: messageArg.payloadStringType
|
||||
};
|
||||
await this.clientUniverseRef.smartsocketClient.serverCall('processMessage', universeMessageToSend);
|
||||
await this.clientUniverseRef.smartsocketClient.serverCall(
|
||||
'processMessage',
|
||||
universeMessageToSend
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,10 @@ export class ClientUniverseMessage implements interfaces.IUniverseMessage {
|
||||
// ======
|
||||
// STATIC
|
||||
// ======
|
||||
public static createMessageFromPayload(messageDescriptor: interfaces.IUniverseMessage) {}
|
||||
public static createMessageFromMessageDescriptor(messageDescriptor: interfaces.IUniverseMessage) {
|
||||
const clientuniverseMessage = new ClientUniverseMessage(messageDescriptor);
|
||||
return clientuniverseMessage;
|
||||
}
|
||||
|
||||
// ========
|
||||
// INSTANCE
|
||||
@ -23,11 +26,14 @@ export class ClientUniverseMessage implements interfaces.IUniverseMessage {
|
||||
public payloadStringType;
|
||||
public targetChannelName: string;
|
||||
|
||||
constructor(messageArg: interfaces.IUniverseMessage, payloadArg) {
|
||||
constructor(messageArg: interfaces.IUniverseMessage) {
|
||||
for (const key of Object.keys(messageArg)) {
|
||||
this[key] = messageArg[key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets json for payload
|
||||
*/
|
||||
getAsJsonForPayload() {}
|
||||
}
|
||||
|
5
ts/smartuniverse.classes.reactionrequest.ts
Normal file
5
ts/smartuniverse.classes.reactionrequest.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import * as plugins from './smartuniverse.plugins';
|
||||
|
||||
export class ReactionRequest {
|
||||
|
||||
}
|
3
ts/smartuniverse.classes.reactionresponse.ts
Normal file
3
ts/smartuniverse.classes.reactionresponse.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import * as plugins from './smartuniverse.plugins';
|
||||
|
||||
export class ReactionResponse {}
|
@ -10,6 +10,7 @@ import { UniverseConnection } from './smartuniverse.classes.universeconnection';
|
||||
|
||||
export interface ISmartUniverseConstructorOptions {
|
||||
messageExpiryInMilliseconds: number;
|
||||
externalServer?: plugins.smartexpress.Server;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +60,7 @@ export class Universe {
|
||||
/**
|
||||
* adds a channel to the Universe
|
||||
*/
|
||||
public async addChannel(nameArg: string, passphraseArg: string) {
|
||||
public addChannel(nameArg: string, passphraseArg: string) {
|
||||
const newChannel = UniverseChannel.createChannel(this, nameArg, passphraseArg);
|
||||
}
|
||||
|
||||
@ -68,14 +69,19 @@ export class Universe {
|
||||
*/
|
||||
public async start(portArg: number) {
|
||||
// lets create the base smartexpress server
|
||||
this.smartexpressServer = new plugins.smartexpress.Server({
|
||||
cors: true,
|
||||
defaultAnswer: async () => {
|
||||
return `smartuniverse server ${this.getUniverseVersion()}`;
|
||||
},
|
||||
forceSsl: false,
|
||||
port: portArg
|
||||
});
|
||||
if (!this.options.externalServer) {
|
||||
this.smartexpressServer = new plugins.smartexpress.Server({
|
||||
cors: true,
|
||||
defaultAnswer: async () => {
|
||||
return `smartuniverse server ${this.getUniverseVersion()}`;
|
||||
},
|
||||
forceSsl: false,
|
||||
port: portArg
|
||||
});
|
||||
} else {
|
||||
console.log('Universe is using externally supplied server');
|
||||
this.smartexpressServer = this.options.externalServer;
|
||||
}
|
||||
|
||||
// add websocket upgrade
|
||||
this.smartsocket = new plugins.smartsocket.Smartsocket({});
|
||||
@ -89,24 +95,21 @@ export class Universe {
|
||||
// add the role to smartsocket
|
||||
this.smartsocket.addSocketRoles([ClientRole]);
|
||||
|
||||
const socketFunctionSubscription = new plugins.smartsocket.SocketFunction({
|
||||
const socketFunctionSubscription = new plugins.smartsocket.SocketFunction<interfaces.ISocketRequest_SubscribeChannel>({
|
||||
allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level
|
||||
funcName: 'channelSubscription',
|
||||
funcName: 'subscribeChannel',
|
||||
funcDef: async (
|
||||
dataArg: interfaces.IServerCallSubscribeActionPayload,
|
||||
dataArg,
|
||||
socketConnectionArg
|
||||
) => {
|
||||
// run in "this context" of this class
|
||||
await (async () => {
|
||||
const universeConnection = new UniverseConnection({
|
||||
socketConnection: socketConnectionArg,
|
||||
authenticationRequests: [dataArg]
|
||||
});
|
||||
await UniverseConnection.addConnectionToCache(this, universeConnection);
|
||||
return {
|
||||
'subscription status': 'success'
|
||||
};
|
||||
})();
|
||||
const universeConnection = new UniverseConnection({
|
||||
socketConnection: socketConnectionArg,
|
||||
authenticationRequests: [dataArg]
|
||||
});
|
||||
await UniverseConnection.addConnectionToCache(this, universeConnection);
|
||||
return {
|
||||
subscriptionStatus: 'subscribed'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@ -114,29 +117,36 @@ export class Universe {
|
||||
allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level
|
||||
funcName: 'processMessage',
|
||||
funcDef: async (dataArg: interfaces.IUniverseMessage, socketConnectionArg) => {
|
||||
// run in "this" context of this class
|
||||
await (async () => {
|
||||
const universeConnection = UniverseConnection.findUniverseConnectionBySocketConnection(
|
||||
this.universeCache,
|
||||
socketConnectionArg
|
||||
const universeConnection = UniverseConnection.findUniverseConnectionBySocketConnection(
|
||||
this.universeCache,
|
||||
socketConnectionArg
|
||||
);
|
||||
if (universeConnection) {
|
||||
plugins.smartlog.defaultLogger.log(
|
||||
'ok',
|
||||
'found UniverseConnection for socket for incoming message'
|
||||
);
|
||||
if (universeConnection) {
|
||||
console.log('found UniverseConnection for socket');
|
||||
} else {
|
||||
return {
|
||||
error: 'You need to authenticate for a channel'
|
||||
};
|
||||
}
|
||||
const unauthenticatedMessage = UniverseMessage.createMessageFromPayload(socketConnectionArg, dataArg);
|
||||
const foundChannel = await UniverseChannel.authorizeAMessageForAChannel(
|
||||
this.universeCache,
|
||||
unauthenticatedMessage
|
||||
} else {
|
||||
plugins.smartlog.defaultLogger.log(
|
||||
'warn',
|
||||
'found no Authorized channel for incoming message'
|
||||
);
|
||||
if (foundChannel && unauthenticatedMessage.authenticated) {
|
||||
const authenticatedMessage = unauthenticatedMessage;
|
||||
await this.universeCache.addMessage(authenticatedMessage);
|
||||
}
|
||||
})();
|
||||
return {
|
||||
error: 'You need to authenticate for a channel'
|
||||
};
|
||||
}
|
||||
const unauthenticatedMessage = UniverseMessage.createMessageFromPayload(
|
||||
socketConnectionArg,
|
||||
dataArg
|
||||
);
|
||||
const foundChannel = await UniverseChannel.authorizeAMessageForAChannel(
|
||||
this.universeCache,
|
||||
unauthenticatedMessage
|
||||
);
|
||||
if (foundChannel && unauthenticatedMessage.authenticated) {
|
||||
const authenticatedMessage = unauthenticatedMessage;
|
||||
await this.universeCache.addMessage(authenticatedMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -144,12 +154,15 @@ export class Universe {
|
||||
this.smartsocket.addSocketFunction(socketFunctionSubscription);
|
||||
this.smartsocket.addSocketFunction(socketFunctionProcessMessage);
|
||||
|
||||
// start the server
|
||||
if (!this.options.externalServer) {
|
||||
await this.smartexpressServer.start();
|
||||
}
|
||||
|
||||
// add smartsocket to the running smartexpress app
|
||||
this.smartsocket.setExternalServer('smartexpress', this.smartexpressServer as any);
|
||||
// start everything
|
||||
await this.smartexpressServer.start();
|
||||
await this.smartsocket.setExternalServer('smartexpress', this.smartexpressServer);
|
||||
await this.smartsocket.start();
|
||||
console.log('started universe');
|
||||
plugins.smartlog.defaultLogger.log('success', 'started universe');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,6 +170,8 @@ export class Universe {
|
||||
*/
|
||||
public async stopServer() {
|
||||
await this.smartsocket.stop();
|
||||
await this.smartexpressServer.stop();
|
||||
if (!this.options.externalServer) {
|
||||
await this.smartexpressServer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ export class UniverseCache {
|
||||
UniverseChannel.authorizeAMessageForAChannel(this, messageArg);
|
||||
this.messageMap.add(messageArg);
|
||||
messageArg.universeChannelList.forEach(universeChannel => {
|
||||
universeChannel.pushToClients(messageArg);
|
||||
universeChannel.push(messageArg);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ export class UniverseChannel {
|
||||
if (foundChannel) {
|
||||
universeMessageArg.authenticated = true;
|
||||
universeMessageArg.universeChannelList.add(foundChannel);
|
||||
console.log('message authorized');
|
||||
plugins.smartlog.defaultLogger.log('ok', 'message authorized');
|
||||
return foundChannel;
|
||||
} else {
|
||||
universeMessageArg.authenticated = false;
|
||||
universeMessageArg.universeChannelList.add(universeCacheArg.blackListChannel);
|
||||
console.log('message not valid');
|
||||
plugins.smartlog.defaultLogger.log('warn', 'message not valid');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -85,6 +85,7 @@ export class UniverseChannel {
|
||||
*/
|
||||
public name: string;
|
||||
public universeRef: Universe;
|
||||
private subject = new plugins.smartrx.rxjs.Subject<UniverseMessage>();
|
||||
|
||||
/**
|
||||
* the passphrase for the channel
|
||||
@ -113,7 +114,8 @@ export class UniverseChannel {
|
||||
* pushes a message to clients
|
||||
* @param messageArg
|
||||
*/
|
||||
public async pushToClients(messageArg: UniverseMessage) {
|
||||
public async push(messageArg: UniverseMessage) {
|
||||
this.subject.next(messageArg);
|
||||
const universeConnectionsWithChannelAccess: UniverseConnection[] = [];
|
||||
this.universeRef.universeCache.connectionMap.forEach(async socketConnection => {
|
||||
if (socketConnection.authenticatedChannels.includes(this)) {
|
||||
@ -121,7 +123,8 @@ export class UniverseChannel {
|
||||
}
|
||||
});
|
||||
for (const universeConnection of universeConnectionsWithChannelAccess) {
|
||||
const smartsocket = universeConnection.socketConnection.smartsocketRef as plugins.smartsocket.Smartsocket;
|
||||
const smartsocket = universeConnection.socketConnection
|
||||
.smartsocketRef as plugins.smartsocket.Smartsocket;
|
||||
const universeMessageToSend: interfaces.IUniverseMessage = {
|
||||
id: messageArg.id,
|
||||
timestamp: messageArg.timestamp,
|
||||
@ -131,7 +134,32 @@ export class UniverseChannel {
|
||||
payload: messageArg.payload,
|
||||
payloadStringType: messageArg.payloadStringType
|
||||
};
|
||||
smartsocket.clientCall('processMessage', universeMessageToSend, universeConnection.socketConnection);
|
||||
smartsocket.clientCall(
|
||||
'processMessage',
|
||||
universeMessageToSend,
|
||||
universeConnection.socketConnection
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// functions to interact with a channel locally
|
||||
public async subscribe(observer: plugins.smartrx.rxjs.Observer<any>) {
|
||||
return this.subject.subscribe(observer);
|
||||
}
|
||||
|
||||
/**
|
||||
* sends a message to the channel
|
||||
*/
|
||||
public async sendMessage(messageDescriptor: interfaces.IMessageCreator) {
|
||||
const messageToSend = new UniverseMessage({
|
||||
id: plugins.smartunique.shortId(),
|
||||
messageText: messageDescriptor.messageText,
|
||||
payload: messageDescriptor.payload,
|
||||
payloadStringType: messageDescriptor.payloadStringType,
|
||||
targetChannelName: this.name,
|
||||
passphrase: this.passphrase,
|
||||
timestamp: Date.now()
|
||||
});
|
||||
this.push(messageToSend);
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,10 @@ export class UniverseConnection {
|
||||
universeConnectionArg: UniverseConnection
|
||||
): Promise<UniverseConnection> {
|
||||
for (const authenticationRequest of universeConnectionArg.authenticationRequests) {
|
||||
// TODO: authenticate channel subscriptions
|
||||
const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(universeRef, authenticationRequest.name);
|
||||
const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(
|
||||
universeRef,
|
||||
authenticationRequest.name
|
||||
);
|
||||
if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) {
|
||||
universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst);
|
||||
}
|
||||
@ -74,7 +76,6 @@ export class UniverseConnection {
|
||||
connectionArg1: UniverseConnection,
|
||||
connectionArg2: UniverseConnection
|
||||
) {
|
||||
// TODO: merge connections
|
||||
return connectionArg1;
|
||||
}
|
||||
|
||||
@ -97,7 +98,7 @@ export class UniverseConnection {
|
||||
* the socketClient to ping
|
||||
*/
|
||||
public socketConnection: plugins.smartsocket.SocketConnection;
|
||||
public authenticationRequests: interfaces.IServerCallSubscribeActionPayload[] = [];
|
||||
public authenticationRequests: Array<interfaces.ISocketRequest_SubscribeChannel['request']> = [];
|
||||
public subscribedChannels: UniverseChannel[] = [];
|
||||
public authenticatedChannels: UniverseChannel[] = [];
|
||||
public failedToJoinChannels: UniverseChannel[] = [];
|
||||
@ -112,7 +113,7 @@ export class UniverseConnection {
|
||||
|
||||
constructor(optionsArg: {
|
||||
socketConnection: plugins.smartsocket.SocketConnection;
|
||||
authenticationRequests: interfaces.IServerCallSubscribeActionPayload[];
|
||||
authenticationRequests: Array<interfaces.ISocketRequest_SubscribeChannel['request']>;
|
||||
}) {
|
||||
this.authenticationRequests = optionsArg.authenticationRequests;
|
||||
this.socketConnection = optionsArg.socketConnection;
|
||||
|
@ -14,7 +14,10 @@ import { SocketConnection } from '@pushrocks/smartsocket';
|
||||
* acts as a container to save message states like authentication status
|
||||
*/
|
||||
export class UniverseMessage implements interfaces.IUniverseMessage {
|
||||
public static createMessageFromPayload(socketConnectionArg: SocketConnection, dataArg: interfaces.IUniverseMessage) {
|
||||
public static createMessageFromPayload(
|
||||
socketConnectionArg: SocketConnection,
|
||||
dataArg: interfaces.IUniverseMessage
|
||||
) {
|
||||
const universeMessageInstance = new UniverseMessage(dataArg);
|
||||
universeMessageInstance.socketConnection = socketConnectionArg;
|
||||
return universeMessageInstance;
|
||||
@ -69,9 +72,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage {
|
||||
this.universeCache = universeCacheArg;
|
||||
}
|
||||
|
||||
public setTargetChannel() {
|
||||
|
||||
}
|
||||
public setTargetChannel() {}
|
||||
|
||||
public setDestructionTimer(selfdestructAfterArg: number) {
|
||||
if (selfdestructAfterArg) {
|
||||
@ -91,7 +92,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage {
|
||||
* handles bad messages for further analysis
|
||||
*/
|
||||
public handleAsBadMessage() {
|
||||
console.log('received a bad message');
|
||||
plugins.smartlog.defaultLogger.log('warn', 'received a bad message');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ import * as smarthash from '@pushrocks/smarthash';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartexpress from '@pushrocks/smartexpress';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
import * as smartrx from '@pushrocks/smartrx';
|
||||
@ -22,6 +23,7 @@ export {
|
||||
smartdelay,
|
||||
smartexpress,
|
||||
smartfile,
|
||||
smartlog,
|
||||
smartpromise,
|
||||
smartrx,
|
||||
smartrequest,
|
||||
|
Reference in New Issue
Block a user