fix(core): update

This commit is contained in:
2019-01-31 02:52:18 +01:00
parent 57b37cb327
commit ac2a1559b0
13 changed files with 1179 additions and 284 deletions

View File

@ -1,8 +1,8 @@
import * as plugins from './smartuniverse.plugins';
import { Objectmap } from 'lik';
import { Objectmap } from '@pushrocks/lik';
import { Observable } from 'rxjs';
import { Smartsocket, SmartsocketClient } from 'smartsocket';
import { Smartsocket, SmartsocketClient } from '@pushrocks/smartsocket';
import * as url from 'url';
import {
@ -37,7 +37,7 @@ export class ClientUniverse {
payload: payloadArg
};
// TODO: User websocket connection if available
await plugins.smartrequest.post(this.options.serverAddress, {
await plugins.smartrequest.postJson(this.options.serverAddress, {
requestBody
});
}

View File

@ -1,6 +1,6 @@
import * as plugins from './smartuniverse.plugins';
import { Handler, Route, Server } from 'smartexpress';
import { Handler, Route, Server } from '@pushrocks/smartexpress';
import { UniverseCache, UniverseChannel, UniverseMessage } from './';
import * as paths from './smartuniverse.paths';
@ -69,7 +69,9 @@ export class Universe {
public async initServer(portArg: number | string) {
this.smartexpressServer = new plugins.smartexpress.Server({
cors: true,
defaultAnswer: `smartuniverse server ${this.universeVersion}`,
defaultAnswer: async () => {
return `smartuniverse server ${this.universeVersion}`;
},
forceSsl: false,
port: portArg
});

View File

@ -3,10 +3,11 @@ import * as plugins from './smartuniverse.plugins';
import { UniverseChannel } from './smartuniverse.classes.universechannel';
import { UniverseMessage } from './smartuniverse.classes.universemessage';
import { Objectmap } from 'lik';
import { Objectmap } from '@pushrocks/lik';
import { Observable } from 'rxjs';
import { rxjs } from 'smartrx';
import { Observable, from } from 'rxjs';
import { filter } from 'rxjs/operators';
import { rxjs } from '@pushrocks/smartrx';
/**
* universe store handles the creation, storage and retrieval of messages.
@ -52,10 +53,10 @@ export class UniverseCache {
* Read a message from the UniverseStore
*/
public readMessagesYoungerThan(unixTimeArg?: number): Observable<UniverseMessage> {
const messageObservable = rxjs.Observable.from(this.messageMap.getArray()).filter(
messageArg => {
const messageObservable = from(this.messageMap.getArray()).pipe(
filter(messageArg => {
return messageArg.timestamp.isYoungerThanMilliSeconds(this.destructionTime);
}
})
);
return messageObservable;
}

View File

@ -1,6 +1,6 @@
import * as plugins from './smartuniverse.plugins';
import { Objectmap } from 'lik';
import { Objectmap } from '@pushrocks/lik';
import { UniverseCache } from './smartuniverse.classes.universecache';
import { UniverseMessage } from './smartuniverse.classes.universemessage';

View File

@ -1,8 +1,8 @@
import * as plugins from './smartuniverse.plugins';
import { Objectmap } from 'lik';
import { Objectmap } from '@pushrocks/lik';
import { Timer, TimeStamp } from 'smarttime';
import { Timer, TimeStamp } from '@pushrocks/smarttime';
import { Universe } from './smartuniverse.classes.universe';
import { UniverseChannel } from './smartuniverse.classes.universechannel';
import { UniverseCache } from './smartuniverse.classes.universecache';

View File

@ -1,23 +1,27 @@
import * as lik from 'lik';
import * as nodehash from 'nodehash';
// node native
import * as path from 'path';
import * as smartdelay from 'smartdelay';
import * as smartexpress from 'smartexpress';
import * as smartfile from 'smartfile';
import * as smartq from 'smartq';
import * as smartrequest from 'smartrequest';
import * as smartrx from 'smartrx';
import * as smartsocket from 'smartsocket';
import * as smarttime from 'smarttime';
export { path };
// pushrocks scope
import * as lik from '@pushrocks/lik';
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 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';
export {
lik,
nodehash,
path,
smarthash,
smartdelay,
smartexpress,
smartfile,
smartq,
smartpromise,
smartrx,
smartrequest,
smartsocket,