fix(core): update

This commit is contained in:
2020-09-30 00:50:43 +00:00
parent 39ed2dbd73
commit b6b482f7db
9 changed files with 38 additions and 42 deletions

View File

@ -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,

View File

@ -37,7 +37,7 @@ export class ReactionRequest<T extends plugins.typedrequestInterfaces.ITypedRequ
) {
const subscriptionMap = new plugins.lik.ObjectMap<plugins.smartrx.rxjs.Subscription>();
const reactionResult = new ReactionResult<T>();
const requestId = plugins.smartunique.shortId();
const requestId = plugins.isounique.uni();
for (const channel of channelsArg) {
subscriptionMap.add(
channel.subscribe(

View File

@ -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

View File

@ -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,

View File

@ -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<T> 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<T> 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<T> 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<T> 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

View File

@ -1,3 +0,0 @@
import * as plugins from './smartuniverse.plugins';
export const packageJson = plugins.path.join(__dirname, '../package.json');

View File

@ -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,
};