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