diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 938529d..1e3250b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,17 +38,17 @@ snyk: # test stage # ==================== -testLTS: +testStable: stage: test script: - npmci npm prepare - - npmci node install lts + - npmci node install stable - npmci npm install - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - docker - - notpriv + - priv testBuild: stage: test @@ -100,7 +100,7 @@ trigger: pages: image: hosttoday/ht-docker-dbase:npmci services: - - docker:18-dind + - docker:stable-dind stage: metadata script: - npmci command npm install -g @gitzone/tsdoc diff --git a/package.json b/package.json index e226b15..2755674 100644 --- a/package.json +++ b/package.json @@ -49,4 +49,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index b905ddc..7686dec 100644 --- a/readme.md +++ b/readme.md @@ -50,6 +50,6 @@ All your microservices represents clients in the universe that may talk to each For further information read the linked docs at the top of this readme. > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com) +[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) diff --git a/test/test.ts b/test/test.ts index 649fc99..bd0f648 100644 --- a/test/test.ts +++ b/test/test.ts @@ -37,7 +37,7 @@ tap.test('create smartuniverse client', async () => { }); tap.test('should add a channel to the universe', async () => { - testUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass); + testUniverse.addChannel(testChannelData.channelName, testChannelData.channelPass); }); tap.test('should add the same channel to the client universe in the same way', async () => { @@ -46,7 +46,7 @@ tap.test('should add the same channel to the client universe in the same way', a tap.test('should start the ClientUniverse', async () => { await testClientUniverse.start(); -}) +}); tap.test('should get a observable correctly', async () => { testClientChannel = testClientUniverse.getChannel(testChannelData.channelName); @@ -54,7 +54,7 @@ tap.test('should get a observable correctly', async () => { }); tap.test('should send a message correctly', async () => { - await (testClientUniverse.getChannel(testChannelData.channelName)).sendMessage({ + await testClientUniverse.getChannel(testChannelData.channelName).sendMessage({ messageText: 'hello' }); }); diff --git a/ts/interfaces/universemessage.interfaces.ts b/ts/interfaces/universemessage.interfaces.ts index 78eaf07..faccbd1 100644 --- a/ts/interfaces/universemessage.interfaces.ts +++ b/ts/interfaces/universemessage.interfaces.ts @@ -5,7 +5,7 @@ export interface IMessageCreator { } /** - * + * */ export interface IUniverseMessage extends IMessageCreator { id: string; diff --git a/ts/smartuniverse.classes.clientuniverse.ts b/ts/smartuniverse.classes.clientuniverse.ts index 6e57366..2889d2b 100644 --- a/ts/smartuniverse.classes.clientuniverse.ts +++ b/ts/smartuniverse.classes.clientuniverse.ts @@ -40,7 +40,11 @@ export class ClientUniverse { } // lets create the channel - const clientUniverseChannel = ClientUniverseChannel.createClientUniverseChannel(this, channelNameArg, passphraseArg); + const clientUniverseChannel = ClientUniverseChannel.createClientUniverseChannel( + this, + channelNameArg, + passphraseArg + ); return clientUniverseChannel; } @@ -61,9 +65,11 @@ export class ClientUniverse { * @param messageArg */ public removeChannel(channelNameArg, notifyServer = true) { - const clientUniverseChannel = this.clientUniverseCache.channelMap.findOneAndRemove(channelItemArg => { - return channelItemArg.name === channelNameArg; - }); + const clientUniverseChannel = this.clientUniverseCache.channelMap.findOneAndRemove( + channelItemArg => { + return channelItemArg.name === channelNameArg; + } + ); } public async start() { @@ -112,7 +118,9 @@ export class ClientUniverse { allowedRoles: [], funcDef: async (messageDescriptorArg: interfaces.IUniverseMessage) => { plugins.smartlog.defaultLogger.log('info', 'Got message from server'); - this.observableIntake.push(ClientUniverseMessage.createMessageFromMessageDescriptor(messageDescriptorArg)); + this.observableIntake.push( + ClientUniverseMessage.createMessageFromMessageDescriptor(messageDescriptorArg) + ); } }); diff --git a/ts/smartuniverse.classes.clientuniversechannel.ts b/ts/smartuniverse.classes.clientuniversechannel.ts index 74b0b9c..ba9d0be 100644 --- a/ts/smartuniverse.classes.clientuniversechannel.ts +++ b/ts/smartuniverse.classes.clientuniversechannel.ts @@ -54,7 +54,10 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel { name: this.name, passphrase: this.passphrase }; - await this.clientUniverseRef.smartsocketClient.serverCall(serverCallActionName, serverCallActionPayload); + await this.clientUniverseRef.smartsocketClient.serverCall( + serverCallActionName, + serverCallActionPayload + ); } /** @@ -72,6 +75,9 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel { payload: messageArg.payload, payloadStringType: messageArg.payloadStringType }; - await this.clientUniverseRef.smartsocketClient.serverCall('processMessage', universeMessageToSend); + await this.clientUniverseRef.smartsocketClient.serverCall( + 'processMessage', + universeMessageToSend + ); } } diff --git a/ts/smartuniverse.classes.universe.ts b/ts/smartuniverse.classes.universe.ts index 79f9842..01123d4 100644 --- a/ts/smartuniverse.classes.universe.ts +++ b/ts/smartuniverse.classes.universe.ts @@ -126,14 +126,23 @@ export class Universe { socketConnectionArg ); if (universeConnection) { - plugins.smartlog.defaultLogger.log('ok', 'found UniverseConnection for socket for incoming message'); + plugins.smartlog.defaultLogger.log( + 'ok', + 'found UniverseConnection for socket for incoming message' + ); } else { - plugins.smartlog.defaultLogger.log('warn', 'found no Authorized channel for incoming message'); + plugins.smartlog.defaultLogger.log( + 'warn', + 'found no Authorized channel for incoming message' + ); return { error: 'You need to authenticate for a channel' }; } - const unauthenticatedMessage = UniverseMessage.createMessageFromPayload(socketConnectionArg, dataArg); + const unauthenticatedMessage = UniverseMessage.createMessageFromPayload( + socketConnectionArg, + dataArg + ); const foundChannel = await UniverseChannel.authorizeAMessageForAChannel( this.universeCache, unauthenticatedMessage diff --git a/ts/smartuniverse.classes.universechannel.ts b/ts/smartuniverse.classes.universechannel.ts index 745d0db..87cd70c 100644 --- a/ts/smartuniverse.classes.universechannel.ts +++ b/ts/smartuniverse.classes.universechannel.ts @@ -121,7 +121,8 @@ export class UniverseChannel { } }); for (const universeConnection of universeConnectionsWithChannelAccess) { - const smartsocket = universeConnection.socketConnection.smartsocketRef as plugins.smartsocket.Smartsocket; + const smartsocket = universeConnection.socketConnection + .smartsocketRef as plugins.smartsocket.Smartsocket; const universeMessageToSend: interfaces.IUniverseMessage = { id: messageArg.id, timestamp: messageArg.timestamp, @@ -131,7 +132,11 @@ export class UniverseChannel { payload: messageArg.payload, payloadStringType: messageArg.payloadStringType }; - smartsocket.clientCall('processMessage', universeMessageToSend, universeConnection.socketConnection); + smartsocket.clientCall( + 'processMessage', + universeMessageToSend, + universeConnection.socketConnection + ); } } } diff --git a/ts/smartuniverse.classes.universeconnection.ts b/ts/smartuniverse.classes.universeconnection.ts index bc366ec..2881fa1 100644 --- a/ts/smartuniverse.classes.universeconnection.ts +++ b/ts/smartuniverse.classes.universeconnection.ts @@ -58,7 +58,10 @@ export class UniverseConnection { universeConnectionArg: UniverseConnection ): Promise { for (const authenticationRequest of universeConnectionArg.authenticationRequests) { - const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(universeRef, authenticationRequest.name); + const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName( + universeRef, + authenticationRequest.name + ); if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) { universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst); } diff --git a/ts/smartuniverse.classes.universemessage.ts b/ts/smartuniverse.classes.universemessage.ts index 43f2d2c..475cb67 100644 --- a/ts/smartuniverse.classes.universemessage.ts +++ b/ts/smartuniverse.classes.universemessage.ts @@ -14,7 +14,10 @@ import { SocketConnection } from '@pushrocks/smartsocket'; * acts as a container to save message states like authentication status */ export class UniverseMessage implements interfaces.IUniverseMessage { - public static createMessageFromPayload(socketConnectionArg: SocketConnection, dataArg: interfaces.IUniverseMessage) { + public static createMessageFromPayload( + socketConnectionArg: SocketConnection, + dataArg: interfaces.IUniverseMessage + ) { const universeMessageInstance = new UniverseMessage(dataArg); universeMessageInstance.socketConnection = socketConnectionArg; return universeMessageInstance; @@ -69,9 +72,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage { this.universeCache = universeCacheArg; } - public setTargetChannel() { - - } + public setTargetChannel() {} public setDestructionTimer(selfdestructAfterArg: number) { if (selfdestructAfterArg) {