Built motion from commit 5ad77b03.|2.6.3
[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 _0xbf25=['./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','join','Offline\x20apps:','status','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash'];(function(_0x38d0dd,_0x4b164b){var _0x2a8bc4=function(_0x12f6e5){while(--_0x12f6e5){_0x38d0dd['push'](_0x38d0dd['shift']());}};_0x2a8bc4(++_0x4b164b);}(_0xbf25,0x15e));var _0x5bf2=function(_0x264590,_0x1d2f28){_0x264590=_0x264590-0x0;var _0x46b3e4=_0xbf25[_0x264590];return _0x46b3e4;};'use strict';var _=require(_0x5bf2('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x5bf2('0x1'));var checkLicense=require(_0x5bf2('0x2'));var rpc=require(_0x5bf2('0x3'));var config=require(_0x5bf2('0x4'));var logger=require(_0x5bf2('0x5'))(_0x5bf2('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x5bf2('0x7'));var schedule=require('./config/schedule');var chat=require(_0x5bf2('0x8'));var whatsapp=require(_0x5bf2('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x5bf2('0xa'));function main(){return db[_0x5bf2('0xb')][_0x5bf2('0xc')]()['then'](function(){if(config[_0x5bf2('0xd')]){return seedDb[_0x5bf2('0xe')]();}})[_0x5bf2('0xf')](function(){return checkLicense['default']();})[_0x5bf2('0xf')](function(){return rpc[_0x5bf2('0x10')]();})[_0x5bf2('0xf')](function(_0xefe019){logger[_0x5bf2('0x11')](_0xefe019);return chat[_0x5bf2('0x12')]();})[_0x5bf2('0xf')](function(){return whatsapp[_0x5bf2('0x12')]();})[_0x5bf2('0xf')](function(){return schedule[_0x5bf2('0x12')]();})[_0x5bf2('0xf')](function(){return transcribe[_0x5bf2('0x12')]();})[_0x5bf2('0xf')](function(){return provider['start']();})['then'](function(_0x2b2e52){logger[_0x5bf2('0x11')](_0x2b2e52);return pm2['start'](pm2Config);})[_0x5bf2('0xf')](function(_0x43a83b){var _0x1bdb56=_0x43a83b[_0x5bf2('0x13')](function(_0x15abc4){return typeof _0x15abc4[_0x5bf2('0x14')]===_0x5bf2('0x15')&&_0x15abc4[_0x5bf2('0x14')]>=0x0;});if(_0x1bdb56[_0x5bf2('0x16')]>0x0){throw new Error(_0x1bdb56[_0x5bf2('0x16')]+_0x5bf2('0x17')+_[_0x5bf2('0x18')](_0x1bdb56,function(_0x4d1990){return'\x22'+_0x4d1990['pm2_env'][_0x5bf2('0x19')]+'\x22';}));}logger['info'](_0x5bf2('0x1a'),_[_0x5bf2('0x18')](_['filter'](_0x43a83b,{'status':'online'}),_0x5bf2('0x19'))[_0x5bf2('0x1b')]());logger[_0x5bf2('0x11')](_0x5bf2('0x1c'),_[_0x5bf2('0x18')](_[_0x5bf2('0x13')](_0x43a83b,function(_0x3a9694){return _0x3a9694[_0x5bf2('0x1d')]!==_0x5bf2('0x1e');}),'name')['join']()||_0x5bf2('0x1f'));console[_0x5bf2('0x20')](_0x5bf2('0x21'));})[_0x5bf2('0x22')](function(_0x18caac){console[_0x5bf2('0x20')](_0x5bf2('0x23'),_0x18caac);logger[_0x5bf2('0x24')](_0x5bf2('0x25'),_0x18caac);process[_0x5bf2('0x26')](0x1);});}main();