From 972ddbf32711d8efe2aa1d53d84197def29581d9 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 7 Nov 2019 00:59:45 +0100 Subject: [PATCH] fix(core): update --- package-lock.json | 55 +++++++------------ package.json | 6 +- ts/smartuniverse.classes.universe.ts | 1 + ...martuniverse.classes.universeconnection.ts | 12 +++- 4 files changed, 33 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b5da02..9e3abf4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -353,9 +353,9 @@ } }, "@pushrocks/smartsocket": { - "version": "1.1.51", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.51.tgz", - "integrity": "sha512-oZXFOJsk9XJ9ZBxlcglpsIwuYGDuS9a/BLC2amOJ8bP0g+dWzTlOvlvSu9eiSaw/+gVc0i7jGQZPPDcZNqY8Iw==", + "version": "1.1.54", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.54.tgz", + "integrity": "sha512-3AFSNAamPWAmyyLdwN0errc7y0yZcREil69MtKoUbzJZWVMBWW03daiupc3BgMZDqqD82SqSlyStSh62OBUPnw==", "requires": { "@apiglobal/typedrequest-interfaces": "^1.0.7", "@pushrocks/lik": "^3.0.11", @@ -364,27 +364,12 @@ "@pushrocks/smarthash": "^2.0.6", "@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartpromise": "^3.0.6", - "@types/shortid": "0.0.29", + "@pushrocks/smartrx": "^2.0.5", + "@pushrocks/smartunique": "^3.0.1", "@types/socket.io": "^2.1.4", "@types/socket.io-client": "^1.4.32", - "shortid": "^2.2.15", "socket.io": "^2.3.0", "socket.io-client": "^2.3.0" - }, - "dependencies": { - "nanoid": { - "version": "2.1.6", - "resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.6.tgz", - "integrity": "sha512-2NDzpiuEy3+H0AVtdt8LoFi7PnqkOnIzYmJQp7xsEU6VexLluHQwKREuiz57XaQC5006seIadPrIZJhyS2n7aw==" - }, - "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": { @@ -553,9 +538,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "12.12.5", - "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.5.tgz", - "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==" + "version": "12.12.6", + "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.6.tgz", + "integrity": "sha512-FjsYUPzEJdGXjwKqSpE0/9QEh6kzhTAeObA54rn6j3rR4C/mzpI9L0KNfoeASSPMMdxIsoJuCLDWcM/rVjIsSA==" }, "@types/range-parser": { "version": "1.2.3", @@ -972,9 +957,9 @@ } }, "commander": { - "version": "2.20.0", - "resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "component-bind": { @@ -1249,7 +1234,7 @@ }, "esutils": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "resolved": "https://verdaccio.lossless.one/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, @@ -1475,9 +1460,9 @@ } }, "glob": { - "version": "7.1.3", - "resolved": "https://verdaccio.lossless.one/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.6", + "resolved": "https://verdaccio.lossless.one/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -1956,7 +1941,7 @@ }, "minimist": { "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=", "dev": true }, @@ -2356,7 +2341,7 @@ }, "resolve": { "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz", "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", "dev": true, "requires": { @@ -2754,9 +2739,9 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" }, "tslint": { - "version": "5.20.0", - "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.0.tgz", - "integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==", + "version": "5.20.1", + "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", diff --git a/package.json b/package.json index ebdcd73..f8b0073 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "@gitzone/tsbuild": "^2.1.17", "@gitzone/tstest": "^1.0.28", "@pushrocks/tapbundle": "^3.0.13", - "@types/node": "^12.12.5", - "tslint": "^5.20.0", + "@types/node": "^12.12.6", + "tslint": "^5.20.1", "tslint-config-prettier": "^1.18.0" }, "peerDependencies": { @@ -35,7 +35,7 @@ "@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartrequest": "^1.1.42", "@pushrocks/smartrx": "^2.0.5", - "@pushrocks/smartsocket": "^1.1.51", + "@pushrocks/smartsocket": "^1.1.54", "@pushrocks/smarttime": "^3.0.12", "@pushrocks/smartunique": "^3.0.1" }, diff --git a/ts/smartuniverse.classes.universe.ts b/ts/smartuniverse.classes.universe.ts index 5d30c7a..c7e823b 100644 --- a/ts/smartuniverse.classes.universe.ts +++ b/ts/smartuniverse.classes.universe.ts @@ -112,6 +112,7 @@ export class Universe { funcName: 'subscribeChannel', funcDef: async (dataArg, socketConnectionArg) => { const universeConnection = new UniverseConnection({ + universe: this, socketConnection: socketConnectionArg, authenticationRequests: [dataArg] }); diff --git a/ts/smartuniverse.classes.universeconnection.ts b/ts/smartuniverse.classes.universeconnection.ts index f6d3caa..d417eb3 100644 --- a/ts/smartuniverse.classes.universeconnection.ts +++ b/ts/smartuniverse.classes.universeconnection.ts @@ -93,6 +93,8 @@ export class UniverseConnection { return universeConnection; } + // INSTANCE + public universeRef: Universe; public terminatedDeferred = plugins.smartpromise.defer(); /** @@ -100,23 +102,27 @@ export class UniverseConnection { */ public socketConnection: plugins.smartsocket.SocketConnection; public authenticationRequests: Array = []; - public subscribedChannels: UniverseChannel[] = []; public authenticatedChannels: UniverseChannel[] = []; public failedToJoinChannels: UniverseChannel[] = []; /** * terminates the connection */ - public terminateConnection() { - this.socketConnection.socket.disconnect(); + public async terminateUniverseConnection() { + await this.socketConnection.disconnect(); + this.universeRef.universeCache.connectionMap.remove(this); this.terminatedDeferred.resolve(); } constructor(optionsArg: { + universe: Universe, socketConnection: plugins.smartsocket.SocketConnection; authenticationRequests: Array; }) { this.authenticationRequests = optionsArg.authenticationRequests; this.socketConnection = optionsArg.socketConnection; + this.socketConnection.eventSubject.subscribe(async(event) => { + await this.terminateUniverseConnection(); + }); } }