Built motion from commit e1760111.|2.6.18
[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 _0x36bb=['then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','name','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var db=require(_0xb36b('0x1'))['db'];var seedDb=require(_0xb36b('0x2'));var checkLicense=require('./config/license');var rpc=require(_0xb36b('0x3'));var config=require(_0xb36b('0x4'));var logger=require(_0xb36b('0x5'))(_0xb36b('0x6'));var pm2=require(_0xb36b('0x7'));var pm2Config=require(_0xb36b('0x8'));var schedule=require(_0xb36b('0x9'));var chat=require(_0xb36b('0xa'));var whatsapp=require(_0xb36b('0xb'));var transcribe=require(_0xb36b('0xc'));var provider=require(_0xb36b('0xd'));function main(){return db[_0xb36b('0xe')][_0xb36b('0xf')]()[_0xb36b('0x10')](function(){if(config[_0xb36b('0x11')]){return seedDb[_0xb36b('0x12')]();}})[_0xb36b('0x10')](function(){return checkLicense[_0xb36b('0x12')]();})[_0xb36b('0x10')](function(){return rpc['listen']();})[_0xb36b('0x10')](function(_0x2b26c4){logger[_0xb36b('0x13')](_0x2b26c4);return chat['start']();})[_0xb36b('0x10')](function(){return whatsapp[_0xb36b('0x14')]();})[_0xb36b('0x10')](function(){return schedule[_0xb36b('0x14')]();})[_0xb36b('0x10')](function(){return transcribe[_0xb36b('0x14')]();})[_0xb36b('0x10')](function(){return provider[_0xb36b('0x14')]();})[_0xb36b('0x10')](function(_0x84926f){logger[_0xb36b('0x13')](_0x84926f);return pm2['start'](pm2Config);})[_0xb36b('0x10')](function(_0x4c2c46){var _0x5ca650=_0x4c2c46[_0xb36b('0x15')](function(_0x329f60){return typeof _0x329f60[_0xb36b('0x16')]===_0xb36b('0x17')&&_0x329f60[_0xb36b('0x16')]>=0x0;});if(_0x5ca650[_0xb36b('0x18')]>0x0){throw new Error(_0x5ca650['length']+_0xb36b('0x19')+_[_0xb36b('0x1a')](_0x5ca650,function(_0xfe29fc){return'\x22'+_0xfe29fc[_0xb36b('0x1b')]['name']+'\x22';}));}logger[_0xb36b('0x13')](_0xb36b('0x1c'),_[_0xb36b('0x1a')](_['filter'](_0x4c2c46,{'status':_0xb36b('0x1d')}),'name')[_0xb36b('0x1e')]());logger[_0xb36b('0x13')](_0xb36b('0x1f'),_[_0xb36b('0x1a')](_[_0xb36b('0x15')](_0x4c2c46,function(_0x5f6648){return _0x5f6648[_0xb36b('0x20')]!=='online';}),_0xb36b('0x21'))['join']()||_0xb36b('0x22'));console['log'](_0xb36b('0x23'));})[_0xb36b('0x24')](function(_0x2ef077){console[_0xb36b('0x25')](_0xb36b('0x26'),_0x2ef077);logger['error'](_0xb36b('0x27'),_0x2ef077);process[_0xb36b('0x28')](0x1);});}main();