diff --git a/package.json b/package.json index 17990e8..0f99a8a 100644 --- a/package.json +++ b/package.json @@ -53,4 +53,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/test/common/test.ts b/test/common/test.ts index ebe1ab4..25759d8 100644 --- a/test/common/test.ts +++ b/test/common/test.ts @@ -1 +1 @@ -console.log('TODO'); \ No newline at end of file +console.log('TODO'); diff --git a/test/test.expressserver.ts b/test/test.expressserver.ts index 4a468d4..4e11948 100644 --- a/test/test.expressserver.ts +++ b/test/test.expressserver.ts @@ -93,9 +93,7 @@ tap.test('should be able to make a functionCall from client to server', async () console.log(response); }); -tap.test('should be able to make a functionCall from server to client', async () => { - -}); +tap.test('should be able to make a functionCall from server to client', async () => {}); // terminate tap.test('should close the server', async () => { diff --git a/ts/smartsocket.classes.socketconnection.ts b/ts/smartsocket.classes.socketconnection.ts index af16bb0..aed9b04 100644 --- a/ts/smartsocket.classes.socketconnection.ts +++ b/ts/smartsocket.classes.socketconnection.ts @@ -5,10 +5,7 @@ import { Objectmap } from '@pushrocks/lik'; // import classes import { Smartsocket } from './smartsocket.classes.smartsocket'; import { SocketFunction } from './smartsocket.classes.socketfunction'; -import { - SocketRequest, - ISocketRequestDataObject, -} from './smartsocket.classes.socketrequest'; +import { SocketRequest, ISocketRequestDataObject } from './smartsocket.classes.socketrequest'; import { SocketRole } from './smartsocket.classes.socketrole'; // socket.io @@ -147,7 +144,10 @@ export class SocketConnection { 'info', `received response for request with id ${dataArg.shortId}` ); - const targetSocketRequest = SocketRequest.getSocketRequestById(this.smartsocketRef, dataArg.shortId); + const targetSocketRequest = SocketRequest.getSocketRequestById( + this.smartsocketRef, + dataArg.shortId + ); targetSocketRequest.handleResponse(dataArg); }); plugins.smartlog.defaultLogger.log( diff --git a/ts/smartsocket.classes.socketfunction.ts b/ts/smartsocket.classes.socketfunction.ts index 00f3698..de822b1 100644 --- a/ts/smartsocket.classes.socketfunction.ts +++ b/ts/smartsocket.classes.socketfunction.ts @@ -38,7 +38,10 @@ export type TFuncDef = (dataArg: any, connectionArg: SocketConnection) => Promis */ export class SocketFunction { // STATIC - public static getSocketFunctionByName (smartsocketRefArg: Smartsocket | SmartsocketClient, functionNameArg: string): SocketFunction { + public static getSocketFunctionByName( + smartsocketRefArg: Smartsocket | SmartsocketClient, + functionNameArg: string + ): SocketFunction { console.log(smartsocketRefArg.socketFunctions); return smartsocketRefArg.socketFunctions.find(socketFunctionArg => { return socketFunctionArg.name === functionNameArg; diff --git a/ts/smartsocket.classes.socketrequest.ts b/ts/smartsocket.classes.socketrequest.ts index 5514b37..48d919c 100644 --- a/ts/smartsocket.classes.socketrequest.ts +++ b/ts/smartsocket.classes.socketrequest.ts @@ -55,8 +55,10 @@ export class SocketRequest { public smartsocketRef: Smartsocket | SmartsocketClient; - - constructor(smartsocketRefArg: Smartsocket | SmartsocketClient, optionsArg: SocketRequestConstructorOptions) { + constructor( + smartsocketRefArg: Smartsocket | SmartsocketClient, + optionsArg: SocketRequestConstructorOptions + ) { this.smartsocketRef = smartsocketRefArg; this.side = optionsArg.side; this.shortid = optionsArg.shortId; diff --git a/ts/smartsocket.classes.socketrole.ts b/ts/smartsocket.classes.socketrole.ts index 9be3ac6..f72f68c 100644 --- a/ts/smartsocket.classes.socketrole.ts +++ b/ts/smartsocket.classes.socketrole.ts @@ -1,6 +1,5 @@ import * as plugins from './smartsocket.plugins'; - // import classes import { Objectmap } from '@pushrocks/lik'; import { SocketFunction } from './smartsocket.classes.socketfunction'; @@ -23,18 +22,19 @@ export class SocketRole { // STATIC public static getSocketRoleByName( referenceSmartsocket: Smartsocket | SmartsocketClient, - socketRoleNameArg: string, - ): SocketRole{ + socketRoleNameArg: string + ): SocketRole { return referenceSmartsocket.socketRoles.find(socketRoleArg => { return socketRoleArg.name === socketRoleNameArg; }); } - public static checkPasswordForRole ( + public static checkPasswordForRole( dataArg: ISocketConnectionAuthenticationObject, referenceSmartsocket: Smartsocket | SmartsocketClient ): boolean { - const targetPasswordHash = SocketRole.getSocketRoleByName(referenceSmartsocket, dataArg.role).passwordHash; + const targetPasswordHash = SocketRole.getSocketRoleByName(referenceSmartsocket, dataArg.role) + .passwordHash; const computedCompareHash = plugins.smarthash.sha256FromStringSync(dataArg.password); return targetPasswordHash === computedCompareHash; }