Compare commits

..

2 Commits

Author SHA1 Message Date
c1a03fec0f 1.0.19 2018-05-24 16:55:25 +02:00
8b650c5ea7 fix(UniverseChannel): improve channel handling 2018-05-24 16:55:24 +02:00
3 changed files with 25 additions and 3 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartuniverse",
"version": "1.0.18",
"version": "1.0.19",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/smartuniverse",
"version": "1.0.18",
"private": true,
"version": "1.0.19",
"private": false,
"description": "messaging service for your micro services",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

View File

@ -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
*/