From b6b482f7db5ce622f2cad98cafbb6469d908de67 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 30 Sep 2020 00:50:43 +0000 Subject: [PATCH] fix(core): update --- package-lock.json | 28 ++++++++++++++----- package.json | 8 ++---- ...universe.classes.client.universechannel.ts | 2 +- ...tuniverse.classes.event.reactionrequest.ts | 2 +- ts/smartuniverse.classes.universe.ts | 8 ++---- ts/smartuniverse.classes.universechannel.ts | 2 +- ts/smartuniverse.classes.universemessage.ts | 10 +++---- ts/smartuniverse.paths.ts | 3 -- ts/smartuniverse.plugins.ts | 17 +++-------- 9 files changed, 38 insertions(+), 42 deletions(-) delete mode 100644 ts/smartuniverse.paths.ts diff --git a/package-lock.json b/package-lock.json index 8d38c40..dea2d32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1515,6 +1515,7 @@ "version": "8.0.0", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-8.0.0.tgz", "integrity": "sha512-A5uk7O3UZBXt0obIkQDpN9eihQwq4PVryr21xTv9Uw573mJWGfGB/xs07tdC6Qgbtlvl7i2vXl5qmKFDRky9Mg==", + "dev": true, "requires": { "@pushrocks/smarthash": "^2.1.6", "@pushrocks/smartmime": "^1.0.3", @@ -1530,12 +1531,14 @@ "@pushrocks/smartpath": { "version": "4.0.3", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpath/-/smartpath-4.0.3.tgz", - "integrity": "sha512-KWz4DWOrB0sPfk6L4i+CPOo+UK5HXNaLI7ZAaqJe1nEWoDrpyeds1dNDaqVAmSgX4riLGxVpslKH5MnABCPsPg==" + "integrity": "sha512-KWz4DWOrB0sPfk6L4i+CPOo+UK5HXNaLI7ZAaqJe1nEWoDrpyeds1dNDaqVAmSgX4riLGxVpslKH5MnABCPsPg==", + "dev": true }, "@types/fs-extra": { "version": "9.0.1", "resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-9.0.1.tgz", "integrity": "sha512-B42Sxuaz09MhC3DDeW5kubRcQ5by4iuVQ0cRRWM2lggLzAa/KVom0Aft/208NgMvNQQZ86s5rVcqDdn/SH0/mg==", + "dev": true, "requires": { "@types/node": "*" } @@ -1544,6 +1547,7 @@ "version": "9.0.1", "resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-9.0.1.tgz", "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "dev": true, "requires": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -1555,6 +1559,7 @@ "version": "3.14.0", "resolved": "https://verdaccio.lossless.one/js-yaml/-/js-yaml-3.14.0.tgz", "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -1564,6 +1569,7 @@ "version": "6.0.1", "resolved": "https://verdaccio.lossless.one/jsonfile/-/jsonfile-6.0.1.tgz", "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "dev": true, "requires": { "graceful-fs": "^4.1.6", "universalify": "^1.0.0" @@ -1572,7 +1578,8 @@ "universalify": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", + "dev": true } } }, @@ -2026,6 +2033,7 @@ "version": "3.0.3", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.3.tgz", "integrity": "sha512-f+c3s2WzzjASoRHyYTLU0kHDVWREg4sZVdi5L42bTA3CTUWNrcGUC62h4wP4U4BiPl3bopTr3LPhClZHJ738oA==", + "dev": true, "requires": { "@types/shortid": "0.0.29", "@types/uuid": "^7.0.0", @@ -2385,7 +2393,8 @@ "@types/shortid": { "version": "0.0.29", "resolved": "https://verdaccio.lossless.one/@types%2fshortid/-/shortid-0.0.29.tgz", - "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=" + "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=", + "dev": true }, "@types/socket.io": { "version": "2.1.11", @@ -2429,7 +2438,8 @@ "@types/uuid": { "version": "7.0.4", "resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-7.0.4.tgz", - "integrity": "sha512-WGZCqBZZ0mXN2RxvLHL6/7RCu+OWs28jgQMP04LWfpyJlQUMTR6YU9CNJAKDgbw+EV/u687INXuLUc7FuML/4g==" + "integrity": "sha512-WGZCqBZZ0mXN2RxvLHL6/7RCu+OWs28jgQMP04LWfpyJlQUMTR6YU9CNJAKDgbw+EV/u687INXuLUc7FuML/4g==", + "dev": true }, "@types/which": { "version": "1.3.2", @@ -2738,7 +2748,8 @@ "at-least-node": { "version": "1.0.0", "resolved": "https://verdaccio.lossless.one/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true }, "atob": { "version": "2.1.2", @@ -7600,7 +7611,8 @@ "nanoid": { "version": "2.1.11", "resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" + "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==", + "dev": true }, "nanomatch": { "version": "1.2.13", @@ -9800,6 +9812,7 @@ "version": "2.2.15", "resolved": "https://verdaccio.lossless.one/shortid/-/shortid-2.2.15.tgz", "integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", + "dev": true, "requires": { "nanoid": "^2.1.0" } @@ -11109,7 +11122,8 @@ "uuid": { "version": "7.0.3", "resolved": "https://verdaccio.lossless.one/uuid/-/uuid-7.0.3.tgz", - "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==" + "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", + "dev": true }, "v8-compile-cache": { "version": "2.1.1", diff --git a/package.json b/package.json index a9b0303..7d63e42 100644 --- a/package.json +++ b/package.json @@ -26,18 +26,16 @@ }, "dependencies": { "@apiglobal/typedrequest-interfaces": "^1.0.15", + "@pushrocks/isohash": "^1.0.2", + "@pushrocks/isounique": "^1.0.4", "@pushrocks/lik": "^4.0.17", "@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartexpress": "^3.0.76", - "@pushrocks/smartfile": "^8.0.0", - "@pushrocks/smarthash": "^2.1.6", "@pushrocks/smartlog": "^2.0.39", "@pushrocks/smartpromise": "^3.0.6", - "@pushrocks/smartrequest": "^1.1.51", "@pushrocks/smartrx": "^2.0.19", "@pushrocks/smartsocket": "^1.1.67", - "@pushrocks/smarttime": "^3.0.35", - "@pushrocks/smartunique": "^3.0.3" + "@pushrocks/smarttime": "^3.0.35" }, "files": [ "ts/**/*", diff --git a/ts/smartuniverse.classes.client.universechannel.ts b/ts/smartuniverse.classes.client.universechannel.ts index 5bfb7e6..9bec462 100644 --- a/ts/smartuniverse.classes.client.universechannel.ts +++ b/ts/smartuniverse.classes.client.universechannel.ts @@ -90,7 +90,7 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel { public async postMessage(messageArg: interfaces.IMessageCreator) { await this.clientUniverseRef.start(); // its ok to call this multiple times const universeMessageToSend: interfaces.IUniverseMessage = { - id: plugins.smartunique.shortId(), + id: plugins.isounique.uni(), timestamp: Date.now(), passphrase: this.passphrase, targetChannelName: this.name, diff --git a/ts/smartuniverse.classes.event.reactionrequest.ts b/ts/smartuniverse.classes.event.reactionrequest.ts index 5b4c911..84c13bb 100644 --- a/ts/smartuniverse.classes.event.reactionrequest.ts +++ b/ts/smartuniverse.classes.event.reactionrequest.ts @@ -37,7 +37,7 @@ export class ReactionRequest(); const reactionResult = new ReactionResult(); - const requestId = plugins.smartunique.shortId(); + const requestId = plugins.isounique.uni(); for (const channel of channelsArg) { subscriptionMap.add( channel.subscribe( diff --git a/ts/smartuniverse.classes.universe.ts b/ts/smartuniverse.classes.universe.ts index e8ced95..e4417f2 100644 --- a/ts/smartuniverse.classes.universe.ts +++ b/ts/smartuniverse.classes.universe.ts @@ -4,8 +4,6 @@ import * as pluginsTyped from './smartuniverse.pluginstyped'; import { Handler, Route, Server } from '@pushrocks/smartexpress'; import { UniverseCache, UniverseChannel, UniverseMessage } from './'; -import * as paths from './smartuniverse.paths'; - import * as interfaces from './interfaces'; import { UniverseConnection } from './smartuniverse.classes.universeconnection'; import { logger } from './smartuniverse.logging'; @@ -49,7 +47,7 @@ export class Universe { /** * get the currently running version of smartuniverse */ - public getUniverseVersion() { + /* public getUniverseVersion() { if (this.universeVersionStore) { return this.universeVersionStore; } else { @@ -57,7 +55,7 @@ export class Universe { this.universeVersionStore = packageJson.version; return this.universeVersionStore; } - } + } */ /** * adds a channel to the Universe @@ -94,7 +92,7 @@ export class Universe { // add a role for the clients const ClientRole = new plugins.smartsocket.SocketRole({ name: 'UniverseClient', - passwordHash: plugins.smarthash.sha256FromStringSync('UniverseClient'), // authentication happens on another level + passwordHash: await plugins.isohash.sha256FromString('UniverseClient'), // authentication happens on another level }); // add the role to smartsocket diff --git a/ts/smartuniverse.classes.universechannel.ts b/ts/smartuniverse.classes.universechannel.ts index 6cb96e5..b044a7e 100644 --- a/ts/smartuniverse.classes.universechannel.ts +++ b/ts/smartuniverse.classes.universechannel.ts @@ -157,7 +157,7 @@ export class UniverseChannel { */ public async postMessage(messageDescriptor: interfaces.IMessageCreator) { const messageToSend = new UniverseMessage({ - id: plugins.smartunique.shortId(), + id: plugins.isounique.uni(), messageText: messageDescriptor.messageText, payload: messageDescriptor.payload, targetChannelName: this.name, diff --git a/ts/smartuniverse.classes.universemessage.ts b/ts/smartuniverse.classes.universemessage.ts index 5cd3184..553bdac 100644 --- a/ts/smartuniverse.classes.universemessage.ts +++ b/ts/smartuniverse.classes.universemessage.ts @@ -1,7 +1,5 @@ import * as plugins from './smartuniverse.plugins'; import * as interfaces from './interfaces'; - -import { Timer, TimeStamp } from '@pushrocks/smarttime'; import { Universe } from './smartuniverse.classes.universe'; import { UniverseChannel } from './smartuniverse.classes.universechannel'; import { UniverseCache } from './smartuniverse.classes.universecache'; @@ -24,7 +22,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { public id: string; public timestamp: number; - public smartTimestamp: TimeStamp; + public smartTimestamp: plugins.smarttime.TimeStamp; public messageText: string; public passphrase: string; public payload: T; @@ -49,7 +47,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { /** * a destruction timer for this message */ - public destructionTimer: Timer; // a timer to take care of message destruction + public destructionTimer: plugins.smarttime.Timer; // a timer to take care of message destruction /** * the constructor to create a universe message @@ -57,7 +55,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { * @param attachedPayloadArg */ constructor(messageDescriptor: interfaces.IUniverseMessage) { - this.smartTimestamp = new TimeStamp(this.timestamp); + this.smartTimestamp = new plugins.smarttime.TimeStamp(this.timestamp); this.messageText = messageDescriptor.messageText; this.targetChannelName = messageDescriptor.targetChannelName; this.passphrase = messageDescriptor.passphrase; @@ -74,7 +72,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { public setDestructionTimer(selfdestructAfterArg?: number) { if (selfdestructAfterArg) { - this.destructionTimer = new Timer(selfdestructAfterArg); + this.destructionTimer = new plugins.smarttime.Timer(selfdestructAfterArg); this.destructionTimer.start(); // set up self destruction by removing this from the parent messageCache this.destructionTimer.completed diff --git a/ts/smartuniverse.paths.ts b/ts/smartuniverse.paths.ts deleted file mode 100644 index 819aca9..0000000 --- a/ts/smartuniverse.paths.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as plugins from './smartuniverse.plugins'; - -export const packageJson = plugins.path.join(__dirname, '../package.json'); diff --git a/ts/smartuniverse.plugins.ts b/ts/smartuniverse.plugins.ts index 1c309b0..95197b2 100644 --- a/ts/smartuniverse.plugins.ts +++ b/ts/smartuniverse.plugins.ts @@ -1,8 +1,3 @@ -// node native -import * as path from 'path'; - -export { path }; - // apiglobal scope import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces'; @@ -10,27 +5,23 @@ export { typedrequestInterfaces }; // pushrocks scope import * as lik from '@pushrocks/lik'; -import * as smarthash from '@pushrocks/smarthash'; +import * as isohash from '@pushrocks/isohash'; import * as smartdelay from '@pushrocks/smartdelay'; -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'; import * as smartsocket from '@pushrocks/smartsocket'; import * as smarttime from '@pushrocks/smarttime'; -import * as smartunique from '@pushrocks/smartunique'; +import * as isounique from '@pushrocks/isounique'; export { lik, - smarthash, + isohash, smartdelay, - smartfile, smartlog, smartpromise, smartrx, - smartrequest, smartsocket, smarttime, - smartunique, + isounique, };