From 3f073ab9b3a0e80e868ae51a8846b0d5077cfe74 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 3 Nov 2019 19:17:26 +0100 Subject: [PATCH] fix(core): update --- package-lock.json | 21 ++++++++++++++++++++- package.json | 3 +-- ts/smartsocket.classes.smartsocket.ts | 6 +++++- ts/smartsocket.classes.smartsocketclient.ts | 2 +- ts/smartsocket.plugins.ts | 6 +++--- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2531a2d..2d33113 100644 --- a/package-lock.json +++ b/package-lock.json @@ -537,6 +537,17 @@ "luxon": "^1.16.0" } }, + "@pushrocks/smartunique": { + "version": "3.0.1", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.1.tgz", + "integrity": "sha512-xBu9ZB4C0BA0S/pbFFZn2ItPfnodPKpzrYIq1yN5XDs6OaookwcDF/iBwfS9+EYMSPENC9wAsOxg2RGMm4Qicw==", + "requires": { + "@types/shortid": "^0.0.29", + "@types/uuid": "^3.0.0", + "shortid": "^2.2.8", + "uuid": "^3.1.0" + } + }, "@pushrocks/tapbundle": { "version": "3.0.13", "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.13.tgz", @@ -734,6 +745,14 @@ "@types/node": "*" } }, + "@types/uuid": { + "version": "3.4.6", + "resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-3.4.6.tgz", + "integrity": "sha512-cCdlC/1kGEZdEglzOieLDYBxHsvEOIg7kp/2FYyVR9Pxakq+Qf/inL3RKQ+PA8gOlI/NnL+fXmQH12nwcGzsHw==", + "requires": { + "@types/node": "*" + } + }, "@types/vinyl": { "version": "2.0.2", "resolved": "https://verdaccio.lossless.one/@types%2fvinyl/-/vinyl-2.0.2.tgz", @@ -2212,7 +2231,7 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, diff --git a/package.json b/package.json index 72151c9..023c1de 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,9 @@ "@pushrocks/smarthash": "^2.0.6", "@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartpromise": "^3.0.6", - "@types/shortid": "0.0.29", + "@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" }, diff --git a/ts/smartsocket.classes.smartsocket.ts b/ts/smartsocket.classes.smartsocket.ts index 7da229f..e9f418c 100644 --- a/ts/smartsocket.classes.smartsocket.ts +++ b/ts/smartsocket.classes.smartsocket.ts @@ -16,6 +16,10 @@ export interface ISmartsocketConstructorOptions { } export class Smartsocket { + /** + * a unique id to detect server restarts + */ + public id = plugins.smartunique.shortId(); public options: ISmartsocketConstructorOptions; public io: SocketIO.Server; public socketConnections = new Objectmap(); @@ -80,7 +84,7 @@ export class Smartsocket { funcName: functionNameArg }, originSocketConnection: targetSocketConnectionArg, - shortId: plugins.shortid.generate(), + shortId: plugins.smartunique.shortId(), side: 'requesting' }); const response: ISocketFunctionCallDataResponse = await socketRequest.dispatch(); diff --git a/ts/smartsocket.classes.smartsocketclient.ts b/ts/smartsocket.classes.smartsocketclient.ts index 06a5300..43be291 100644 --- a/ts/smartsocket.classes.smartsocketclient.ts +++ b/ts/smartsocket.classes.smartsocketclient.ts @@ -111,7 +111,7 @@ export class SmartsocketClient { const socketRequest = new SocketRequest(this, { side: 'requesting', originSocketConnection: this.socketConnection, - shortId: plugins.shortid.generate(), + shortId: plugins.smartunique.shortId(), funcCallData: { funcName: functionNameArg, funcDataArg: dataArg diff --git a/ts/smartsocket.plugins.ts b/ts/smartsocket.plugins.ts index dbdcb59..6027df4 100644 --- a/ts/smartsocket.plugins.ts +++ b/ts/smartsocket.plugins.ts @@ -10,6 +10,7 @@ import * as smarthash from '@pushrocks/smarthash'; import * as smartdelay from '@pushrocks/smartdelay'; import * as smartexpress from '@pushrocks/smartexpress'; import * as smartpromise from '@pushrocks/smartpromise'; +import * as smartunique from '@pushrocks/smartunique'; export { @@ -18,16 +19,15 @@ export { smarthash, smartdelay, smartexpress, - smartpromise + smartpromise, + smartunique, }; // third party scope -import * as shortid from 'shortid'; import socketIo from 'socket.io'; import socketIoClient from 'socket.io-client'; export { - shortid, socketIo, socketIoClient };