Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / app.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x0738=['./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','join','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x3e5ee7,_0x148db7){var _0x3fe720=function(_0x5952ba){while(--_0x5952ba){_0x3e5ee7['push'](_0x3e5ee7['shift']());}};_0x3fe720(++_0x148db7);}(_0x0738,0x6e));var _0x8073=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x0738[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x8073('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x8073('0x1'));var checkLicense=require(_0x8073('0x2'));var rpc=require(_0x8073('0x3'));var config=require(_0x8073('0x4'));var logger=require(_0x8073('0x5'))(_0x8073('0x6'));var pm2=require(_0x8073('0x7'));var pm2Config=require(_0x8073('0x8'));var schedule=require(_0x8073('0x9'));var chat=require(_0x8073('0xa'));var whatsapp=require(_0x8073('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8073('0xc'));function main(){return db[_0x8073('0xd')][_0x8073('0xe')]()[_0x8073('0xf')](function(){if(config[_0x8073('0x10')]){return seedDb[_0x8073('0x11')]();}})[_0x8073('0xf')](function(){return checkLicense[_0x8073('0x11')]();})[_0x8073('0xf')](function(){return rpc['listen']();})['then'](function(_0x28e17b){logger[_0x8073('0x12')](_0x28e17b);return chat[_0x8073('0x13')]();})[_0x8073('0xf')](function(){return whatsapp['start']();})[_0x8073('0xf')](function(){return schedule[_0x8073('0x13')]();})['then'](function(){return transcribe[_0x8073('0x13')]();})['then'](function(){return provider[_0x8073('0x13')]();})[_0x8073('0xf')](function(_0x10c69a){logger[_0x8073('0x12')](_0x10c69a);return pm2['start'](pm2Config);})[_0x8073('0xf')](function(_0x459644){var _0x116aa=_0x459644[_0x8073('0x14')](function(_0x2ec7af){return typeof _0x2ec7af[_0x8073('0x15')]===_0x8073('0x16')&&_0x2ec7af['exitCode']>=0x0;});if(_0x116aa[_0x8073('0x17')]>0x0){throw new Error(_0x116aa['length']+_0x8073('0x18')+_[_0x8073('0x19')](_0x116aa,function(_0x1d1541){return'\x22'+_0x1d1541[_0x8073('0x1a')][_0x8073('0x1b')]+'\x22';}));}logger[_0x8073('0x12')](_0x8073('0x1c'),_[_0x8073('0x19')](_[_0x8073('0x14')](_0x459644,{'status':_0x8073('0x1d')}),'name')['join']());logger[_0x8073('0x12')](_0x8073('0x1e'),_['map'](_[_0x8073('0x14')](_0x459644,function(_0x3e4395){return _0x3e4395[_0x8073('0x1f')]!==_0x8073('0x1d');}),_0x8073('0x1b'))[_0x8073('0x20')]()||_0x8073('0x21'));console['log'](_0x8073('0x22'));})['catch'](function(_0x24b515){console[_0x8073('0x23')](_0x8073('0x24'),_0x24b515);logger[_0x8073('0x25')](_0x8073('0x26'),_0x24b515);process[_0x8073('0x27')](0x1);});}main();