Built motion from commit 994c64e1.|2.6.1
[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 _0x24ca=['./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','number','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','name','join','status','online','log','catch','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/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x24ca[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0xa24c('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xa24c('0x1'));var checkLicense=require(_0xa24c('0x2'));var rpc=require(_0xa24c('0x3'));var config=require('./config/environment');var logger=require(_0xa24c('0x4'))(_0xa24c('0x5'));var pm2=require(_0xa24c('0x6'));var pm2Config=require(_0xa24c('0x7'));var schedule=require(_0xa24c('0x8'));var chat=require(_0xa24c('0x9'));var whatsapp=require(_0xa24c('0xa'));var transcribe=require(_0xa24c('0xb'));var provider=require(_0xa24c('0xc'));function main(){return db[_0xa24c('0xd')][_0xa24c('0xe')]()['then'](function(){if(config[_0xa24c('0xf')]){return seedDb[_0xa24c('0x10')]();}})[_0xa24c('0x11')](function(){return checkLicense['default']();})[_0xa24c('0x11')](function(){return rpc[_0xa24c('0x12')]();})[_0xa24c('0x11')](function(_0x211003){logger[_0xa24c('0x13')](_0x211003);return chat[_0xa24c('0x14')]();})[_0xa24c('0x11')](function(){return whatsapp[_0xa24c('0x14')]();})[_0xa24c('0x11')](function(){return schedule['start']();})[_0xa24c('0x11')](function(){return transcribe[_0xa24c('0x14')]();})[_0xa24c('0x11')](function(){return provider[_0xa24c('0x14')]();})['then'](function(_0x3ad0bf){logger[_0xa24c('0x13')](_0x3ad0bf);return pm2[_0xa24c('0x14')](pm2Config);})[_0xa24c('0x11')](function(_0x1cb08e){var _0x2d185c=_0x1cb08e[_0xa24c('0x15')](function(_0x5d4727){return typeof _0x5d4727['exitCode']===_0xa24c('0x16')&&_0x5d4727[_0xa24c('0x17')]>=0x0;});if(_0x2d185c['length']>0x0){throw new Error(_0x2d185c['length']+_0xa24c('0x18')+_[_0xa24c('0x19')](_0x2d185c,function(_0x5c479e){return'\x22'+_0x5c479e[_0xa24c('0x1a')]['name']+'\x22';}));}logger[_0xa24c('0x13')](_0xa24c('0x1b'),_[_0xa24c('0x19')](_[_0xa24c('0x15')](_0x1cb08e,{'status':'online'}),_0xa24c('0x1c'))[_0xa24c('0x1d')]());logger[_0xa24c('0x13')]('Offline\x20apps:',_['map'](_['filter'](_0x1cb08e,function(_0x4cd77e){return _0x4cd77e[_0xa24c('0x1e')]!==_0xa24c('0x1f');}),_0xa24c('0x1c'))[_0xa24c('0x1d')]()||'None');console[_0xa24c('0x20')]('App\x20Ready!');})[_0xa24c('0x21')](function(_0xb81d97){console['log'](_0xa24c('0x22'),_0xb81d97);logger[_0xa24c('0x23')](_0xa24c('0x24'),_0xb81d97);process[_0xa24c('0x25')](0x1);});}main();