Merge pull request #31 from yardstick/feature/QUANT-953

QUANT-953: remove `CustomChannel`
This commit is contained in:
Nick 2023-08-03 18:01:46 -04:00 committed by GitHub
commit 3b723cbad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 34 deletions

View File

@ -1,4 +1,4 @@
# BRAID v1.3.0
# BRAID v1.3.1
> Websocket server for the Measure platform
[![Build Status](https://semaphoreci.com/api/v1/projects/7767f0f3-4da6-4c84-9167-4db5402a3262/2573412/badge.svg)](https://semaphoreci.com/yardstick/braid)

View File

@ -1 +1 @@
1.3.0
1.3.1

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "braid",
"version": "1.2.3",
"version": "1.2.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "braid",
"version": "1.2.2",
"version": "1.3.1",
"description": "",
"main": "index.js",
"scripts": {

View File

@ -1,6 +1,5 @@
import PublicChannel from './channels/types/publicChannel';
import PrivateChannel from './channels/types/privateChannel';
import CustomChannel from './channels/types/customChannel';
import PublicClient from './clients/types/publicClient';
import PrivateClient from './clients/types/privateClient';
import CustomClient from './clients/types/customClient';
@ -17,8 +16,8 @@ class ChannelManager {
}
createChannel(data: any) {
const channelExists: PublicChannel|PrivateChannel|CustomChannel|null = this.channelExists(data.channel);
let channel: PublicChannel|PrivateChannel|CustomChannel;
const channelExists: PublicChannel|PrivateChannel|null = this.channelExists(data.channel);
let channel: PublicChannel|PrivateChannel;
if (channelExists) {
channel = channelExists;
@ -43,7 +42,7 @@ class ChannelManager {
}
addClientToChannel(client: PublicClient|PrivateClient|CustomClient, channel_id: string) {
const channel: PrivateChannel|PrivateChannel|CustomChannel|null = this.channelExists(channel_id);
const channel: PrivateChannel|PrivateChannel|null = this.channelExists(channel_id);
if (channel) {
channel.addClient(client);
@ -54,7 +53,7 @@ class ChannelManager {
}
}
updateChannelContent(channel: PrivateChannel|PrivateChannel|CustomChannel, channelContent: JSON) {
updateChannelContent(channel: PrivateChannel|PrivateChannel, channelContent: JSON) {
if (channel) {
channel.channelContent = channelContent;
return {status: 'success'};
@ -70,12 +69,10 @@ class ChannelManager {
`attempting to create channel of type ${data.channel_type}, channel id: ${data.channel}...`
);
if (data.channel_type === 'public') {
return new PublicChannel(data.channel);
} else if (data.channel_type === 'private') {
if (data.channel_type === 'private') {
return new PrivateChannel(data.channel);
} else {
return new CustomChannel(data.channel, data.custom);
return new PublicChannel(data.channel);
}
} catch (e) {
console.log(e);

View File

@ -1,18 +0,0 @@
import CustomClient from '../../clients/types/customClient';
import ChannelBase from '../channelBase';
class CustomChannel extends ChannelBase {
clients: CustomClient[] = [];
constructor(id: string, custom: any) {
super(id);
if (custom) {
this.broadcastConditions = custom.broadcastConditions;
this.channelContent = custom.channelContent;
this.explicitRemoval = custom.explicitRemoval;
}
}
}
export default CustomChannel;

View File

@ -3,7 +3,6 @@ import ClientManager from '../clientManager';
import ChannelManager from '../channelManager';
import PublicChannel from '../channels/types/publicChannel';
import PrivateChannel from '../channels/types/privateChannel';
import CustomChannel from '../channels/types/customChannel';
const messageManager = require('../messageManager');
const logger = require('../logger');
@ -12,7 +11,7 @@ class ClientBase {
ws: WebSocket;
data: any;
id: number;
channel: PublicChannel|PrivateChannel|CustomChannel|null;
channel: PublicChannel|PrivateChannel|null;
clientManager: ClientManager;
channelManager: ChannelManager;
roles: string[];
@ -68,7 +67,7 @@ class ClientBase {
return this.data.client;
}
connectToChannel(channel: PublicChannel|PrivateChannel|CustomChannel) {
connectToChannel(channel: PublicChannel|PrivateChannel) {
this.channel = channel;
this.ws.on('message', this.messageListener);
this.ws.on('close', this.closeListener);