diff --git a/package.json b/package.json index 04cb3fc..7656b4f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@pushrocks/smartuniverse", "version": "1.0.18", - "private": true, + "private": false, "description": "messaging service for your micro services", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/ts/smartuniverse.classes.universechannel.ts b/ts/smartuniverse.classes.universechannel.ts index 93ed681..8348f63 100644 --- a/ts/smartuniverse.classes.universechannel.ts +++ b/ts/smartuniverse.classes.universechannel.ts @@ -6,6 +6,11 @@ import { Objectmap } from 'lik'; * enables messages to stay within a certain scope. */ export class UniverseChannel { + + // ====== + // STATIC + // ====== + /** * stores the channels that are available within the universe */ @@ -26,6 +31,20 @@ export class UniverseChannel { return newChannel; }; + /** + * returns boolean wether certain channel exists + */ + public static async doesChannelExists (channelNameArg: string) { + const channel = this.channelStore.find(channelArg => { + return channelArg.name === channelNameArg; + }); + if(channel) { + return true; + } else { + return false; + } + } + public static authorizeForChannel (channelNameArg: string, passphraseArg: string) { const foundChannel = this.channelStore.find(universeChannel => { const result = universeChannel.authenticate(channelNameArg, passphraseArg); @@ -38,6 +57,9 @@ export class UniverseChannel { } }; + // ======== + // INSTANCE + // ======== /** * the name of the channel */