From be7ca29e4b191e24e6fded07c5f0c6aa9764e523 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 10 Sep 2019 10:55:10 +0200 Subject: [PATCH] fix(core): update --- package.json | 2 +- ts/interfaces/socketfunctionrequests.ts | 6 +++--- ts/interfaces/universeactions.interfaces.ts | 1 - ts/smartuniverse.classes.clientuniversechannel.ts | 14 ++++++-------- ts/smartuniverse.classes.reactionrequest.ts | 4 +--- ts/smartuniverse.classes.reactionresponse.ts | 2 +- ts/smartuniverse.classes.universe.ts | 9 ++++----- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 73fef66..6c62682 100644 --- a/package.json +++ b/package.json @@ -49,4 +49,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/ts/interfaces/socketfunctionrequests.ts b/ts/interfaces/socketfunctionrequests.ts index 86963a6..001859f 100644 --- a/ts/interfaces/socketfunctionrequests.ts +++ b/ts/interfaces/socketfunctionrequests.ts @@ -7,7 +7,7 @@ export interface ISocketRequest_SubscribeChannel { passphrase: string; }; response: { - subscriptionStatus: 'subscribed' | 'unsubscribed' + subscriptionStatus: 'subscribed' | 'unsubscribed'; }; } @@ -15,6 +15,6 @@ export interface ISocketRequest_ProcessMessage { method: 'processMessage'; request: interfaces.IUniverseMessage; response: { - messageStatus: 'ok' | 'channel not found' + messageStatus: 'ok' | 'channel not found'; }; -} \ No newline at end of file +} diff --git a/ts/interfaces/universeactions.interfaces.ts b/ts/interfaces/universeactions.interfaces.ts index bfdca83..ff37203 100644 --- a/ts/interfaces/universeactions.interfaces.ts +++ b/ts/interfaces/universeactions.interfaces.ts @@ -4,7 +4,6 @@ export type IServerCallActions = | 'channelUnsubscribe' | 'terminateConnection'; - export interface IServerUnsubscribeActionPayload { name: string; } diff --git a/ts/smartuniverse.classes.clientuniversechannel.ts b/ts/smartuniverse.classes.clientuniversechannel.ts index 9fccd65..5548fd1 100644 --- a/ts/smartuniverse.classes.clientuniversechannel.ts +++ b/ts/smartuniverse.classes.clientuniversechannel.ts @@ -56,20 +56,18 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel { public async subscribe(observerArg?: plugins.smartrx.rxjs.Observer) { // lets make sure the channel is connected if (this.status === 'unsubscribed') { - const response = await this.clientUniverseRef.smartsocketClient.serverCall( - 'subscribeChannel', - { - name: this.name, - passphrase: this.passphrase - } - ); + const response = await this.clientUniverseRef.smartsocketClient.serverCall< + interfaces.ISocketRequest_SubscribeChannel + >('subscribeChannel', { + name: this.name, + passphrase: this.passphrase + }); this.status = response.subscriptionStatus; } if (observerArg) { return this.subject.subscribe(observerArg); } - } public async emitMessageLocally(messageArg: ClientUniverseMessage) { diff --git a/ts/smartuniverse.classes.reactionrequest.ts b/ts/smartuniverse.classes.reactionrequest.ts index c884dab..9e7187f 100644 --- a/ts/smartuniverse.classes.reactionrequest.ts +++ b/ts/smartuniverse.classes.reactionrequest.ts @@ -1,5 +1,3 @@ import * as plugins from './smartuniverse.plugins'; -export class ReactionRequest { - -} +export class ReactionRequest {} diff --git a/ts/smartuniverse.classes.reactionresponse.ts b/ts/smartuniverse.classes.reactionresponse.ts index ed3a80b..26ac86d 100644 --- a/ts/smartuniverse.classes.reactionresponse.ts +++ b/ts/smartuniverse.classes.reactionresponse.ts @@ -1,3 +1,3 @@ import * as plugins from './smartuniverse.plugins'; -export class ReactionResponse {} \ No newline at end of file +export class ReactionResponse {} diff --git a/ts/smartuniverse.classes.universe.ts b/ts/smartuniverse.classes.universe.ts index 7a80a65..9af568e 100644 --- a/ts/smartuniverse.classes.universe.ts +++ b/ts/smartuniverse.classes.universe.ts @@ -105,13 +105,12 @@ export class Universe { // add the role to smartsocket this.smartsocket.addSocketRoles([ClientRole]); - const socketFunctionSubscription = new plugins.smartsocket.SocketFunction({ + const socketFunctionSubscription = new plugins.smartsocket.SocketFunction< + interfaces.ISocketRequest_SubscribeChannel + >({ allowedRoles: [ClientRole], // there is only one client role, Authentication happens on another level funcName: 'subscribeChannel', - funcDef: async ( - dataArg, - socketConnectionArg - ) => { + funcDef: async (dataArg, socketConnectionArg) => { const universeConnection = new UniverseConnection({ socketConnection: socketConnectionArg, authenticationRequests: [dataArg]