Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
241182ed2e | |||
3d82038ec3 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartuniverse",
|
||||
"version": "1.0.39",
|
||||
"version": "1.0.40",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartuniverse",
|
||||
"version": "1.0.39",
|
||||
"version": "1.0.40",
|
||||
"private": false,
|
||||
"description": "messaging service for your micro services",
|
||||
"main": "dist/index.js",
|
||||
|
@ -36,6 +36,12 @@ export class ClientUniverse {
|
||||
* TODO: verify channel before adding it to the channel cache
|
||||
*/
|
||||
public async addChannel (channelNameArg: string, passphraseArg: string) {
|
||||
const existingChannel = this.getChannel(channelNameArg);
|
||||
|
||||
if (existingChannel) {
|
||||
throw new Error('channel exists');
|
||||
}
|
||||
|
||||
const clientUniverseChannel = await ClientUniverseChannel.createClientUniverseChannel(
|
||||
this,
|
||||
channelNameArg,
|
||||
@ -49,8 +55,11 @@ export class ClientUniverse {
|
||||
* @param channelName
|
||||
* @param passphraseArg
|
||||
*/
|
||||
public async getChannel(channelName: string, passphraseArg?: string): Promise<ClientUniverseChannel> {
|
||||
public async getChannel(channelName: string): Promise<ClientUniverseChannel> {
|
||||
await this.checkConnection();
|
||||
const clientUniverseChannel = this.channelCache.find(channel => {
|
||||
return channel.name === channelName;
|
||||
})
|
||||
return clientUniverseChannel;
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,16 @@ export class ClientUniverseChannel implements interfaces.IUniverseChannel {
|
||||
// INSTANCE
|
||||
// ========
|
||||
|
||||
public clientUniverse: ClientUniverse;
|
||||
// properties
|
||||
public name: string;
|
||||
public passphrase: string;
|
||||
|
||||
constructor(clientUniverseArg: ClientUniverse, passphraseArg: string) {
|
||||
|
||||
// refs
|
||||
public clientUniverse: ClientUniverse;
|
||||
|
||||
constructor(clientUniverseArg: ClientUniverse, nameArg: string, passphraseArg: string) {
|
||||
this.clientUniverse = clientUniverseArg;
|
||||
this.name = nameArg;
|
||||
this.passphrase = passphraseArg;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user