"use strict";var cov_13t9hk2g1o=function(){var path="/Users/josh.burman/Projects/braid/dist/server/channelManager.js";var hash="f42d8b6bada297c692e584213a28e2deaf5ff9ff";var Function=function(){}.constructor;var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/Users/josh.burman/Projects/braid/dist/server/channelManager.js",statementMap:{"0":{start:{line:2,column:0},end:{line:2,column:62}},"1":{start:{line:3,column:22},end:{line:3,column:55}},"2":{start:{line:4,column:13},end:{line:4,column:32}},"3":{start:{line:7,column:8},end:{line:7,column:27}},"4":{start:{line:9,column:22},end:{line:9,column:58}},"5":{start:{line:10,column:8},end:{line:10,column:36}},"6":{start:{line:13,column:28},end:{line:13,column:60}},"7":{start:{line:14,column:8},end:{line:21,column:9}},"8":{start:{line:15,column:12},end:{line:15,column:75}},"9":{start:{line:18,column:26},end:{line:18,column:56}},"10":{start:{line:19,column:12},end:{line:19,column:40}},"11":{start:{line:20,column:12},end:{line:20,column:85}},"12":{start:{line:22,column:8},end:{line:22,column:23}},"13":{start:{line:25,column:8},end:{line:29,column:9}},"14":{start:{line:26,column:12},end:{line:28,column:13}},"15":{start:{line:27,column:16},end:{line:27,column:31}},"16":{start:{line:30,column:8},end:{line:30,column:20}},"17":{start:{line:33,column:22},end:{line:33,column:52}},"18":{start:{line:34,column:8},end:{line:42,column:9}},"19":{start:{line:35,column:12},end:{line:35,column:38}},"20":{start:{line:36,column:12},end:{line:36,column:45}},"21":{start:{line:37,column:12},end:{line:37,column:43}},"22":{start:{line:40,column:12},end:{line:40,column:83}},"23":{start:{line:41,column:12},end:{line:41,column:102}},"24":{start:{line:45,column:8},end:{line:54,column:9}},"25":{start:{line:46,column:26},end:{line:46,column:90}},"26":{start:{line:47,column:12},end:{line:47,column:121}},"27":{start:{line:48,column:12},end:{line:48,column:45}},"28":{start:{line:51,column:12},end:{line:51,column:36}},"29":{start:{line:52,column:12},end:{line:52,column:76}},"30":{start:{line:53,column:12},end:{line:53,column:59}},"31":{start:{line:58,column:0},end:{line:58,column:33}}},fnMap:{"0":{name:"(anonymous_0)",decl:{start:{line:6,column:4},end:{line:6,column:5}},loc:{start:{line:6,column:18},end:{line:11,column:5}},line:6},"1":{name:"(anonymous_1)",decl:{start:{line:12,column:4},end:{line:12,column:5}},loc:{start:{line:12,column:24},end:{line:23,column:5}},line:12},"2":{name:"(anonymous_2)",decl:{start:{line:24,column:4},end:{line:24,column:5}},loc:{start:{line:24,column:30},end:{line:31,column:5}},line:24},"3":{name:"(anonymous_3)",decl:{start:{line:32,column:4},end:{line:32,column:5}},loc:{start:{line:32,column:43},end:{line:43,column:5}},line:32},"4":{name:"(anonymous_4)",decl:{start:{line:44,column:4},end:{line:44,column:5}},loc:{start:{line:44,column:30},end:{line:55,column:5}},line:44}},branchMap:{"0":{loc:{start:{line:14,column:8},end:{line:21,column:9}},type:"if",locations:[{start:{line:14,column:8},end:{line:21,column:9}},{start:{line:14,column:8},end:{line:21,column:9}}],line:14},"1":{loc:{start:{line:26,column:12},end:{line:28,column:13}},type:"if",locations:[{start:{line:26,column:12},end:{line:28,column:13}},{start:{line:26,column:12},end:{line:28,column:13}}],line:26},"2":{loc:{start:{line:34,column:8},end:{line:42,column:9}},type:"if",locations:[{start:{line:34,column:8},end:{line:42,column:9}},{start:{line:34,column:8},end:{line:42,column:9}}],line:34}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0},f:{"0":0,"1":0,"2":0,"3":0,"4":0},b:{"0":[0,0],"1":[0,0],"2":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();cov_13t9hk2g1o.s[0]++;Object.defineProperty(exports,"__esModule",{value:true});const channelBase_1=(cov_13t9hk2g1o.s[1]++,require("./channels/channelBase"));var logger=(cov_13t9hk2g1o.s[2]++,require('./logger'));class ChannelManager{constructor(){cov_13t9hk2g1o.f[0]++;cov_13t9hk2g1o.s[3]++;this.channels=[];// create default channel...
var channel=(cov_13t9hk2g1o.s[4]++,new channelBase_1.default('default'));cov_13t9hk2g1o.s[5]++;this.channels.push(channel);}createChannel(data){cov_13t9hk2g1o.f[1]++;var channelExists=(cov_13t9hk2g1o.s[6]++,this.channelExists(data.channel));cov_13t9hk2g1o.s[7]++;if(channelExists){cov_13t9hk2g1o.b[0][0]++;cov_13t9hk2g1o.s[8]++;logger.accessLog.info(`Channel already exists: ${channel.id}`);}else{cov_13t9hk2g1o.b[0][1]++;var channel=(cov_13t9hk2g1o.s[9]++,this.createByChannelType(data));cov_13t9hk2g1o.s[10]++;this.channels.push(channel);cov_13t9hk2g1o.s[11]++;logger.accessLog.info(`Added channel to channel manager: ${channel.id}`);}cov_13t9hk2g1o.s[12]++;return channel;}channelExists(channel_id){cov_13t9hk2g1o.f[2]++;cov_13t9hk2g1o.s[13]++;for(let channel of this.channels){cov_13t9hk2g1o.s[14]++;if(channel.id==channel_id){cov_13t9hk2g1o.b[1][0]++;cov_13t9hk2g1o.s[15]++;return channel;}else{cov_13t9hk2g1o.b[1][1]++;}}cov_13t9hk2g1o.s[16]++;return null;}addClientToChannel(client,channel_id){cov_13t9hk2g1o.f[3]++;var channel=(cov_13t9hk2g1o.s[17]++,this.channelExists(channel_id));cov_13t9hk2g1o.s[18]++;if(channel){cov_13t9hk2g1o.b[2][0]++;cov_13t9hk2g1o.s[19]++;channel.addClient(client);cov_13t9hk2g1o.s[20]++;client.connectToChannel(channel);cov_13t9hk2g1o.s[21]++;return{'status':'success'};}else{cov_13t9hk2g1o.b[2][1]++;cov_13t9hk2g1o.s[22]++;logger.accessLog.info(`channel with id ${channel_id} does not exist.`);cov_13t9hk2g1o.s[23]++;return{'status':'notice','message':`channel with id ${channel_id} does not exist.`};}}createByChannelType(data){cov_13t9hk2g1o.f[4]++;cov_13t9hk2g1o.s[24]++;try{var Channel=(cov_13t9hk2g1o.s[25]++,require(`./channels/${data.client_type}s/${data.client}channel`));cov_13t9hk2g1o.s[26]++;logger.accessLog.info(`attempting to create channel of type ${data.client}, channel id: ${data.channel}...`);cov_13t9hk2g1o.s[27]++;return new Channel(data.channel);}catch(e){cov_13t9hk2g1o.s[28]++;logger.errorLog.info(e);cov_13t9hk2g1o.s[29]++;logger.accessLog.info(`creating base channel: ${data.channel}`);cov_13t9hk2g1o.s[30]++;return new channelBase_1.default(data.channel);}}};cov_13t9hk2g1o.s[31]++;exports.default=ChannelManager;// { :client => 'mhs', :client_type => 'site', :user_id => 125, :user_type => 'user', :channel => 'mhs_1239' }
//# sourceMappingURL=channelManager.js.map