fix(UniverseChannel): improve channel handling
This commit is contained in:
parent
4fc6e327ec
commit
8b650c5ea7
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartuniverse",
|
"name": "@pushrocks/smartuniverse",
|
||||||
"version": "1.0.18",
|
"version": "1.0.18",
|
||||||
"private": true,
|
"private": false,
|
||||||
"description": "messaging service for your micro services",
|
"description": "messaging service for your micro services",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -6,6 +6,11 @@ import { Objectmap } from 'lik';
|
|||||||
* enables messages to stay within a certain scope.
|
* enables messages to stay within a certain scope.
|
||||||
*/
|
*/
|
||||||
export class UniverseChannel {
|
export class UniverseChannel {
|
||||||
|
|
||||||
|
// ======
|
||||||
|
// STATIC
|
||||||
|
// ======
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stores the channels that are available within the universe
|
* stores the channels that are available within the universe
|
||||||
*/
|
*/
|
||||||
@ -26,6 +31,20 @@ export class UniverseChannel {
|
|||||||
return newChannel;
|
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) {
|
public static authorizeForChannel (channelNameArg: string, passphraseArg: string) {
|
||||||
const foundChannel = this.channelStore.find(universeChannel => {
|
const foundChannel = this.channelStore.find(universeChannel => {
|
||||||
const result = universeChannel.authenticate(channelNameArg, passphraseArg);
|
const result = universeChannel.authenticate(channelNameArg, passphraseArg);
|
||||||
@ -38,6 +57,9 @@ export class UniverseChannel {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ========
|
||||||
|
// INSTANCE
|
||||||
|
// ========
|
||||||
/**
|
/**
|
||||||
* the name of the channel
|
* the name of the channel
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user