Built motion from commit eddce310.|2.6.12
[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 _0x536e=['./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','default','listen','start','info','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','join','Offline\x20apps:','filter','status','online','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x536e,0x155));var _0xe536=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0x536e[_0x2656a4];return _0x48ce85;};'use strict';var _=require(_0xe536('0x0'));var db=require(_0xe536('0x1'))['db'];var seedDb=require(_0xe536('0x2'));var checkLicense=require(_0xe536('0x3'));var rpc=require(_0xe536('0x4'));var config=require(_0xe536('0x5'));var logger=require(_0xe536('0x6'))(_0xe536('0x7'));var pm2=require(_0xe536('0x8'));var pm2Config=require(_0xe536('0x9'));var schedule=require(_0xe536('0xa'));var chat=require(_0xe536('0xb'));var whatsapp=require(_0xe536('0xc'));var transcribe=require(_0xe536('0xd'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0xe536('0xe')]()[_0xe536('0xf')](function(){if(config['seedDB']){return seedDb[_0xe536('0x10')]();}})[_0xe536('0xf')](function(){return checkLicense[_0xe536('0x10')]();})[_0xe536('0xf')](function(){return rpc[_0xe536('0x11')]();})[_0xe536('0xf')](function(_0xe08ef0){logger['info'](_0xe08ef0);return chat['start']();})[_0xe536('0xf')](function(){return whatsapp[_0xe536('0x12')]();})['then'](function(){return schedule[_0xe536('0x12')]();})[_0xe536('0xf')](function(){return transcribe[_0xe536('0x12')]();})[_0xe536('0xf')](function(){return provider[_0xe536('0x12')]();})[_0xe536('0xf')](function(_0x498591){logger[_0xe536('0x13')](_0x498591);return pm2[_0xe536('0x12')](pm2Config);})[_0xe536('0xf')](function(_0x32e841){var _0x349020=_0x32e841['filter'](function(_0x410583){return typeof _0x410583[_0xe536('0x14')]===_0xe536('0x15')&&_0x410583['exitCode']>=0x0;});if(_0x349020[_0xe536('0x16')]>0x0){throw new Error(_0x349020[_0xe536('0x16')]+_0xe536('0x17')+_[_0xe536('0x18')](_0x349020,function(_0x4cf519){return'\x22'+_0x4cf519['pm2_env'][_0xe536('0x19')]+'\x22';}));}logger[_0xe536('0x13')](_0xe536('0x1a'),_[_0xe536('0x18')](_['filter'](_0x32e841,{'status':'online'}),_0xe536('0x19'))[_0xe536('0x1b')]());logger[_0xe536('0x13')](_0xe536('0x1c'),_[_0xe536('0x18')](_[_0xe536('0x1d')](_0x32e841,function(_0x3c3e82){return _0x3c3e82[_0xe536('0x1e')]!==_0xe536('0x1f');}),_0xe536('0x19'))[_0xe536('0x1b')]()||'None');console['log'](_0xe536('0x20'));})[_0xe536('0x21')](function(_0x5a034d){console['log'](_0xe536('0x22'),_0x5a034d);logger[_0xe536('0x23')](_0xe536('0x24'),_0x5a034d);process[_0xe536('0x25')](0x1);});}main();